Skip to content

Latest commit

 

History

History
90 lines (69 loc) · 5.91 KB

README.md

File metadata and controls

90 lines (69 loc) · 5.91 KB

CloudFunctions Examples Repo

This repo contains various examples of Cloud Functions. These functions are NOT intended for production use, but rather to show how to construct them.

For things like getting return data and passing security related information, these functions are not good examples to use.

For passing security related information, it is best to use Authentication header and HTTPS. A example implementation can be found here and here.

For getting return data, it is best to convert the information to JSON and then return a JSON string to the caller for processing into objects. More information on this can be found here.

Implementation examples of these are however beyond the scope of these demos and are left to the reader to source. Although, one MySQL example has been extended to show how this can be done. See the Azure functions below.

These examples assume you have a basic knowledge of what serverless cloud computing is and what cloud functions do. If not, then please see the notes below before trying these examples.

One of the GCP demos also includes instructions/demo on setting up API Gateway, so that the function is hosted behind a gateway.

Status

Cloud Functions Status: Ready for use

Build CI/Testing Status

The following indicates the CI and coverage status.

Java CI with Maven

Azure Cloud Function Examples

The examples contained in this repo run on Maven and Azure. They are based in the following directories.

Project Description
samples/Azure/AdvancedHttpFunction/ This sample will use Maven to build advance HTTP functions
samples/Azure/MySQLFunction/ This sample will use Maven to build MySQL HTTP functions. This demo does show how to return JSON formatted information
samples/Azure/SendHttpRequest/ This sample will use Maven to build HTTP relay functions
samples/Azure/SimpleHttpFunction/ This sample will use Maven to build simple HTTP functions

GCP Cloud Function Examples

The examples contained in this repo run on Maven and GCP. They are based in the following directories.

Cloud Functions have the following: -

  • HTTP triggered
  • Pub/Sub triggered
  • Cloud Storage triggered

The only ones provided in these samples are HTTP triggered.

Project Description
samples/GCP/AdvancedHttpFunction/ This sample will use Maven to build advance HTTP functions
samples/GCP/NoSQLSpanner/ This sample will use Maven to build NoSQL query functions using Spanner
samples/GCP/SendHttpRequest/ This sample will use Maven to build HTTP relay functions. This also includes an example on how to deploy an API Gateway
samples/GCP/SimpleHttpFunction/ This sample will use Maven to build simple HTTP functions

Notes

The following notes may be useful.

Azure

Google Cloud Platform

Issues

  • On Mac Azure needs the JAVA_HOME faked when running functions locally
  • Object data is being returned as pseudo HTML constructed in the cloud functions. This is NOT the way to do it for real. You should convert the object data to JSON and then return this string to the calling client. However, this is beyond the scope of these demos. Although, I may add one to show how to do it in the future.

Liability Warning

The contents of this repository (documents and examples) are provided “as-is” with no warrantee implied or otherwise about the accuracy or functionality of the examples.

You use them at your own risk. If anything results to your machine or environment or anything else as a result of ignoring this warning, then the fault is yours only and has nothing to do with me.