- 2.55.0 (latest)
- 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
public class CloudFunctionsServiceClient implements BackgroundResource
Service Description: A service that application uses to manipulate triggers and functions.
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:
try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
CloudFunctionName name = CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]");
CloudFunction response = cloudFunctionsServiceClient.getFunction(name);
}
Note: close() needs to be called on the CloudFunctionsServiceClient 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:
- 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.
- 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.
- 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 CloudFunctionsServiceSettings to create(). For example:
To customize credentials:
CloudFunctionsServiceSettings cloudFunctionsServiceSettings =
CloudFunctionsServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create(cloudFunctionsServiceSettings);
To customize the endpoint:
CloudFunctionsServiceSettings cloudFunctionsServiceSettings =
CloudFunctionsServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create(cloudFunctionsServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Implements
BackgroundResourceStatic Methods
create()
public static final CloudFunctionsServiceClient create()
Constructs an instance of CloudFunctionsServiceClient with default settings.
Type | Description |
CloudFunctionsServiceClient |
Type | Description |
IOException |
create(CloudFunctionsServiceSettings settings)
public static final CloudFunctionsServiceClient create(CloudFunctionsServiceSettings settings)
Constructs an instance of CloudFunctionsServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
Name | Description |
settings | CloudFunctionsServiceSettings |
Type | Description |
CloudFunctionsServiceClient |
Type | Description |
IOException |
create(CloudFunctionsServiceStub stub)
public static final CloudFunctionsServiceClient create(CloudFunctionsServiceStub stub)
Constructs an instance of CloudFunctionsServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(CloudFunctionsServiceSettings).
Name | Description |
stub | CloudFunctionsServiceStub |
Type | Description |
CloudFunctionsServiceClient |
Constructors
CloudFunctionsServiceClient(CloudFunctionsServiceSettings settings)
protected CloudFunctionsServiceClient(CloudFunctionsServiceSettings settings)
Constructs an instance of CloudFunctionsServiceClient, 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.
Name | Description |
settings | CloudFunctionsServiceSettings |
CloudFunctionsServiceClient(CloudFunctionsServiceStub stub)
protected CloudFunctionsServiceClient(CloudFunctionsServiceStub stub)
Name | Description |
stub | CloudFunctionsServiceStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)
Name | Description |
duration | long |
unit | TimeUnit |
Type | Description |
boolean |
Type | Description |
InterruptedException |
callFunction(CallFunctionRequest request)
public final CallFunctionResponse callFunction(CallFunctionRequest request)
Synchronously invokes a deployed Cloud Function. To be used for testing purposes as very limited traffic is allowed. For more information on the actual limits, refer to Rate Limits.
Sample code:
try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
CallFunctionRequest request =
CallFunctionRequest.newBuilder()
.setName(CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
.setData("data3076010")
.build();
CallFunctionResponse response = cloudFunctionsServiceClient.callFunction(request);
}
Name | Description |
request | CallFunctionRequest The request object containing all of the parameters for the API call. |
Type | Description |
CallFunctionResponse |
callFunction(CloudFunctionName name, String data)
public final CallFunctionResponse callFunction(CloudFunctionName name, String data)
Synchronously invokes a deployed Cloud Function. To be used for testing purposes as very limited traffic is allowed. For more information on the actual limits, refer to Rate Limits.
Sample code:
try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
CloudFunctionName name = CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]");
String data = "data3076010";
CallFunctionResponse response = cloudFunctionsServiceClient.callFunction(name, data);
}
Name | Description |
name | CloudFunctionName Required. The name of the function to be called. |
data | String Required. Input to be passed to the function. |
Type | Description |
CallFunctionResponse |
callFunction(String name, String data)
public final CallFunctionResponse callFunction(String name, String data)
Synchronously invokes a deployed Cloud Function. To be used for testing purposes as very limited traffic is allowed. For more information on the actual limits, refer to Rate Limits.
Sample code:
try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
String name = CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString();
String data = "data3076010";
CallFunctionResponse response = cloudFunctionsServiceClient.callFunction(name, data);
}
Name | Description |
name | String Required. The name of the function to be called. |
data | String Required. Input to be passed to the function. |
Type | Description |
CallFunctionResponse |
callFunctionCallable()
public final UnaryCallable<CallFunctionRequest,CallFunctionResponse> callFunctionCallable()
Synchronously invokes a deployed Cloud Function. To be used for testing purposes as very limited traffic is allowed. For more information on the actual limits, refer to Rate Limits.
Sample code:
try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
CallFunctionRequest request =
CallFunctionRequest.newBuilder()
.setName(CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
.setData("data3076010")
.build();
ApiFuture
Type | Description |
UnaryCallable<CallFunctionRequest,CallFunctionResponse> |
close()
public final void close()
createFunctionAsync(CreateFunctionRequest request)
public final OperationFuture<CloudFunction,OperationMetadataV1> createFunctionAsync(CreateFunctionRequest request)
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:
try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
CreateFunctionRequest request =
CreateFunctionRequest.newBuilder()
.setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setFunction(CloudFunction.newBuilder().build())
.build();
CloudFunction response = cloudFunctionsServiceClient.createFunctionAsync(request).get();
}
Name | Description |
request | CreateFunctionRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<CloudFunction,OperationMetadataV1> |
createFunctionAsync(LocationName location, CloudFunction function)
public final OperationFuture<CloudFunction,OperationMetadataV1> createFunctionAsync(LocationName location, CloudFunction function)
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:
try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
LocationName location = LocationName.of("[PROJECT]", "[LOCATION]");
CloudFunction function = CloudFunction.newBuilder().build();
CloudFunction response =
cloudFunctionsServiceClient.createFunctionAsync(location, function).get();
}
Name | Description |
location | LocationName Required. The project and location in which the function should be created,
specified in the format |
function | CloudFunction Required. Function to be created. |
Type | Description |
OperationFuture<CloudFunction,OperationMetadataV1> |
createFunctionAsync(String location, CloudFunction function)
public final OperationFuture<CloudFunction,OperationMetadataV1> createFunctionAsync(String location, CloudFunction function)
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:
try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
String location = LocationName.of("[PROJECT]", "[LOCATION]").toString();
CloudFunction function = CloudFunction.newBuilder().build();
CloudFunction response =
cloudFunctionsServiceClient.createFunctionAsync(location, function).get();
}
Name | Description |
location | String Required. The project and location in which the function should be created,
specified in the format |
function | CloudFunction Required. Function to be created. |
Type | Description |
OperationFuture<CloudFunction,OperationMetadataV1> |
createFunctionCallable()
public final UnaryCallable<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:
try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
CreateFunctionRequest request =
CreateFunctionRequest.newBuilder()
.setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setFunction(CloudFunction.newBuilder().build())
.build();
ApiFuture<Operation> future =
cloudFunctionsServiceClient.createFunctionCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<CreateFunctionRequest,Operation> |
createFunctionOperationCallable()
public final OperationCallable<CreateFunctionRequest,CloudFunction,OperationMetadataV1> 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:
try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
CreateFunctionRequest request =
CreateFunctionRequest.newBuilder()
.setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setFunction(CloudFunction.newBuilder().build())
.build();
OperationFuture
Type | Description |
OperationCallable<CreateFunctionRequest,CloudFunction,OperationMetadataV1> |
deleteFunctionAsync(CloudFunctionName name)
public final OperationFuture<Empty,OperationMetadataV1> deleteFunctionAsync(CloudFunctionName name)
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:
try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
CloudFunctionName name = CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]");
cloudFunctionsServiceClient.deleteFunctionAsync(name).get();
}
Name | Description |
name | CloudFunctionName Required. The name of the function which should be deleted. |
Type | Description |
OperationFuture<Empty,OperationMetadataV1> |
deleteFunctionAsync(DeleteFunctionRequest request)
public final OperationFuture<Empty,OperationMetadataV1> deleteFunctionAsync(DeleteFunctionRequest request)
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:
try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
DeleteFunctionRequest request =
DeleteFunctionRequest.newBuilder()
.setName(CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
.build();
cloudFunctionsServiceClient.deleteFunctionAsync(request).get();
}
Name | Description |
request | DeleteFunctionRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Empty,OperationMetadataV1> |
deleteFunctionAsync(String name)
public final OperationFuture<Empty,OperationMetadataV1> deleteFunctionAsync(String name)
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:
try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
String name = CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString();
cloudFunctionsServiceClient.deleteFunctionAsync(name).get();
}
Name | Description |
name | String Required. The name of the function which should be deleted. |
Type | Description |
OperationFuture<Empty,OperationMetadataV1> |
deleteFunctionCallable()
public final UnaryCallable<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:
try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
DeleteFunctionRequest request =
DeleteFunctionRequest.newBuilder()
.setName(CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
.build();
ApiFuture<Operation> future =
cloudFunctionsServiceClient.deleteFunctionCallable().futureCall(request);
// Do something.
future.get();
}
Type | Description |
UnaryCallable<DeleteFunctionRequest,Operation> |
deleteFunctionOperationCallable()
public final OperationCallable<DeleteFunctionRequest,Empty,OperationMetadataV1> 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:
try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
DeleteFunctionRequest request =
DeleteFunctionRequest.newBuilder()
.setName(CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
.build();
OperationFuture
Type | Description |
OperationCallable<DeleteFunctionRequest,Empty,OperationMetadataV1> |
generateDownloadUrl(GenerateDownloadUrlRequest request)
public final GenerateDownloadUrlResponse generateDownloadUrl(GenerateDownloadUrlRequest request)
Returns a signed URL for downloading deployed function source code. The URL is only valid for a limited period and should be used within minutes after generation. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls
Sample code:
try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
GenerateDownloadUrlRequest request =
GenerateDownloadUrlRequest.newBuilder()
.setName("name3373707")
.setVersionId(-670497310)
.build();
GenerateDownloadUrlResponse response =
cloudFunctionsServiceClient.generateDownloadUrl(request);
}
Name | Description |
request | GenerateDownloadUrlRequest The request object containing all of the parameters for the API call. |
Type | Description |
GenerateDownloadUrlResponse |
generateDownloadUrlCallable()
public final UnaryCallable<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 minutes after generation. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls
Sample code:
try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
GenerateDownloadUrlRequest request =
GenerateDownloadUrlRequest.newBuilder()
.setName("name3373707")
.setVersionId(-670497310)
.build();
ApiFuture
Type | Description |
UnaryCallable<GenerateDownloadUrlRequest,GenerateDownloadUrlResponse> |
generateUploadUrl(GenerateUploadUrlRequest request)
public final GenerateUploadUrlResponse generateUploadUrl(GenerateUploadUrlRequest request)
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.
- Source file size should not exceed 100MB limit.
- 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
x-goog-content-length-range: 0,104857600
And this header SHOULD NOT be specified:
Authorization: Bearer YOUR_TOKEN
Sample code:
try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
GenerateUploadUrlRequest request =
GenerateUploadUrlRequest.newBuilder().setParent("parent-995424086").build();
GenerateUploadUrlResponse response = cloudFunctionsServiceClient.generateUploadUrl(request);
}
Name | Description |
request | GenerateUploadUrlRequest The request object containing all of the parameters for the API call. |
Type | Description |
GenerateUploadUrlResponse |
generateUploadUrlCallable()
public final UnaryCallable<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.
- Source file size should not exceed 100MB limit.
- 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
x-goog-content-length-range: 0,104857600
And this header SHOULD NOT be specified:
Authorization: Bearer YOUR_TOKEN
Sample code:
try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
GenerateUploadUrlRequest request =
GenerateUploadUrlRequest.newBuilder().setParent("parent-995424086").build();
ApiFuture
Type | Description |
UnaryCallable<GenerateUploadUrlRequest,GenerateUploadUrlResponse> |
getFunction(CloudFunctionName name)
public final CloudFunction getFunction(CloudFunctionName name)
Returns a function with the given name from the requested project.
Sample code:
try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
CloudFunctionName name = CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]");
CloudFunction response = cloudFunctionsServiceClient.getFunction(name);
}
Name | Description |
name | CloudFunctionName Required. The name of the function which details should be obtained. |
Type | Description |
CloudFunction |
getFunction(GetFunctionRequest request)
public final CloudFunction getFunction(GetFunctionRequest request)
Returns a function with the given name from the requested project.
Sample code:
try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
GetFunctionRequest request =
GetFunctionRequest.newBuilder()
.setName(CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
.build();
CloudFunction response = cloudFunctionsServiceClient.getFunction(request);
}
Name | Description |
request | GetFunctionRequest The request object containing all of the parameters for the API call. |
Type | Description |
CloudFunction |
getFunction(String name)
public final CloudFunction getFunction(String name)
Returns a function with the given name from the requested project.
Sample code:
try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
String name = CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString();
CloudFunction response = cloudFunctionsServiceClient.getFunction(name);
}
Name | Description |
name | String Required. The name of the function which details should be obtained. |
Type | Description |
CloudFunction |
getFunctionCallable()
public final UnaryCallable<GetFunctionRequest,CloudFunction> getFunctionCallable()
Returns a function with the given name from the requested project.
Sample code:
try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
GetFunctionRequest request =
GetFunctionRequest.newBuilder()
.setName(CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
.build();
ApiFuture
Type | Description |
UnaryCallable<GetFunctionRequest,CloudFunction> |
getIamPolicy(GetIamPolicyRequest request)
public final Policy getIamPolicy(GetIamPolicyRequest request)
Gets the IAM access control policy for a function. Returns an empty policy if the function exists and does not have a policy set.
Sample code:
try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
GetIamPolicyRequest request =
GetIamPolicyRequest.newBuilder()
.setResource(CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
.setOptions(GetPolicyOptions.newBuilder().build())
.build();
Policy response = cloudFunctionsServiceClient.getIamPolicy(request);
}
Name | Description |
request | com.google.iam.v1.GetIamPolicyRequest The request object containing all of the parameters for the API call. |
Type | Description |
com.google.iam.v1.Policy |
getIamPolicyCallable()
public final UnaryCallable<GetIamPolicyRequest,Policy> getIamPolicyCallable()
Gets the IAM access control policy for a function. Returns an empty policy if the function exists and does not have a policy set.
Sample code:
try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
GetIamPolicyRequest request =
GetIamPolicyRequest.newBuilder()
.setResource(CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
.setOptions(GetPolicyOptions.newBuilder().build())
.build();
ApiFuture<Policy> future =
cloudFunctionsServiceClient.getIamPolicyCallable().futureCall(request);
// Do something.
Policy response = future.get();
}
Type | Description |
UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> |
getOperationsClient()
public final OperationsClient getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
Type | Description |
OperationsClient |
getSettings()
public final CloudFunctionsServiceSettings getSettings()
Type | Description |
CloudFunctionsServiceSettings |
getStub()
public CloudFunctionsServiceStub getStub()
Type | Description |
CloudFunctionsServiceStub |
isShutdown()
public boolean isShutdown()
Type | Description |
boolean |
isTerminated()
public boolean isTerminated()
Type | Description |
boolean |
listFunctions(ListFunctionsRequest request)
public final CloudFunctionsServiceClient.ListFunctionsPagedResponse listFunctions(ListFunctionsRequest request)
Returns a list of functions that belong to the requested project.
Sample code:
try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
ListFunctionsRequest request =
ListFunctionsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (CloudFunction element :
cloudFunctionsServiceClient.listFunctions(request).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
request | ListFunctionsRequest The request object containing all of the parameters for the API call. |
Type | Description |
CloudFunctionsServiceClient.ListFunctionsPagedResponse |
listFunctionsCallable()
public final UnaryCallable<ListFunctionsRequest,ListFunctionsResponse> listFunctionsCallable()
Returns a list of functions that belong to the requested project.
Sample code:
try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
ListFunctionsRequest request =
ListFunctionsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListFunctionsResponse response =
cloudFunctionsServiceClient.listFunctionsCallable().call(request);
for (CloudFunction element : response.getResponsesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Type | Description |
UnaryCallable<ListFunctionsRequest,ListFunctionsResponse> |
listFunctionsPagedCallable()
public final UnaryCallable<ListFunctionsRequest,CloudFunctionsServiceClient.ListFunctionsPagedResponse> listFunctionsPagedCallable()
Returns a list of functions that belong to the requested project.
Sample code:
try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
ListFunctionsRequest request =
ListFunctionsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture
Type | Description |
UnaryCallable<ListFunctionsRequest,ListFunctionsPagedResponse> |
setIamPolicy(SetIamPolicyRequest request)
public final Policy setIamPolicy(SetIamPolicyRequest request)
Sets the IAM access control policy on the specified function. Replaces any existing policy.
Sample code:
try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
SetIamPolicyRequest request =
SetIamPolicyRequest.newBuilder()
.setResource(CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
.setPolicy(Policy.newBuilder().build())
.build();
Policy response = cloudFunctionsServiceClient.setIamPolicy(request);
}
Name | Description |
request | com.google.iam.v1.SetIamPolicyRequest The request object containing all of the parameters for the API call. |
Type | Description |
com.google.iam.v1.Policy |
setIamPolicyCallable()
public final UnaryCallable<SetIamPolicyRequest,Policy> setIamPolicyCallable()
Sets the IAM access control policy on the specified function. Replaces any existing policy.
Sample code:
try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
SetIamPolicyRequest request =
SetIamPolicyRequest.newBuilder()
.setResource(CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
.setPolicy(Policy.newBuilder().build())
.build();
ApiFuture<Policy> future =
cloudFunctionsServiceClient.setIamPolicyCallable().futureCall(request);
// Do something.
Policy response = future.get();
}
Type | Description |
UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> |
shutdown()
public void shutdown()
shutdownNow()
public void shutdownNow()
testIamPermissions(TestIamPermissionsRequest request)
public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request)
Tests the specified permissions against the IAM access control policy for a function. If the function does not exist, this will return an empty set of permissions, not a NOT_FOUND error.
Sample code:
try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
TestIamPermissionsRequest request =
TestIamPermissionsRequest.newBuilder()
.setResource(CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
.addAllPermissions(new ArrayList<String>())
.build();
TestIamPermissionsResponse response = cloudFunctionsServiceClient.testIamPermissions(request);
}
Name | Description |
request | com.google.iam.v1.TestIamPermissionsRequest The request object containing all of the parameters for the API call. |
Type | Description |
com.google.iam.v1.TestIamPermissionsResponse |
testIamPermissionsCallable()
public final UnaryCallable<TestIamPermissionsRequest,TestIamPermissionsResponse> testIamPermissionsCallable()
Tests the specified permissions against the IAM access control policy for a function. If the function does not exist, this will return an empty set of permissions, not a NOT_FOUND error.
Sample code:
try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
TestIamPermissionsRequest request =
TestIamPermissionsRequest.newBuilder()
.setResource(CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
.addAllPermissions(new ArrayList<String>())
.build();
ApiFuture
Type | Description |
UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse> |
updateFunctionAsync(CloudFunction function)
public final OperationFuture<CloudFunction,OperationMetadataV1> updateFunctionAsync(CloudFunction function)
Updates existing function.
Sample code:
try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
CloudFunction function = CloudFunction.newBuilder().build();
CloudFunction response = cloudFunctionsServiceClient.updateFunctionAsync(function).get();
}
Name | Description |
function | CloudFunction Required. New version of the function. |
Type | Description |
OperationFuture<CloudFunction,OperationMetadataV1> |
updateFunctionAsync(UpdateFunctionRequest request)
public final OperationFuture<CloudFunction,OperationMetadataV1> updateFunctionAsync(UpdateFunctionRequest request)
Updates existing function.
Sample code:
try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
UpdateFunctionRequest request =
UpdateFunctionRequest.newBuilder()
.setFunction(CloudFunction.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
CloudFunction response = cloudFunctionsServiceClient.updateFunctionAsync(request).get();
}
Name | Description |
request | UpdateFunctionRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<CloudFunction,OperationMetadataV1> |
updateFunctionCallable()
public final UnaryCallable<UpdateFunctionRequest,Operation> updateFunctionCallable()
Updates existing function.
Sample code:
try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
UpdateFunctionRequest request =
UpdateFunctionRequest.newBuilder()
.setFunction(CloudFunction.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Operation> future =
cloudFunctionsServiceClient.updateFunctionCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<UpdateFunctionRequest,Operation> |
updateFunctionOperationCallable()
public final OperationCallable<UpdateFunctionRequest,CloudFunction,OperationMetadataV1> updateFunctionOperationCallable()
Updates existing function.
Sample code:
try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
UpdateFunctionRequest request =
UpdateFunctionRequest.newBuilder()
.setFunction(CloudFunction.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
OperationFuture
Type | Description |
OperationCallable<UpdateFunctionRequest,CloudFunction,OperationMetadataV1> |