Package com.google.cloud.functions.v2 (2.7.0)

A client to Cloud Functions API

The interfaces provided are listed below, along with usage samples.

FunctionServiceClient

Service Description: Google Cloud Functions is used to deploy functions that are executed by Google in response to various events. Data connected with that event is passed to a function as the input data.

A **function** is a resource which describes a function that should be executed and how it is triggered.

Sample for FunctionServiceClient:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
   FunctionName name = FunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]");
   Function response = functionServiceClient.getFunction(name);
 }
 

Classes

BuildConfig

Describes the Build step of the function that builds a container from the given source.

Protobuf type google.cloud.functions.v2.BuildConfig

BuildConfig.Builder

Describes the Build step of the function that builds a container from the given source.

Protobuf type google.cloud.functions.v2.BuildConfig

CreateFunctionRequest

Request for the CreateFunction method.

Protobuf type google.cloud.functions.v2.CreateFunctionRequest

CreateFunctionRequest.Builder

Request for the CreateFunction method.

Protobuf type google.cloud.functions.v2.CreateFunctionRequest

DeleteFunctionRequest

Request for the DeleteFunction method.

Protobuf type google.cloud.functions.v2.DeleteFunctionRequest

DeleteFunctionRequest.Builder

Request for the DeleteFunction method.

Protobuf type google.cloud.functions.v2.DeleteFunctionRequest

EventFilter

Filters events based on exact matches on the CloudEvents attributes.

Protobuf type google.cloud.functions.v2.EventFilter

EventFilter.Builder

Filters events based on exact matches on the CloudEvents attributes.

Protobuf type google.cloud.functions.v2.EventFilter

EventTrigger

Describes EventTrigger, used to request events to be sent from another service.

Protobuf type google.cloud.functions.v2.EventTrigger

EventTrigger.Builder

Describes EventTrigger, used to request events to be sent from another service.

Protobuf type google.cloud.functions.v2.EventTrigger

Function

Describes a Cloud Function that contains user computation executed in response to an event. It encapsulates function and trigger configurations.

Protobuf type google.cloud.functions.v2.Function

Function.Builder

Describes a Cloud Function that contains user computation executed in response to an event. It encapsulates function and trigger configurations.

Protobuf type google.cloud.functions.v2.Function

FunctionName

FunctionName.Builder

Builder for projects/{project}/locations/{location}/functions/{function}.

FunctionServiceClient

Service Description: Google Cloud Functions is used to deploy functions that are executed by Google in response to various events. Data connected with that event is passed to a function as the input data.

A **function** is a resource which describes a function that should be executed and how it is triggered.

This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
   FunctionName name = FunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]");
   Function response = functionServiceClient.getFunction(name);
 }
 

Note: close() needs to be called on the FunctionServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

The surface of this class includes several types of Java methods for each of the API's methods:

  1. A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
  2. A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
  3. A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.

See the individual methods for example code.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of FunctionServiceSettings to create(). For example:

To customize credentials:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 FunctionServiceSettings functionServiceSettings =
     FunctionServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 FunctionServiceClient functionServiceClient =
     FunctionServiceClient.create(functionServiceSettings);
 

To customize the endpoint:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 FunctionServiceSettings functionServiceSettings =
     FunctionServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 FunctionServiceClient functionServiceClient =
     FunctionServiceClient.create(functionServiceSettings);
 

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 FunctionServiceSettings functionServiceSettings =
     FunctionServiceSettings.newBuilder()
         .setTransportChannelProvider(
             FunctionServiceSettings.defaultHttpJsonTransportProviderBuilder().build())
         .build();
 FunctionServiceClient functionServiceClient =
     FunctionServiceClient.create(functionServiceSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

FunctionServiceClient.ListFunctionsFixedSizeCollection

FunctionServiceClient.ListFunctionsPage

FunctionServiceClient.ListFunctionsPagedResponse

FunctionServiceClient.ListLocationsFixedSizeCollection

FunctionServiceClient.ListLocationsPage

FunctionServiceClient.ListLocationsPagedResponse

FunctionServiceGrpc

Google Cloud Functions is used to deploy functions that are executed by Google in response to various events. Data connected with that event is passed to a function as the input data. A function is a resource which describes a function that should be executed and how it is triggered.

FunctionServiceGrpc.FunctionServiceBlockingStub

Google Cloud Functions is used to deploy functions that are executed by Google in response to various events. Data connected with that event is passed to a function as the input data. A function is a resource which describes a function that should be executed and how it is triggered.

FunctionServiceGrpc.FunctionServiceFutureStub

Google Cloud Functions is used to deploy functions that are executed by Google in response to various events. Data connected with that event is passed to a function as the input data. A function is a resource which describes a function that should be executed and how it is triggered.

FunctionServiceGrpc.FunctionServiceImplBase

Google Cloud Functions is used to deploy functions that are executed by Google in response to various events. Data connected with that event is passed to a function as the input data. A function is a resource which describes a function that should be executed and how it is triggered.

FunctionServiceGrpc.FunctionServiceStub

Google Cloud Functions is used to deploy functions that are executed by Google in response to various events. Data connected with that event is passed to a function as the input data. A function is a resource which describes a function that should be executed and how it is triggered.

FunctionServiceSettings

Settings class to configure an instance of FunctionServiceClient.

The default instance has everything set to sensible defaults:

  • The default service address (cloudfunctions.googleapis.com) and default port (443) are used.
  • Credentials are acquired automatically through Application Default Credentials.
  • Retries are configured for idempotent methods but not for non-idempotent methods.

The builder of this class is recursive, so contained classes are themselves builders. When build() is called, the tree of builders is called to create the complete settings object.

For example, to set the total timeout of getFunction to 30 seconds:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 FunctionServiceSettings.Builder functionServiceSettingsBuilder =
     FunctionServiceSettings.newBuilder();
 functionServiceSettingsBuilder
     .getFunctionSettings()
     .setRetrySettings(
         functionServiceSettingsBuilder.getFunctionSettings().getRetrySettings().toBuilder()
             .setTotalTimeout(Duration.ofSeconds(30))
             .build());
 FunctionServiceSettings functionServiceSettings = functionServiceSettingsBuilder.build();
 

FunctionServiceSettings.Builder

Builder for FunctionServiceSettings.

FunctionsProto

GenerateDownloadUrlRequest

Request of GenerateDownloadUrl method.

Protobuf type google.cloud.functions.v2.GenerateDownloadUrlRequest

GenerateDownloadUrlRequest.Builder

Request of GenerateDownloadUrl method.

Protobuf type google.cloud.functions.v2.GenerateDownloadUrlRequest

GenerateDownloadUrlResponse

Response of GenerateDownloadUrl method.

Protobuf type google.cloud.functions.v2.GenerateDownloadUrlResponse

GenerateDownloadUrlResponse.Builder

Response of GenerateDownloadUrl method.

Protobuf type google.cloud.functions.v2.GenerateDownloadUrlResponse

GenerateUploadUrlRequest

Request of GenerateSourceUploadUrl method.

Protobuf type google.cloud.functions.v2.GenerateUploadUrlRequest

GenerateUploadUrlRequest.Builder

Request of GenerateSourceUploadUrl method.

Protobuf type google.cloud.functions.v2.GenerateUploadUrlRequest

GenerateUploadUrlResponse

Response of GenerateSourceUploadUrl method.

Protobuf type google.cloud.functions.v2.GenerateUploadUrlResponse

GenerateUploadUrlResponse.Builder

Response of GenerateSourceUploadUrl method.

Protobuf type google.cloud.functions.v2.GenerateUploadUrlResponse

GetFunctionRequest

Request for the GetFunction method.

Protobuf type google.cloud.functions.v2.GetFunctionRequest

GetFunctionRequest.Builder

Request for the GetFunction method.

Protobuf type google.cloud.functions.v2.GetFunctionRequest

ListFunctionsRequest

Request for the ListFunctions method.

Protobuf type google.cloud.functions.v2.ListFunctionsRequest

ListFunctionsRequest.Builder

Request for the ListFunctions method.

Protobuf type google.cloud.functions.v2.ListFunctionsRequest

ListFunctionsResponse

Response for the ListFunctions method.

Protobuf type google.cloud.functions.v2.ListFunctionsResponse

ListFunctionsResponse.Builder

Response for the ListFunctions method.

Protobuf type google.cloud.functions.v2.ListFunctionsResponse

ListRuntimesRequest

Request for the ListRuntimes method.

Protobuf type google.cloud.functions.v2.ListRuntimesRequest

ListRuntimesRequest.Builder

Request for the ListRuntimes method.

Protobuf type google.cloud.functions.v2.ListRuntimesRequest

ListRuntimesResponse

Response for the ListRuntimes method.

Protobuf type google.cloud.functions.v2.ListRuntimesResponse

ListRuntimesResponse.Builder

Response for the ListRuntimes method.

Protobuf type google.cloud.functions.v2.ListRuntimesResponse

ListRuntimesResponse.Runtime

Describes a runtime and any special information (e.g., deprecation status) related to it.

Protobuf type google.cloud.functions.v2.ListRuntimesResponse.Runtime

ListRuntimesResponse.Runtime.Builder

Describes a runtime and any special information (e.g., deprecation status) related to it.

Protobuf type google.cloud.functions.v2.ListRuntimesResponse.Runtime

LocationName

LocationName.Builder

Builder for projects/{project}/locations/{location}.

OperationMetadata

Represents the metadata of the long-running operation.

Protobuf type google.cloud.functions.v2.OperationMetadata

OperationMetadata.Builder

Represents the metadata of the long-running operation.

Protobuf type google.cloud.functions.v2.OperationMetadata

RepoSource

Location of the source in a Google Cloud Source Repository.

Protobuf type google.cloud.functions.v2.RepoSource

RepoSource.Builder

Location of the source in a Google Cloud Source Repository.

Protobuf type google.cloud.functions.v2.RepoSource

SecretEnvVar

Configuration for a secret environment variable. It has the information necessary to fetch the secret value from secret manager and expose it as an environment variable.

Protobuf type google.cloud.functions.v2.SecretEnvVar

SecretEnvVar.Builder

Configuration for a secret environment variable. It has the information necessary to fetch the secret value from secret manager and expose it as an environment variable.

Protobuf type google.cloud.functions.v2.SecretEnvVar

SecretVolume

Configuration for a secret volume. It has the information necessary to fetch the secret value from secret manager and make it available as files mounted at the requested paths within the application container.

Protobuf type google.cloud.functions.v2.SecretVolume

SecretVolume.Builder

Configuration for a secret volume. It has the information necessary to fetch the secret value from secret manager and make it available as files mounted at the requested paths within the application container.

Protobuf type google.cloud.functions.v2.SecretVolume

SecretVolume.SecretVersion

Configuration for a single version.

Protobuf type google.cloud.functions.v2.SecretVolume.SecretVersion

SecretVolume.SecretVersion.Builder

Configuration for a single version.

Protobuf type google.cloud.functions.v2.SecretVolume.SecretVersion

ServiceConfig

Describes the Service being deployed. Currently Supported : Cloud Run (fully managed).

Protobuf type google.cloud.functions.v2.ServiceConfig

ServiceConfig.Builder

Describes the Service being deployed. Currently Supported : Cloud Run (fully managed).

Protobuf type google.cloud.functions.v2.ServiceConfig

Source

The location of the function source code.

Protobuf type google.cloud.functions.v2.Source

Source.Builder

The location of the function source code.

Protobuf type google.cloud.functions.v2.Source

SourceProvenance

Provenance of the source. Ways to find the original source, or verify that some source was used for this build.

Protobuf type google.cloud.functions.v2.SourceProvenance

SourceProvenance.Builder

Provenance of the source. Ways to find the original source, or verify that some source was used for this build.

Protobuf type google.cloud.functions.v2.SourceProvenance

Stage

Each Stage of the deployment process

Protobuf type google.cloud.functions.v2.Stage

Stage.Builder

Each Stage of the deployment process

Protobuf type google.cloud.functions.v2.Stage

StateMessage

Informational messages about the state of the Cloud Function or Operation.

Protobuf type google.cloud.functions.v2.StateMessage

StateMessage.Builder

Informational messages about the state of the Cloud Function or Operation.

Protobuf type google.cloud.functions.v2.StateMessage

StorageSource

Location of the source in an archive file in Google Cloud Storage.

Protobuf type google.cloud.functions.v2.StorageSource

StorageSource.Builder

Location of the source in an archive file in Google Cloud Storage.

Protobuf type google.cloud.functions.v2.StorageSource

UpdateFunctionRequest

Request for the UpdateFunction method.

Protobuf type google.cloud.functions.v2.UpdateFunctionRequest

UpdateFunctionRequest.Builder

Request for the UpdateFunction method.

Protobuf type google.cloud.functions.v2.UpdateFunctionRequest

Interfaces

BuildConfigOrBuilder

CreateFunctionRequestOrBuilder

DeleteFunctionRequestOrBuilder

EventFilterOrBuilder

EventTriggerOrBuilder

FunctionOrBuilder

GenerateDownloadUrlRequestOrBuilder

GenerateDownloadUrlResponseOrBuilder

GenerateUploadUrlRequestOrBuilder

GenerateUploadUrlResponseOrBuilder

GetFunctionRequestOrBuilder

ListFunctionsRequestOrBuilder

ListFunctionsResponseOrBuilder

ListRuntimesRequestOrBuilder

ListRuntimesResponse.RuntimeOrBuilder

ListRuntimesResponseOrBuilder

OperationMetadataOrBuilder

RepoSourceOrBuilder

SecretEnvVarOrBuilder

SecretVolume.SecretVersionOrBuilder

SecretVolumeOrBuilder

ServiceConfigOrBuilder

SourceOrBuilder

SourceProvenanceOrBuilder

StageOrBuilder

StateMessageOrBuilder

StorageSourceOrBuilder

UpdateFunctionRequestOrBuilder

Enums

Environment

The environment the function is hosted on.

Protobuf enum google.cloud.functions.v2.Environment

EventTrigger.RetryPolicy

Describes the retry policy in case of function's execution failure. Retried execution is charged as any other execution.

Protobuf enum google.cloud.functions.v2.EventTrigger.RetryPolicy

Function.State

Describes the current state of the function.

Protobuf enum google.cloud.functions.v2.Function.State

ListRuntimesResponse.RuntimeStage

The various stages that a runtime can be in.

Protobuf enum google.cloud.functions.v2.ListRuntimesResponse.RuntimeStage

RepoSource.RevisionCase

ServiceConfig.IngressSettings

Available ingress settings. This controls what traffic can reach the function. If unspecified, ALLOW_ALL will be used.

Protobuf enum google.cloud.functions.v2.ServiceConfig.IngressSettings

ServiceConfig.VpcConnectorEgressSettings

Available egress settings. This controls what traffic is diverted through the VPC Access Connector resource. By default PRIVATE_RANGES_ONLY will be used.

Protobuf enum google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings

Source.SourceCase

Stage.Name

Possible names for a Stage

Protobuf enum google.cloud.functions.v2.Stage.Name

Stage.State

Possible states for a Stage

Protobuf enum google.cloud.functions.v2.Stage.State

StateMessage.Severity

Severity of the state message.

Protobuf enum google.cloud.functions.v2.StateMessage.Severity