Class FunctionServiceClient (2.41.0)
Stay organized with collections
Save and categorize content based on your preferences.
- 2.80.0 (latest)
- 2.78.0
- 2.77.0
- 2.76.0
- 2.75.0
- 2.74.0
- 2.72.0
- 2.70.0
- 2.69.0
- 2.66.0
- 2.65.0
- 2.64.0
- 2.62.0
- 2.61.0
- 2.60.0
- 2.59.0
- 2.58.0
- 2.57.0
- 2.56.0
- 2.55.0
- 2.54.0
- 2.53.0
- 2.51.0
- 2.50.0
- 2.49.0
- 2.48.0
- 2.47.0
- 2.46.0
- 2.45.0
- 2.44.0
- 2.43.0
- 2.42.0
- 2.41.0
- 2.39.0
- 2.38.0
- 2.37.0
- 2.36.0
- 2.35.0
- 2.34.0
- 2.33.0
- 2.32.0
- 2.31.0
- 2.30.0
- 2.29.0
- 2.26.0
- 2.25.0
- 2.24.0
- 2.23.0
- 2.22.0
- 2.21.0
- 2.20.0
- 2.19.0
- 2.18.0
- 2.17.0
- 2.16.0
- 2.15.0
- 2.14.0
- 2.13.0
- 2.11.0
- 2.10.0
- 2.9.0
- 2.8.0
- 2.7.0
- 2.6.0
- 2.5.4
- 2.4.3
- 2.3.6
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(FunctionServiceClientfunctionServiceClient=FunctionServiceClient.create()){
FunctionNamename=FunctionName.of("[PROJECT]","[LOCATION]","[FUNCTION]");
Functionresponse=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().
| Method | Description | Method Variants |
|---|---|---|
GetFunction |
Returns a function with the given name from the requested project. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListFunctions |
Returns a list of functions that belong to the requested project. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreateFunction |
Creates a new function. If a function with the given name already exists in the specified project, the long running operation will return |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateFunction |
Updates existing function. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteFunction |
Deletes a function with the given name from the specified project. If the given function is used by some trigger, the trigger will be updated to remove this function. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GenerateUploadUrl |
Returns a signed URL for uploading a function source code. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls. Once the function source code upload is complete, the used signed URL should be provided in CreateFunction or UpdateFunction request as a reference to the function source code. When uploading source code to the generated signed URL, please follow these restrictions:
When making a HTTP PUT request, these two headers need to be specified:
And this header SHOULD NOT be specified:
|
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GenerateDownloadUrl |
Returns a signed URL for downloading deployed function source code. The URL is only valid for a limited period and should be used within 30 minutes of generation. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListRuntimes |
Returns a list of runtimes that are supported for the requested project. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListLocations |
Lists information about the supported locations for this service. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
SetIamPolicy |
Sets the access control policy on the specified resource. Replacesany existing policy. Can return |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetIamPolicy |
Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
TestIamPermissions |
Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return 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
FunctionServiceSettingsfunctionServiceSettings=
FunctionServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
FunctionServiceClientfunctionServiceClient=
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
FunctionServiceSettingsfunctionServiceSettings=
FunctionServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
FunctionServiceClientfunctionServiceClient=
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
FunctionServiceSettingsfunctionServiceSettings=
FunctionServiceSettings.newHttpJsonBuilder().build();
FunctionServiceClientfunctionServiceClient=
FunctionServiceClient.create(functionServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Static Methods
create()
publicstaticfinalFunctionServiceClientcreate()Constructs an instance of FunctionServiceClient with default settings.
| Returns | |
|---|---|
| Type | Description |
FunctionServiceClient |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
create(FunctionServiceSettings settings)
publicstaticfinalFunctionServiceClientcreate(FunctionServiceSettingssettings)Constructs an instance of FunctionServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
| Parameter | |
|---|---|
| Name | Description |
settings |
FunctionServiceSettings |
| Returns | |
|---|---|
| Type | Description |
FunctionServiceClient |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
create(FunctionServiceStub stub)
publicstaticfinalFunctionServiceClientcreate(FunctionServiceStubstub)Constructs an instance of FunctionServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(FunctionServiceSettings).
| Parameter | |
|---|---|
| Name | Description |
stub |
FunctionServiceStub |
| Returns | |
|---|---|
| Type | Description |
FunctionServiceClient |
|
Constructors
FunctionServiceClient(FunctionServiceSettings settings)
protectedFunctionServiceClient(FunctionServiceSettingssettings)Constructs an instance of FunctionServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
| Parameter | |
|---|---|
| Name | Description |
settings |
FunctionServiceSettings |
FunctionServiceClient(FunctionServiceStub stub)
protectedFunctionServiceClient(FunctionServiceStubstub)| Parameter | |
|---|---|
| Name | Description |
stub |
FunctionServiceStub |
Methods
awaitTermination(long duration, TimeUnit unit)
publicbooleanawaitTermination(longduration,TimeUnitunit)| Parameters | |
|---|---|
| Name | Description |
duration |
long |
unit |
TimeUnit |
| Returns | |
|---|---|
| Type | Description |
boolean |
|
| Exceptions | |
|---|---|
| Type | Description |
InterruptedException |
|
close()
publicfinalvoidclose()createFunctionAsync(CreateFunctionRequest request)
publicfinalOperationFuture<Function,OperationMetadata>createFunctionAsync(CreateFunctionRequestrequest)Creates a new function. If a function with the given name already exists in the specified
project, the long running operation will return ALREADY_EXISTS error.
Sample code:
// 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(FunctionServiceClientfunctionServiceClient=FunctionServiceClient.create()){
CreateFunctionRequestrequest=
CreateFunctionRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]","[LOCATION]").toString())
.setFunction(Function.newBuilder().build())
.setFunctionId("functionId-62789869")
.build();
Functionresponse=functionServiceClient.createFunctionAsync(request).get();
}
| Parameter | |
|---|---|
| Name | Description |
request |
CreateFunctionRequest The request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Function,OperationMetadata> |
|
createFunctionAsync(LocationName parent, Function function, String functionId)
publicfinalOperationFuture<Function,OperationMetadata>createFunctionAsync(LocationNameparent,Functionfunction,StringfunctionId)Creates a new function. If a function with the given name already exists in the specified
project, the long running operation will return ALREADY_EXISTS error.
Sample code:
// 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(FunctionServiceClientfunctionServiceClient=FunctionServiceClient.create()){
LocationNameparent=LocationName.of("[PROJECT]","[LOCATION]");
Functionfunction=Function.newBuilder().build();
StringfunctionId="functionId-62789869";
Functionresponse=
functionServiceClient.createFunctionAsync(parent,function,functionId).get();
}
| Parameters | |
|---|---|
| Name | Description |
parent |
LocationName Required. The project and location in which the function should be created,
specified in the format |
function |
Function Required. Function to be created. |
functionId |
String The ID to use for the function, which will become the final component of the function's resource name. This value should be 4-63 characters, and valid characters are /a-z-/. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Function,OperationMetadata> |
|
createFunctionAsync(String parent, Function function, String functionId)
publicfinalOperationFuture<Function,OperationMetadata>createFunctionAsync(Stringparent,Functionfunction,StringfunctionId)Creates a new function. If a function with the given name already exists in the specified
project, the long running operation will return ALREADY_EXISTS error.
Sample code:
// 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(FunctionServiceClientfunctionServiceClient=FunctionServiceClient.create()){
Stringparent=LocationName.of("[PROJECT]","[LOCATION]").toString();
Functionfunction=Function.newBuilder().build();
StringfunctionId="functionId-62789869";
Functionresponse=
functionServiceClient.createFunctionAsync(parent,function,functionId).get();
}
| Parameters | |
|---|---|
| Name | Description |
parent |
String Required. The project and location in which the function should be created,
specified in the format |
function |
Function Required. Function to be created. |
functionId |
String The ID to use for the function, which will become the final component of the function's resource name. This value should be 4-63 characters, and valid characters are /a-z-/. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Function,OperationMetadata> |
|
createFunctionCallable()
publicfinalUnaryCallable<CreateFunctionRequest,Operation>createFunctionCallable()Creates a new function. If a function with the given name already exists in the specified
project, the long running operation will return ALREADY_EXISTS error.
Sample code:
// 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(FunctionServiceClientfunctionServiceClient=FunctionServiceClient.create()){
CreateFunctionRequestrequest=
CreateFunctionRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]","[LOCATION]").toString())
.setFunction(Function.newBuilder().build())
.setFunctionId("functionId-62789869")
.build();
ApiFuture<Operation>future=
functionServiceClient.createFunctionCallable().futureCall(request);
// Do something.
Operationresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<CreateFunctionRequest,Operation> |
|
createFunctionOperationCallable()
publicfinalOperationCallable<CreateFunctionRequest,Function,OperationMetadata>createFunctionOperationCallable()Creates a new function. If a function with the given name already exists in the specified
project, the long running operation will return ALREADY_EXISTS error.
Sample code:
// 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(FunctionServiceClientfunctionServiceClient=FunctionServiceClient.create()){
CreateFunctionRequestrequest=
CreateFunctionRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]","[LOCATION]").toString())
.setFunction(Function.newBuilder().build())
.setFunctionId("functionId-62789869")
.build();
OperationFuture<Function,OperationMetadata>future=
functionServiceClient.createFunctionOperationCallable().futureCall(request);
// Do something.
Functionresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
OperationCallable<CreateFunctionRequest,Function,OperationMetadata> |
|
deleteFunctionAsync(DeleteFunctionRequest request)
publicfinalOperationFuture<Empty,OperationMetadata>deleteFunctionAsync(DeleteFunctionRequestrequest)Deletes a function with the given name from the specified project. If the given function is used by some trigger, the trigger will be updated to remove this function.
Sample code:
// 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(FunctionServiceClientfunctionServiceClient=FunctionServiceClient.create()){
DeleteFunctionRequestrequest=
DeleteFunctionRequest.newBuilder()
.setName(FunctionName.of("[PROJECT]","[LOCATION]","[FUNCTION]").toString())
.build();
functionServiceClient.deleteFunctionAsync(request).get();
}
| Parameter | |
|---|---|
| Name | Description |
request |
DeleteFunctionRequest The request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Empty,OperationMetadata> |
|
deleteFunctionAsync(FunctionName name)
publicfinalOperationFuture<Empty,OperationMetadata>deleteFunctionAsync(FunctionNamename)Deletes a function with the given name from the specified project. If the given function is used by some trigger, the trigger will be updated to remove this function.
Sample code:
// 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(FunctionServiceClientfunctionServiceClient=FunctionServiceClient.create()){
FunctionNamename=FunctionName.of("[PROJECT]","[LOCATION]","[FUNCTION]");
functionServiceClient.deleteFunctionAsync(name).get();
}
| Parameter | |
|---|---|
| Name | Description |
name |
FunctionName Required. The name of the function which should be deleted. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Empty,OperationMetadata> |
|
deleteFunctionAsync(String name)
publicfinalOperationFuture<Empty,OperationMetadata>deleteFunctionAsync(Stringname)Deletes a function with the given name from the specified project. If the given function is used by some trigger, the trigger will be updated to remove this function.
Sample code:
// 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(FunctionServiceClientfunctionServiceClient=FunctionServiceClient.create()){
Stringname=FunctionName.of("[PROJECT]","[LOCATION]","[FUNCTION]").toString();
functionServiceClient.deleteFunctionAsync(name).get();
}
| Parameter | |
|---|---|
| Name | Description |
name |
String Required. The name of the function which should be deleted. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Empty,OperationMetadata> |
|
deleteFunctionCallable()
publicfinalUnaryCallable<DeleteFunctionRequest,Operation>deleteFunctionCallable()Deletes a function with the given name from the specified project. If the given function is used by some trigger, the trigger will be updated to remove this function.
Sample code:
// 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(FunctionServiceClientfunctionServiceClient=FunctionServiceClient.create()){
DeleteFunctionRequestrequest=
DeleteFunctionRequest.newBuilder()
.setName(FunctionName.of("[PROJECT]","[LOCATION]","[FUNCTION]").toString())
.build();
ApiFuture<Operation>future=
functionServiceClient.deleteFunctionCallable().futureCall(request);
// Do something.
future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<DeleteFunctionRequest,Operation> |
|
deleteFunctionOperationCallable()
publicfinalOperationCallable<DeleteFunctionRequest,Empty,OperationMetadata>deleteFunctionOperationCallable()Deletes a function with the given name from the specified project. If the given function is used by some trigger, the trigger will be updated to remove this function.
Sample code:
// 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(FunctionServiceClientfunctionServiceClient=FunctionServiceClient.create()){
DeleteFunctionRequestrequest=
DeleteFunctionRequest.newBuilder()
.setName(FunctionName.of("[PROJECT]","[LOCATION]","[FUNCTION]").toString())
.build();
OperationFuture<Empty,OperationMetadata>future=
functionServiceClient.deleteFunctionOperationCallable().futureCall(request);
// Do something.
future.get();
}
| Returns | |
|---|---|
| Type | Description |
OperationCallable<DeleteFunctionRequest,Empty,OperationMetadata> |
|
generateDownloadUrl(GenerateDownloadUrlRequest request)
publicfinalGenerateDownloadUrlResponsegenerateDownloadUrl(GenerateDownloadUrlRequestrequest)Returns a signed URL for downloading deployed function source code. The URL is only valid for a limited period and should be used within 30 minutes of generation. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls
Sample code:
// 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(FunctionServiceClientfunctionServiceClient=FunctionServiceClient.create()){
GenerateDownloadUrlRequestrequest=
GenerateDownloadUrlRequest.newBuilder()
.setName(FunctionName.of("[PROJECT]","[LOCATION]","[FUNCTION]").toString())
.build();
GenerateDownloadUrlResponseresponse=functionServiceClient.generateDownloadUrl(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
GenerateDownloadUrlRequest The request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
GenerateDownloadUrlResponse |
|
generateDownloadUrlCallable()
publicfinalUnaryCallable<GenerateDownloadUrlRequest,GenerateDownloadUrlResponse>generateDownloadUrlCallable()Returns a signed URL for downloading deployed function source code. The URL is only valid for a limited period and should be used within 30 minutes of generation. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls
Sample code:
// 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(FunctionServiceClientfunctionServiceClient=FunctionServiceClient.create()){
GenerateDownloadUrlRequestrequest=
GenerateDownloadUrlRequest.newBuilder()
.setName(FunctionName.of("[PROJECT]","[LOCATION]","[FUNCTION]").toString())
.build();
ApiFuture<GenerateDownloadUrlResponse>future=
functionServiceClient.generateDownloadUrlCallable().futureCall(request);
// Do something.
GenerateDownloadUrlResponseresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<GenerateDownloadUrlRequest,GenerateDownloadUrlResponse> |
|
generateUploadUrl(GenerateUploadUrlRequest request)
publicfinalGenerateUploadUrlResponsegenerateUploadUrl(GenerateUploadUrlRequestrequest)Returns a signed URL for uploading a function source code. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls. Once the function source code upload is complete, the used signed URL should be provided in CreateFunction or UpdateFunction request as a reference to the function source code.
When uploading source code to the generated signed URL, please follow these restrictions:
- Source file type should be a zip file.
- No credentials should be attached - the signed URLs provide access to the target bucket using internal service identity; if credentials were attached, the identity from the credentials would be used, but that identity does not have permissions to upload files to the URL.
When making a HTTP PUT request, these two headers need to be specified:
content-type: application/zip
And this header SHOULD NOT be specified:
Authorization: Bearer YOUR_TOKEN
Sample code:
// 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(FunctionServiceClientfunctionServiceClient=FunctionServiceClient.create()){
GenerateUploadUrlRequestrequest=
GenerateUploadUrlRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]","[LOCATION]").toString())
.setKmsKeyName(
CryptoKeyName.of("[PROJECT]","[LOCATION]","[KEY_RING]","[CRYPTO_KEY]")
.toString())
.build();
GenerateUploadUrlResponseresponse=functionServiceClient.generateUploadUrl(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
GenerateUploadUrlRequest The request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
GenerateUploadUrlResponse |
|
generateUploadUrlCallable()
publicfinalUnaryCallable<GenerateUploadUrlRequest,GenerateUploadUrlResponse>generateUploadUrlCallable()Returns a signed URL for uploading a function source code. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls. Once the function source code upload is complete, the used signed URL should be provided in CreateFunction or UpdateFunction request as a reference to the function source code.
When uploading source code to the generated signed URL, please follow these restrictions:
- Source file type should be a zip file.
- No credentials should be attached - the signed URLs provide access to the target bucket using internal service identity; if credentials were attached, the identity from the credentials would be used, but that identity does not have permissions to upload files to the URL.
When making a HTTP PUT request, these two headers need to be specified:
content-type: application/zip
And this header SHOULD NOT be specified:
Authorization: Bearer YOUR_TOKEN
Sample code:
// 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(FunctionServiceClientfunctionServiceClient=FunctionServiceClient.create()){
GenerateUploadUrlRequestrequest=
GenerateUploadUrlRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]","[LOCATION]").toString())
.setKmsKeyName(
CryptoKeyName.of("[PROJECT]","[LOCATION]","[KEY_RING]","[CRYPTO_KEY]")
.toString())
.build();
ApiFuture<GenerateUploadUrlResponse>future=
functionServiceClient.generateUploadUrlCallable().futureCall(request);
// Do something.
GenerateUploadUrlResponseresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<GenerateUploadUrlRequest,GenerateUploadUrlResponse> |
|
getFunction(FunctionName name)
publicfinalFunctiongetFunction(FunctionNamename)Returns a function with the given name from the requested project.
Sample code:
// 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(FunctionServiceClientfunctionServiceClient=FunctionServiceClient.create()){
FunctionNamename=FunctionName.of("[PROJECT]","[LOCATION]","[FUNCTION]");
Functionresponse=functionServiceClient.getFunction(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
FunctionName Required. The name of the function which details should be obtained. |
| Returns | |
|---|---|
| Type | Description |
Function |
|
getFunction(GetFunctionRequest request)
publicfinalFunctiongetFunction(GetFunctionRequestrequest)Returns a function with the given name from the requested project.
Sample code:
// 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(FunctionServiceClientfunctionServiceClient=FunctionServiceClient.create()){
GetFunctionRequestrequest=
GetFunctionRequest.newBuilder()
.setName(FunctionName.of("[PROJECT]","[LOCATION]","[FUNCTION]").toString())
.build();
Functionresponse=functionServiceClient.getFunction(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
GetFunctionRequest The request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
Function |
|
getFunction(String name)
publicfinalFunctiongetFunction(Stringname)Returns a function with the given name from the requested project.
Sample code:
// 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(FunctionServiceClientfunctionServiceClient=FunctionServiceClient.create()){
Stringname=FunctionName.of("[PROJECT]","[LOCATION]","[FUNCTION]").toString();
Functionresponse=functionServiceClient.getFunction(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
String Required. The name of the function which details should be obtained. |
| Returns | |
|---|---|
| Type | Description |
Function |
|
getFunctionCallable()
publicfinalUnaryCallable<GetFunctionRequest,Function>getFunctionCallable()Returns a function with the given name from the requested project.
Sample code:
// 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(FunctionServiceClientfunctionServiceClient=FunctionServiceClient.create()){
GetFunctionRequestrequest=
GetFunctionRequest.newBuilder()
.setName(FunctionName.of("[PROJECT]","[LOCATION]","[FUNCTION]").toString())
.build();
ApiFuture<Function>future=functionServiceClient.getFunctionCallable().futureCall(request);
// Do something.
Functionresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<GetFunctionRequest,Function> |
|
getHttpJsonOperationsClient()
publicfinalOperationsClientgetHttpJsonOperationsClient()Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
| Returns | |
|---|---|
| Type | Description |
OperationsClient |
|
getIamPolicy(GetIamPolicyRequest request)
publicfinalPolicygetIamPolicy(GetIamPolicyRequestrequest)Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set.
Sample code:
// 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(FunctionServiceClientfunctionServiceClient=FunctionServiceClient.create()){
GetIamPolicyRequestrequest=
GetIamPolicyRequest.newBuilder()
.setResource(FunctionName.of("[PROJECT]","[LOCATION]","[FUNCTION]").toString())
.setOptions(GetPolicyOptions.newBuilder().build())
.build();
Policyresponse=functionServiceClient.getIamPolicy(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
com.google.iam.v1.GetIamPolicyRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
com.google.iam.v1.Policy |
|
getIamPolicyCallable()
publicfinalUnaryCallable<GetIamPolicyRequest,Policy>getIamPolicyCallable()Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set.
Sample code:
// 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(FunctionServiceClientfunctionServiceClient=FunctionServiceClient.create()){
GetIamPolicyRequestrequest=
GetIamPolicyRequest.newBuilder()
.setResource(FunctionName.of("[PROJECT]","[LOCATION]","[FUNCTION]").toString())
.setOptions(GetPolicyOptions.newBuilder().build())
.build();
ApiFuture<Policy>future=functionServiceClient.getIamPolicyCallable().futureCall(request);
// Do something.
Policyresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> |
|
getOperationsClient()
publicfinalOperationsClientgetOperationsClient()Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
| Returns | |
|---|---|
| Type | Description |
OperationsClient |
|
getSettings()
publicfinalFunctionServiceSettingsgetSettings()| Returns | |
|---|---|
| Type | Description |
FunctionServiceSettings |
|
getStub()
publicFunctionServiceStubgetStub()| Returns | |
|---|---|
| Type | Description |
FunctionServiceStub |
|
isShutdown()
publicbooleanisShutdown()| Returns | |
|---|---|
| Type | Description |
boolean |
|
isTerminated()
publicbooleanisTerminated()| Returns | |
|---|---|
| Type | Description |
boolean |
|
listFunctions(ListFunctionsRequest request)
publicfinalFunctionServiceClient.ListFunctionsPagedResponselistFunctions(ListFunctionsRequestrequest)Returns a list of functions that belong to the requested project.
Sample code:
// 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(FunctionServiceClientfunctionServiceClient=FunctionServiceClient.create()){
ListFunctionsRequestrequest=
ListFunctionsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]","[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.build();
for(Functionelement:functionServiceClient.listFunctions(request).iterateAll()){
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
request |
ListFunctionsRequest The request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
FunctionServiceClient.ListFunctionsPagedResponse |
|
listFunctions(LocationName parent)
publicfinalFunctionServiceClient.ListFunctionsPagedResponselistFunctions(LocationNameparent)Returns a list of functions that belong to the requested project.
Sample code:
// 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(FunctionServiceClientfunctionServiceClient=FunctionServiceClient.create()){
LocationNameparent=LocationName.of("[PROJECT]","[LOCATION]");
for(Functionelement:functionServiceClient.listFunctions(parent).iterateAll()){
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
LocationName Required. The project and location from which the function should be listed,
specified in the format |
| Returns | |
|---|---|
| Type | Description |
FunctionServiceClient.ListFunctionsPagedResponse |
|
listFunctions(String parent)
publicfinalFunctionServiceClient.ListFunctionsPagedResponselistFunctions(Stringparent)Returns a list of functions that belong to the requested project.
Sample code:
// 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(FunctionServiceClientfunctionServiceClient=FunctionServiceClient.create()){
Stringparent=LocationName.of("[PROJECT]","[LOCATION]").toString();
for(Functionelement:functionServiceClient.listFunctions(parent).iterateAll()){
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
String Required. The project and location from which the function should be listed,
specified in the format |
| Returns | |
|---|---|
| Type | Description |
FunctionServiceClient.ListFunctionsPagedResponse |
|
listFunctionsCallable()
publicfinalUnaryCallable<ListFunctionsRequest,ListFunctionsResponse>listFunctionsCallable()Returns a list of functions that belong to the requested project.
Sample code:
// 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(FunctionServiceClientfunctionServiceClient=FunctionServiceClient.create()){
ListFunctionsRequestrequest=
ListFunctionsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]","[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.build();
while(true){
ListFunctionsResponseresponse=
functionServiceClient.listFunctionsCallable().call(request);
for(Functionelement:response.getFunctionsList()){
// doThingsWith(element);
}
StringnextPageToken=response.getNextPageToken();
if(!Strings.isNullOrEmpty(nextPageToken)){
request=request.toBuilder().setPageToken(nextPageToken).build();
}else{
break;
}
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListFunctionsRequest,ListFunctionsResponse> |
|
listFunctionsPagedCallable()
publicfinalUnaryCallable<ListFunctionsRequest,FunctionServiceClient.ListFunctionsPagedResponse>listFunctionsPagedCallable()Returns a list of functions that belong to the requested project.
Sample code:
// 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(FunctionServiceClientfunctionServiceClient=FunctionServiceClient.create()){
ListFunctionsRequestrequest=
ListFunctionsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]","[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.build();
ApiFuture<Function>future=
functionServiceClient.listFunctionsPagedCallable().futureCall(request);
// Do something.
for(Functionelement:future.get().iterateAll()){
// doThingsWith(element);
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListFunctionsRequest,ListFunctionsPagedResponse> |
|
listLocations(ListLocationsRequest request)
publicfinalFunctionServiceClient.ListLocationsPagedResponselistLocations(ListLocationsRequestrequest)Lists information about the supported locations for this service.
Sample code:
// 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(FunctionServiceClientfunctionServiceClient=FunctionServiceClient.create()){
ListLocationsRequestrequest=
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for(Locationelement:functionServiceClient.listLocations(request).iterateAll()){
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
request |
com.google.cloud.location.ListLocationsRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
FunctionServiceClient.ListLocationsPagedResponse |
|
listLocationsCallable()
publicfinalUnaryCallable<ListLocationsRequest,ListLocationsResponse>listLocationsCallable()Lists information about the supported locations for this service.
Sample code:
// 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(FunctionServiceClientfunctionServiceClient=FunctionServiceClient.create()){
ListLocationsRequestrequest=
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while(true){
ListLocationsResponseresponse=
functionServiceClient.listLocationsCallable().call(request);
for(Locationelement:response.getLocationsList()){
// doThingsWith(element);
}
StringnextPageToken=response.getNextPageToken();
if(!Strings.isNullOrEmpty(nextPageToken)){
request=request.toBuilder().setPageToken(nextPageToken).build();
}else{
break;
}
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> |
|
listLocationsPagedCallable()
publicfinalUnaryCallable<ListLocationsRequest,FunctionServiceClient.ListLocationsPagedResponse>listLocationsPagedCallable()Lists information about the supported locations for this service.
Sample code:
// 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(FunctionServiceClientfunctionServiceClient=FunctionServiceClient.create()){
ListLocationsRequestrequest=
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Location>future=
functionServiceClient.listLocationsPagedCallable().futureCall(request);
// Do something.
for(Locationelement:future.get().iterateAll()){
// doThingsWith(element);
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<com.google.cloud.location.ListLocationsRequest,ListLocationsPagedResponse> |
|
listRuntimes(ListRuntimesRequest request)
publicfinalListRuntimesResponselistRuntimes(ListRuntimesRequestrequest)Returns a list of runtimes that are supported for the requested project.
Sample code:
// 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(FunctionServiceClientfunctionServiceClient=FunctionServiceClient.create()){
ListRuntimesRequestrequest=
ListRuntimesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]","[LOCATION]").toString())
.setFilter("filter-1274492040")
.build();
ListRuntimesResponseresponse=functionServiceClient.listRuntimes(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
ListRuntimesRequest The request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
ListRuntimesResponse |
|
listRuntimes(LocationName parent)
publicfinalListRuntimesResponselistRuntimes(LocationNameparent)Returns a list of runtimes that are supported for the requested project.
Sample code:
// 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(FunctionServiceClientfunctionServiceClient=FunctionServiceClient.create()){
LocationNameparent=LocationName.of("[PROJECT]","[LOCATION]");
ListRuntimesResponseresponse=functionServiceClient.listRuntimes(parent);
}
| Parameter | |
|---|---|
| Name | Description |
parent |
LocationName Required. The project and location from which the runtimes should be listed,
specified in the format |
| Returns | |
|---|---|
| Type | Description |
ListRuntimesResponse |
|
listRuntimes(String parent)
publicfinalListRuntimesResponselistRuntimes(Stringparent)Returns a list of runtimes that are supported for the requested project.
Sample code:
// 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(FunctionServiceClientfunctionServiceClient=FunctionServiceClient.create()){
Stringparent=LocationName.of("[PROJECT]","[LOCATION]").toString();
ListRuntimesResponseresponse=functionServiceClient.listRuntimes(parent);
}
| Parameter | |
|---|---|
| Name | Description |
parent |
String Required. The project and location from which the runtimes should be listed,
specified in the format |
| Returns | |
|---|---|
| Type | Description |
ListRuntimesResponse |
|
listRuntimesCallable()
publicfinalUnaryCallable<ListRuntimesRequest,ListRuntimesResponse>listRuntimesCallable()Returns a list of runtimes that are supported for the requested project.
Sample code:
// 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(FunctionServiceClientfunctionServiceClient=FunctionServiceClient.create()){
ListRuntimesRequestrequest=
ListRuntimesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]","[LOCATION]").toString())
.setFilter("filter-1274492040")
.build();
ApiFuture<ListRuntimesResponse>future=
functionServiceClient.listRuntimesCallable().futureCall(request);
// Do something.
ListRuntimesResponseresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListRuntimesRequest,ListRuntimesResponse> |
|
setIamPolicy(SetIamPolicyRequest request)
publicfinalPolicysetIamPolicy(SetIamPolicyRequestrequest)Sets the access control policy on the specified resource. Replacesany existing policy.
Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIEDerrors.
Sample code:
// 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(FunctionServiceClientfunctionServiceClient=FunctionServiceClient.create()){
SetIamPolicyRequestrequest=
SetIamPolicyRequest.newBuilder()
.setResource(FunctionName.of("[PROJECT]","[LOCATION]","[FUNCTION]").toString())
.setPolicy(Policy.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Policyresponse=functionServiceClient.setIamPolicy(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
com.google.iam.v1.SetIamPolicyRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
com.google.iam.v1.Policy |
|
setIamPolicyCallable()
publicfinalUnaryCallable<SetIamPolicyRequest,Policy>setIamPolicyCallable()Sets the access control policy on the specified resource. Replacesany existing policy.
Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIEDerrors.
Sample code:
// 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(FunctionServiceClientfunctionServiceClient=FunctionServiceClient.create()){
SetIamPolicyRequestrequest=
SetIamPolicyRequest.newBuilder()
.setResource(FunctionName.of("[PROJECT]","[LOCATION]","[FUNCTION]").toString())
.setPolicy(Policy.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Policy>future=functionServiceClient.setIamPolicyCallable().futureCall(request);
// Do something.
Policyresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> |
|
shutdown()
publicvoidshutdown()shutdownNow()
publicvoidshutdownNow()testIamPermissions(TestIamPermissionsRequest request)
publicfinalTestIamPermissionsResponsetestIamPermissions(TestIamPermissionsRequestrequest)Returns permissions that a caller has on the specified resource. If theresource does not exist,
this will return an empty set ofpermissions, not a NOT_FOUND error.
Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.
Sample code:
// 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(FunctionServiceClientfunctionServiceClient=FunctionServiceClient.create()){
TestIamPermissionsRequestrequest=
TestIamPermissionsRequest.newBuilder()
.setResource(FunctionName.of("[PROJECT]","[LOCATION]","[FUNCTION]").toString())
.addAllPermissions(newArrayList<String>())
.build();
TestIamPermissionsResponseresponse=functionServiceClient.testIamPermissions(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
com.google.iam.v1.TestIamPermissionsRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
com.google.iam.v1.TestIamPermissionsResponse |
|
testIamPermissionsCallable()
publicfinalUnaryCallable<TestIamPermissionsRequest,TestIamPermissionsResponse>testIamPermissionsCallable()Returns permissions that a caller has on the specified resource. If theresource does not exist,
this will return an empty set ofpermissions, not a NOT_FOUND error.
Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.
Sample code:
// 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(FunctionServiceClientfunctionServiceClient=FunctionServiceClient.create()){
TestIamPermissionsRequestrequest=
TestIamPermissionsRequest.newBuilder()
.setResource(FunctionName.of("[PROJECT]","[LOCATION]","[FUNCTION]").toString())
.addAllPermissions(newArrayList<String>())
.build();
ApiFuture<TestIamPermissionsResponse>future=
functionServiceClient.testIamPermissionsCallable().futureCall(request);
// Do something.
TestIamPermissionsResponseresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse> |
|
updateFunctionAsync(Function function, FieldMask updateMask)
publicfinalOperationFuture<Function,OperationMetadata>updateFunctionAsync(Functionfunction,FieldMaskupdateMask)Updates existing function.
Sample code:
// 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(FunctionServiceClientfunctionServiceClient=FunctionServiceClient.create()){
Functionfunction=Function.newBuilder().build();
FieldMaskupdateMask=FieldMask.newBuilder().build();
Functionresponse=functionServiceClient.updateFunctionAsync(function,updateMask).get();
}
| Parameters | |
|---|---|
| Name | Description |
function |
Function Required. New version of the function. |
updateMask |
FieldMask The list of fields to be updated. If no field mask is provided, all provided fields in the request will be updated. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Function,OperationMetadata> |
|
updateFunctionAsync(UpdateFunctionRequest request)
publicfinalOperationFuture<Function,OperationMetadata>updateFunctionAsync(UpdateFunctionRequestrequest)Updates existing function.
Sample code:
// 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(FunctionServiceClientfunctionServiceClient=FunctionServiceClient.create()){
UpdateFunctionRequestrequest=
UpdateFunctionRequest.newBuilder()
.setFunction(Function.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Functionresponse=functionServiceClient.updateFunctionAsync(request).get();
}
| Parameter | |
|---|---|
| Name | Description |
request |
UpdateFunctionRequest The request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Function,OperationMetadata> |
|
updateFunctionCallable()
publicfinalUnaryCallable<UpdateFunctionRequest,Operation>updateFunctionCallable()Updates existing function.
Sample code:
// 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(FunctionServiceClientfunctionServiceClient=FunctionServiceClient.create()){
UpdateFunctionRequestrequest=
UpdateFunctionRequest.newBuilder()
.setFunction(Function.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Operation>future=
functionServiceClient.updateFunctionCallable().futureCall(request);
// Do something.
Operationresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<UpdateFunctionRequest,Operation> |
|
updateFunctionOperationCallable()
publicfinalOperationCallable<UpdateFunctionRequest,Function,OperationMetadata>updateFunctionOperationCallable()Updates existing function.
Sample code:
// 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(FunctionServiceClientfunctionServiceClient=FunctionServiceClient.create()){
UpdateFunctionRequestrequest=
UpdateFunctionRequest.newBuilder()
.setFunction(Function.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
OperationFuture<Function,OperationMetadata>future=
functionServiceClient.updateFunctionOperationCallable().futureCall(request);
// Do something.
Functionresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
OperationCallable<UpdateFunctionRequest,Function,OperationMetadata> |
|