8000 GitHub - cloudatio/openfaas-client-java: Serverless Functions Made Simple for Docker and Kubernetes - Java Client
[go: up one dir, main page]

Skip to content

Serverless Functions Made Simple for Docker and Kubernetes - Java Client

Notifications You must be signed in to change notification settings

cloudatio/openfaas-client-java

Repository files navigation

openfaas-client

Requirements

Building the API client library requires Maven to be installed.

Installation

To install the API client library to your local Maven repository, simply execute:

mvn install

To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:

mvn deploy

Refer to the official documentation for more information.

Maven users

Add this dependency to your project's POM:

<dependency>
    <groupId>com.cloudatio.openfaas</groupId>
    <artifactId>openfaas-client</artifactId>
    <version>0.0.1</version>
    <scope>compile</scope>
</dependency>

Gradle users

Add this dependency to your project's build file:

compile "com.cloudatio.openfaas:openfaas-client:0.0.1"

Others

At first generate the JAR by executing:

mvn package

Then manually install the following JARs:

  • target/openfaas-client-0.0.1.jar
  • target/lib/*.jar

Getting Started

Please follow the installation instruction and execute the following Java code:

import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.DefaultApi;

import java.io.File;
import java.util.*;

public class DefaultApiExample {

    public static void main(String[] args) {
        
        DefaultApi apiInstance = new DefaultApi();
        String functionName = "functionName_example"; // String | Function name
        byte[] input = BINARY_DATA_HERE; // byte[] | (Optional) data to pass to function
        try {
            apiInstance.asyncFunctionFunctionNamePost(functionName, input);
        } catch (ApiException e) {
            System.err.println("Exception when calling DefaultApi#asyncFunctionFunctionNamePost");
            e.printStackTrace();
        }
    }
}

Documentation for API Endpoints

All URIs are relative to http://localhost

Class Method HTTP request Description
DefaultApi asyncFunctionFunctionNamePost POST /async-function/{functionName} Invoke a function asynchronously in OpenFaaS
DefaultApi functionFunctionNamePost POST /function/{functionName} Invoke a function defined in OpenFaaS
DefaultApi healthzGet GET /healthz Healthcheck
DefaultApi systemAlertPost POST /system/alert Event-sink for AlertManager, for auto-scaling
DefaultApi systemFunctionFunctionNameGet GET /system/function/{functionName} Get a summary of an OpenFaaS function
DefaultApi systemFunctionsDelete DELETE /system/functions Remove a deployed function.
DefaultApi systemFunctionsGet GET /system/functions Get a list of deployed functions with: stats and image digest
DefaultApi systemFunctionsPost POST /system/functions Deploy a new function.
DefaultApi systemFunctionsPut PUT /system/functions Update a function.
DefaultApi systemInfoGet GET /system/info Get info such as provider version number and provider orchestrator
DefaultApi systemScaleFunctionFunctionNamePost POST /system/scale-function/{functionName} Scale a function

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

basicAuth

  • Type: HTTP basic authentication

Recommendation

It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issues.

Author

About

Serverless Functions Made Simple for Docker and Kubernetes - Java Client

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0