https://github.com/abhirockzz/fn-java-client-example
Example for a Java client invoking a Function HTTP endpoint
https://github.com/abhirockzz/fn-java-client-example
fnproject functions serverless
Last synced: 12 months ago
JSON representation
Example for a Java client invoking a Function HTTP endpoint
- Host: GitHub
- URL: https://github.com/abhirockzz/fn-java-client-example
- Owner: abhirockzz
- Created: 2018-08-13T10:28:02.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-17T11:03:20.000Z (about 7 years ago)
- Last Synced: 2025-02-13T16:33:32.445Z (about 1 year ago)
- Topics: fnproject, functions, serverless
- Language: Java
- Homepage:
- Size: 6.84 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Example for a Java client invoking a Function HTTP endpoint
Function endpoints are protected and need to be invoked using valid authentication context. You would need to use OCI Request Signature [as outlined in this document](https://docs.cloud.oracle.com/iaas/Content/API/Concepts/signingrequests.htm?TocPath=Developer%20Tools%20|REST%20APIs%20|_____4). This example shows how to invoke Functions HTTP endpoints using OCI Request Signature based Java Client
## Make sure you have the following information....
- your tenancy OCID, user OCID, fingerprint, private Key - [details here](https://docs.cloud.oracle.com/iaas/Content/API/Concepts/apisigningkey.htm)
- to find the HTTP endpoint for your function - execute `fn inspect fn ` and the look out for value of `fnproject.io/fn/invokeEndpoint` attribute
## Details
- The HTTP interaction is in `FnClientCommon.java`
- it is based [on this](https://docs.cloud.oracle.com/iaas/Content/API/Concepts/signingrequests.htm?TocPath=Developer%20Tools%20|REST%20APIs%20|_____4#Java)
- it uses the [Apache HTTP Client](https://hc.apache.org/) (but you should be able to build an implementation using a client library of your choice)
- `FnHTTPGet.java` and `FnHTTPPost.java` are examples of invoking HTTP `GET` and `POST` respectively using `FnClientCommon.java`