@Generated(value="by gapic-generator-java") public class CloudFunctionsServiceClient extends Object implements com.google.api.gax.core.BackgroundResource
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 (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().
| Method | Description | Method Variants |
|---|---|---|
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.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
|
CreateFunction |
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. |
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 `OperationFuture`, which is used to track polling of the service.
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 `OperationFuture`, which is used to track polling of the service.
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 `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CallFunction |
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](https://cloud.google.com/functions/quotas#rate_limits). |
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.
|
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 minutes after 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.
|
SetIamPolicy |
Sets the IAM access control policy on the specified function. Replaces any existing policy. |
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 IAM access control policy for a function. Returns an empty policy if the function 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 |
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. |
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.
|
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.
|
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:
// 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
CloudFunctionsServiceSettings cloudFunctionsServiceSettings =
CloudFunctionsServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create(cloudFunctionsServiceSettings);
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
CloudFunctionsServiceSettings cloudFunctionsServiceSettings =
CloudFunctionsServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create(cloudFunctionsServiceSettings);
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
CloudFunctionsServiceSettings cloudFunctionsServiceSettings =
CloudFunctionsServiceSettings.newHttpJsonBuilder().build();
CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create(cloudFunctionsServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
| Modifier and Type | Class and Description |
|---|---|
static class |
CloudFunctionsServiceClient.ListFunctionsFixedSizeCollection |
static class |
CloudFunctionsServiceClient.ListFunctionsPage |
static class |
CloudFunctionsServiceClient.ListFunctionsPagedResponse |
static class |
CloudFunctionsServiceClient.ListLocationsFixedSizeCollection |
static class |
CloudFunctionsServiceClient.ListLocationsPage |
static class |
CloudFunctionsServiceClient.ListLocationsPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
CloudFunctionsServiceClient(CloudFunctionsServiceSettings settings)
Constructs an instance of CloudFunctionsServiceClient, using the given settings.
|
protected |
CloudFunctionsServiceClient(CloudFunctionsServiceStub stub) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
CallFunctionResponse |
callFunction(CallFunctionRequest request)
Synchronously invokes a deployed Cloud Function.
|
CallFunctionResponse |
callFunction(CloudFunctionName name,
String data)
Synchronously invokes a deployed Cloud Function.
|
CallFunctionResponse |
callFunction(String name,
String data)
Synchronously invokes a deployed Cloud Function.
|
com.google.api.gax.rpc.UnaryCallable<CallFunctionRequest,CallFunctionResponse> |
callFunctionCallable()
Synchronously invokes a deployed Cloud Function.
|
void |
close() |
static CloudFunctionsServiceClient |
create()
Constructs an instance of CloudFunctionsServiceClient with default settings.
|
static CloudFunctionsServiceClient |
create(CloudFunctionsServiceSettings settings)
Constructs an instance of CloudFunctionsServiceClient, using the given settings.
|
static CloudFunctionsServiceClient |
create(CloudFunctionsServiceStub stub)
Constructs an instance of CloudFunctionsServiceClient, using the given stub for making calls.
|
com.google.api.gax.longrunning.OperationFuture<CloudFunction,OperationMetadataV1> |
createFunctionAsync(CreateFunctionRequest request)
Creates a new function.
|
com.google.api.gax.longrunning.OperationFuture<CloudFunction,OperationMetadataV1> |
createFunctionAsync(LocationName location,
CloudFunction function)
Creates a new function.
|
com.google.api.gax.longrunning.OperationFuture<CloudFunction,OperationMetadataV1> |
createFunctionAsync(String location,
CloudFunction function)
Creates a new function.
|
com.google.api.gax.rpc.UnaryCallable<CreateFunctionRequest,com.google.longrunning.Operation> |
createFunctionCallable()
Creates a new function.
|
com.google.api.gax.rpc.OperationCallable<CreateFunctionRequest,CloudFunction,OperationMetadataV1> |
createFunctionOperationCallable()
Creates a new function.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadataV1> |
deleteFunctionAsync(CloudFunctionName name)
Deletes a function with the given name from the specified project.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadataV1> |
deleteFunctionAsync(DeleteFunctionRequest request)
Deletes a function with the given name from the specified project.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadataV1> |
deleteFunctionAsync(String name)
Deletes a function with the given name from the specified project.
|
com.google.api.gax.rpc.UnaryCallable<DeleteFunctionRequest,com.google.longrunning.Operation> |
deleteFunctionCallable()
Deletes a function with the given name from the specified project.
|
com.google.api.gax.rpc.OperationCallable<DeleteFunctionRequest,com.google.protobuf.Empty,OperationMetadataV1> |
deleteFunctionOperationCallable()
Deletes a function with the given name from the specified project.
|
GenerateDownloadUrlResponse |
generateDownloadUrl(GenerateDownloadUrlRequest request)
Returns a signed URL for downloading deployed function source code.
|
com.google.api.gax.rpc.UnaryCallable<GenerateDownloadUrlRequest,GenerateDownloadUrlResponse> |
generateDownloadUrlCallable()
Returns a signed URL for downloading deployed function source code.
|
GenerateUploadUrlResponse |
generateUploadUrl(GenerateUploadUrlRequest request)
Returns a signed URL for uploading a function source code.
|
com.google.api.gax.rpc.UnaryCallable<GenerateUploadUrlRequest,GenerateUploadUrlResponse> |
generateUploadUrlCallable()
Returns a signed URL for uploading a function source code.
|
CloudFunction |
getFunction(CloudFunctionName name)
Returns a function with the given name from the requested project.
|
CloudFunction |
getFunction(GetFunctionRequest request)
Returns a function with the given name from the requested project.
|
CloudFunction |
getFunction(String name)
Returns a function with the given name from the requested project.
|
com.google.api.gax.rpc.UnaryCallable<GetFunctionRequest,CloudFunction> |
getFunctionCallable()
Returns a function with the given name from the requested project.
|
com.google.api.gax.httpjson.longrunning.OperationsClient |
getHttpJsonOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
com.google.iam.v1.Policy |
getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request)
Gets the IAM access control policy for a function.
|
com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> |
getIamPolicyCallable()
Gets the IAM access control policy for a function.
|
com.google.longrunning.OperationsClient |
getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
CloudFunctionsServiceSettings |
getSettings() |
CloudFunctionsServiceStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
CloudFunctionsServiceClient.ListFunctionsPagedResponse |
listFunctions(ListFunctionsRequest request)
Returns a list of functions that belong to the requested project.
|
com.google.api.gax.rpc.UnaryCallable<ListFunctionsRequest,ListFunctionsResponse> |
listFunctionsCallable()
Returns a list of functions that belong to the requested project.
|
com.google.api.gax.rpc.UnaryCallable<ListFunctionsRequest,CloudFunctionsServiceClient.ListFunctionsPagedResponse> |
listFunctionsPagedCallable()
Returns a list of functions that belong to the requested project.
|
CloudFunctionsServiceClient.ListLocationsPagedResponse |
listLocations(com.google.cloud.location.ListLocationsRequest request)
Lists information about the supported locations for this service.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> |
listLocationsCallable()
Lists information about the supported locations for this service.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,CloudFunctionsServiceClient.ListLocationsPagedResponse> |
listLocationsPagedCallable()
Lists information about the supported locations for this service.
|
com.google.iam.v1.Policy |
setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request)
Sets the IAM access control policy on the specified function.
|
com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> |
setIamPolicyCallable()
Sets the IAM access control policy on the specified function.
|
void |
shutdown() |
void |
shutdownNow() |
com.google.iam.v1.TestIamPermissionsResponse |
testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request)
Tests the specified permissions against the IAM access control policy for a function.
|
com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse> |
testIamPermissionsCallable()
Tests the specified permissions against the IAM access control policy for a function.
|
com.google.api.gax.longrunning.OperationFuture<CloudFunction,OperationMetadataV1> |
updateFunctionAsync(CloudFunction function)
Updates existing function.
|
com.google.api.gax.longrunning.OperationFuture<CloudFunction,OperationMetadataV1> |
updateFunctionAsync(UpdateFunctionRequest request)
Updates existing function.
|
com.google.api.gax.rpc.UnaryCallable<UpdateFunctionRequest,com.google.longrunning.Operation> |
updateFunctionCallable()
Updates existing function.
|
com.google.api.gax.rpc.OperationCallable<UpdateFunctionRequest,CloudFunction,OperationMetadataV1> |
updateFunctionOperationCallable()
Updates existing function.
|
protected CloudFunctionsServiceClient(CloudFunctionsServiceSettings settings) throws IOException
IOExceptionprotected CloudFunctionsServiceClient(CloudFunctionsServiceStub stub)
public static final CloudFunctionsServiceClient create() throws IOException
IOExceptionpublic static final CloudFunctionsServiceClient create(CloudFunctionsServiceSettings settings) throws IOException
IOExceptionpublic static final CloudFunctionsServiceClient create(CloudFunctionsServiceStub stub)
public final CloudFunctionsServiceSettings getSettings()
public CloudFunctionsServiceStub getStub()
public final com.google.longrunning.OperationsClient getOperationsClient()
@BetaApi public final com.google.api.gax.httpjson.longrunning.OperationsClient getHttpJsonOperationsClient()
public final CloudFunctionsServiceClient.ListFunctionsPagedResponse listFunctions(ListFunctionsRequest request)
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 (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);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListFunctionsRequest,CloudFunctionsServiceClient.ListFunctionsPagedResponse> listFunctionsPagedCallable()
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 (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
ListFunctionsRequest request =
ListFunctionsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<CloudFunction> future =
cloudFunctionsServiceClient.listFunctionsPagedCallable().futureCall(request);
// Do something.
for (CloudFunction element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListFunctionsRequest,ListFunctionsResponse> listFunctionsCallable()
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 (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.getFunctionsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final CloudFunction getFunction(CloudFunctionName name)
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 (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
CloudFunctionName name = CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]");
CloudFunction response = cloudFunctionsServiceClient.getFunction(name);
}
name - Required. The name of the function which details should be obtained.com.google.api.gax.rpc.ApiException - if the remote call failspublic final CloudFunction getFunction(String name)
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 (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
String name = CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString();
CloudFunction response = cloudFunctionsServiceClient.getFunction(name);
}
name - Required. The name of the function which details should be obtained.com.google.api.gax.rpc.ApiException - if the remote call failspublic final CloudFunction getFunction(GetFunctionRequest request)
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 (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
GetFunctionRequest request =
GetFunctionRequest.newBuilder()
.setName(CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
.setVersionId(-670497310)
.build();
CloudFunction response = cloudFunctionsServiceClient.getFunction(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetFunctionRequest,CloudFunction> getFunctionCallable()
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 (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
GetFunctionRequest request =
GetFunctionRequest.newBuilder()
.setName(CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
.setVersionId(-670497310)
.build();
ApiFuture<CloudFunction> future =
cloudFunctionsServiceClient.getFunctionCallable().futureCall(request);
// Do something.
CloudFunction response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<CloudFunction,OperationMetadataV1> createFunctionAsync(LocationName location, CloudFunction 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 (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
LocationName location = LocationName.of("[PROJECT]", "[LOCATION]");
CloudFunction function = CloudFunction.newBuilder().build();
CloudFunction response =
cloudFunctionsServiceClient.createFunctionAsync(location, function).get();
}
location - Required. The project and location in which the function should be created,
specified in the format `projects/*/locations/*`function - Required. Function to be created.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<CloudFunction,OperationMetadataV1> createFunctionAsync(String location, CloudFunction 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 (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
String location = LocationName.of("[PROJECT]", "[LOCATION]").toString();
CloudFunction function = CloudFunction.newBuilder().build();
CloudFunction response =
cloudFunctionsServiceClient.createFunctionAsync(location, function).get();
}
location - Required. The project and location in which the function should be created,
specified in the format `projects/*/locations/*`function - Required. Function to be created.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<CloudFunction,OperationMetadataV1> createFunctionAsync(CreateFunctionRequest request)
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 (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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<CreateFunctionRequest,CloudFunction,OperationMetadataV1> createFunctionOperationCallable()
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 (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
CreateFunctionRequest request =
CreateFunctionRequest.newBuilder()
.setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setFunction(CloudFunction.newBuilder().build())
.build();
OperationFuture<CloudFunction, OperationMetadataV1> future =
cloudFunctionsServiceClient.createFunctionOperationCallable().futureCall(request);
// Do something.
CloudFunction response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<CreateFunctionRequest,com.google.longrunning.Operation> createFunctionCallable()
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 (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();
}
public final com.google.api.gax.longrunning.OperationFuture<CloudFunction,OperationMetadataV1> updateFunctionAsync(CloudFunction 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 (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
CloudFunction function = CloudFunction.newBuilder().build();
CloudFunction response = cloudFunctionsServiceClient.updateFunctionAsync(function).get();
}
function - Required. New version of the function.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<CloudFunction,OperationMetadataV1> updateFunctionAsync(UpdateFunctionRequest request)
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 (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
UpdateFunctionRequest request =
UpdateFunctionRequest.newBuilder()
.setFunction(CloudFunction.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
CloudFunction response = cloudFunctionsServiceClient.updateFunctionAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<UpdateFunctionRequest,CloudFunction,OperationMetadataV1> updateFunctionOperationCallable()
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 (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
UpdateFunctionRequest request =
UpdateFunctionRequest.newBuilder()
.setFunction(CloudFunction.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
OperationFuture<CloudFunction, OperationMetadataV1> future =
cloudFunctionsServiceClient.updateFunctionOperationCallable().futureCall(request);
// Do something.
CloudFunction response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<UpdateFunctionRequest,com.google.longrunning.Operation> updateFunctionCallable()
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 (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();
}
public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadataV1> deleteFunctionAsync(CloudFunctionName name)
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 (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
CloudFunctionName name = CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]");
cloudFunctionsServiceClient.deleteFunctionAsync(name).get();
}
name - Required. The name of the function which should be deleted.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadataV1> deleteFunctionAsync(String name)
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 (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
String name = CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString();
cloudFunctionsServiceClient.deleteFunctionAsync(name).get();
}
name - Required. The name of the function which should be deleted.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadataV1> deleteFunctionAsync(DeleteFunctionRequest request)
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 (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
DeleteFunctionRequest request =
DeleteFunctionRequest.newBuilder()
.setName(CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
.build();
cloudFunctionsServiceClient.deleteFunctionAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<DeleteFunctionRequest,com.google.protobuf.Empty,OperationMetadataV1> deleteFunctionOperationCallable()
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 (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
DeleteFunctionRequest request =
DeleteFunctionRequest.newBuilder()
.setName(CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
.build();
OperationFuture<Empty, OperationMetadataV1> future =
cloudFunctionsServiceClient.deleteFunctionOperationCallable().futureCall(request);
// Do something.
future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<DeleteFunctionRequest,com.google.longrunning.Operation> deleteFunctionCallable()
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 (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();
}
public final CallFunctionResponse callFunction(CloudFunctionName name, String data)
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 (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
CloudFunctionName name = CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]");
String data = "data3076010";
CallFunctionResponse response = cloudFunctionsServiceClient.callFunction(name, data);
}
name - Required. The name of the function to be called.data - Required. Input to be passed to the function.com.google.api.gax.rpc.ApiException - if the remote call failspublic final CallFunctionResponse callFunction(String name, String data)
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 (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
String name = CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString();
String data = "data3076010";
CallFunctionResponse response = cloudFunctionsServiceClient.callFunction(name, data);
}
name - Required. The name of the function to be called.data - Required. Input to be passed to the function.com.google.api.gax.rpc.ApiException - if the remote call failspublic final CallFunctionResponse callFunction(CallFunctionRequest request)
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 (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
CallFunctionRequest request =
CallFunctionRequest.newBuilder()
.setName(CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
.setData("data3076010")
.build();
CallFunctionResponse response = cloudFunctionsServiceClient.callFunction(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<CallFunctionRequest,CallFunctionResponse> callFunctionCallable()
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 (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
CallFunctionRequest request =
CallFunctionRequest.newBuilder()
.setName(CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
.setData("data3076010")
.build();
ApiFuture<CallFunctionResponse> future =
cloudFunctionsServiceClient.callFunctionCallable().futureCall(request);
// Do something.
CallFunctionResponse response = future.get();
}
public final GenerateUploadUrlResponse generateUploadUrl(GenerateUploadUrlRequest request)
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:
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 (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
GenerateUploadUrlRequest request =
GenerateUploadUrlRequest.newBuilder()
.setParent("parent-995424086")
.setKmsKeyName(
CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
.toString())
.build();
GenerateUploadUrlResponse response = cloudFunctionsServiceClient.generateUploadUrl(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GenerateUploadUrlRequest,GenerateUploadUrlResponse> generateUploadUrlCallable()
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:
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 (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
GenerateUploadUrlRequest request =
GenerateUploadUrlRequest.newBuilder()
.setParent("parent-995424086")
.setKmsKeyName(
CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
.toString())
.build();
ApiFuture<GenerateUploadUrlResponse> future =
cloudFunctionsServiceClient.generateUploadUrlCallable().futureCall(request);
// Do something.
GenerateUploadUrlResponse response = future.get();
}
public final GenerateDownloadUrlResponse generateDownloadUrl(GenerateDownloadUrlRequest request)
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 (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
GenerateDownloadUrlRequest request =
GenerateDownloadUrlRequest.newBuilder()
.setName("name3373707")
.setVersionId(-670497310)
.build();
GenerateDownloadUrlResponse response =
cloudFunctionsServiceClient.generateDownloadUrl(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GenerateDownloadUrlRequest,GenerateDownloadUrlResponse> generateDownloadUrlCallable()
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 (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
GenerateDownloadUrlRequest request =
GenerateDownloadUrlRequest.newBuilder()
.setName("name3373707")
.setVersionId(-670497310)
.build();
ApiFuture<GenerateDownloadUrlResponse> future =
cloudFunctionsServiceClient.generateDownloadUrlCallable().futureCall(request);
// Do something.
GenerateDownloadUrlResponse response = future.get();
}
public final com.google.iam.v1.Policy setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request)
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 (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
SetIamPolicyRequest request =
SetIamPolicyRequest.newBuilder()
.setResource(CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
.setPolicy(Policy.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Policy response = cloudFunctionsServiceClient.setIamPolicy(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> setIamPolicyCallable()
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 (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
SetIamPolicyRequest request =
SetIamPolicyRequest.newBuilder()
.setResource(CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
.setPolicy(Policy.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Policy> future =
cloudFunctionsServiceClient.setIamPolicyCallable().futureCall(request);
// Do something.
Policy response = future.get();
}
public final com.google.iam.v1.Policy getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request)
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 (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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> getIamPolicyCallable()
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 (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();
}
public final com.google.iam.v1.TestIamPermissionsResponse testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request)
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 (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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse> testIamPermissionsCallable()
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 (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
TestIamPermissionsRequest request =
TestIamPermissionsRequest.newBuilder()
.setResource(CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
.addAllPermissions(new ArrayList<String>())
.build();
ApiFuture<TestIamPermissionsResponse> future =
cloudFunctionsServiceClient.testIamPermissionsCallable().futureCall(request);
// Do something.
TestIamPermissionsResponse response = future.get();
}
public final CloudFunctionsServiceClient.ListLocationsPagedResponse listLocations(com.google.cloud.location.ListLocationsRequest request)
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 (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Location element : cloudFunctionsServiceClient.listLocations(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,CloudFunctionsServiceClient.ListLocationsPagedResponse> listLocationsPagedCallable()
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 (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Location> future =
cloudFunctionsServiceClient.listLocationsPagedCallable().futureCall(request);
// Do something.
for (Location element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> listLocationsCallable()
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 (CloudFunctionsServiceClient cloudFunctionsServiceClient =
CloudFunctionsServiceClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListLocationsResponse response =
cloudFunctionsServiceClient.listLocationsCallable().call(request);
for (Location element : response.getLocationsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final void close()
close in interface AutoCloseablepublic void shutdown()
shutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isShutdown()
isShutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isTerminated()
isTerminated in interface com.google.api.gax.core.BackgroundResourcepublic void shutdownNow()
shutdownNow in interface com.google.api.gax.core.BackgroundResourcepublic boolean awaitTermination(long duration,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface com.google.api.gax.core.BackgroundResourceInterruptedExceptionCopyright © 2024 Google LLC. All rights reserved.