Class RegionSnapshotSettingsClient (1.105.0)

GitHub RepositoryProduct Reference

Service Description: The RegionSnapshotSettings API.

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 (RegionSnapshotSettingsClient regionSnapshotSettingsClient =
     RegionSnapshotSettingsClient.create()) {
   String project = "project-309310695";
   String region = "region-934795532";
   SnapshotSettings response = regionSnapshotSettingsClient.get(project, region);
 }
 

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

Methods
Method Description Method Variants

Get

Get region snapshot settings.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • get(GetRegionSnapshotSettingRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • get(String project, String region)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getCallable()

Patch

Patch region snapshot settings.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • patchAsync(PatchRegionSnapshotSettingRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • patchAsync(String project, String region, SnapshotSettings snapshotSettingsResource)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • patchOperationCallable()

  • patchCallable()

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 RegionSnapshotSettingsSettings 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
 RegionSnapshotSettingsSettings regionSnapshotSettingsSettings =
     RegionSnapshotSettingsSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 RegionSnapshotSettingsClient regionSnapshotSettingsClient =
     RegionSnapshotSettingsClient.create(regionSnapshotSettingsSettings);
 

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
 RegionSnapshotSettingsSettings regionSnapshotSettingsSettings =
     RegionSnapshotSettingsSettings.newBuilder().setEndpoint(myEndpoint).build();
 RegionSnapshotSettingsClient regionSnapshotSettingsClient =
     RegionSnapshotSettingsClient.create(regionSnapshotSettingsSettings);
 

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

Inheritance

java.lang.Object > RegionSnapshotSettingsClient

Static Methods

create()

public static final RegionSnapshotSettingsClient create()

Constructs an instance of RegionSnapshotSettingsClient with default settings.

Returns
Type Description
RegionSnapshotSettingsClient
Exceptions
Type Description
IOException

create(RegionSnapshotSettingsSettings settings)

public static final RegionSnapshotSettingsClient create(RegionSnapshotSettingsSettings settings)

Constructs an instance of RegionSnapshotSettingsClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.

Parameter
Name Description
settings RegionSnapshotSettingsSettings
Returns
Type Description
RegionSnapshotSettingsClient
Exceptions
Type Description
IOException

create(RegionSnapshotSettingsStub stub)

public static final RegionSnapshotSettingsClient create(RegionSnapshotSettingsStub stub)

Constructs an instance of RegionSnapshotSettingsClient, using the given stub for making calls. This is for advanced usage - prefer using create(RegionSnapshotSettingsSettings).

Parameter
Name Description
stub RegionSnapshotSettingsStub
Returns
Type Description
RegionSnapshotSettingsClient

Constructors

RegionSnapshotSettingsClient(RegionSnapshotSettingsSettings settings)

protected RegionSnapshotSettingsClient(RegionSnapshotSettingsSettings settings)

Constructs an instance of RegionSnapshotSettingsClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.

Parameter
Name Description
settings RegionSnapshotSettingsSettings

RegionSnapshotSettingsClient(RegionSnapshotSettingsStub stub)

protected RegionSnapshotSettingsClient(RegionSnapshotSettingsStub stub)
Parameter
Name Description
stub RegionSnapshotSettingsStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
Name Description
duration long
unit TimeUnit
Returns
Type Description
boolean
Exceptions
Type Description
InterruptedException

close()

public final void close()

get(GetRegionSnapshotSettingRequest request)

public final SnapshotSettings get(GetRegionSnapshotSettingRequest request)

Get region snapshot settings.

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 (RegionSnapshotSettingsClient regionSnapshotSettingsClient =
     RegionSnapshotSettingsClient.create()) {
   GetRegionSnapshotSettingRequest request =
       GetRegionSnapshotSettingRequest.newBuilder()
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .build();
   SnapshotSettings response = regionSnapshotSettingsClient.get(request);
 }
 
Parameter
Name Description
request GetRegionSnapshotSettingRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
SnapshotSettings

get(String project, String region)

public final SnapshotSettings get(String project, String region)

Get region snapshot settings.

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 (RegionSnapshotSettingsClient regionSnapshotSettingsClient =
     RegionSnapshotSettingsClient.create()) {
   String project = "project-309310695";
   String region = "region-934795532";
   SnapshotSettings response = regionSnapshotSettingsClient.get(project, region);
 }
 
Parameters
Name Description
project String

Project ID for this request.

region String

Name of the region for this request.

Returns
Type Description
SnapshotSettings

getCallable()

public final UnaryCallable<GetRegionSnapshotSettingRequest,SnapshotSettings> getCallable()

Get region snapshot settings.

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 (RegionSnapshotSettingsClient regionSnapshotSettingsClient =
     RegionSnapshotSettingsClient.create()) {
   GetRegionSnapshotSettingRequest request =
       GetRegionSnapshotSettingRequest.newBuilder()
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .build();
   ApiFuture<SnapshotSettings> future =
       regionSnapshotSettingsClient.getCallable().futureCall(request);
   // Do something.
   SnapshotSettings response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetRegionSnapshotSettingRequest,SnapshotSettings>

getSettings()

public final @Nullable RegionSnapshotSettingsSettings getSettings()
Returns
Type Description
@org.jspecify.annotations.Nullable com.google.cloud.compute.v1.RegionSnapshotSettingsSettings

getStub()

public RegionSnapshotSettingsStub getStub()
Returns
Type Description
RegionSnapshotSettingsStub

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

patchAsync(PatchRegionSnapshotSettingRequest request)

public final OperationFuture<Operation,Operation> patchAsync(PatchRegionSnapshotSettingRequest request)

Patch region snapshot settings.

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 (RegionSnapshotSettingsClient regionSnapshotSettingsClient =
     RegionSnapshotSettingsClient.create()) {
   PatchRegionSnapshotSettingRequest request =
       PatchRegionSnapshotSettingRequest.newBuilder()
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setRequestId("requestId693933066")
           .setSnapshotSettingsResource(SnapshotSettings.newBuilder().build())
           .setUpdateMask("updateMask-296147115")
           .build();
   Operation response = regionSnapshotSettingsClient.patchAsync(request).get();
 }
 
Parameter
Name Description
request PatchRegionSnapshotSettingRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<Operation,Operation>

patchAsync(String project, String region, SnapshotSettings snapshotSettingsResource)

public final OperationFuture<Operation,Operation> patchAsync(String project, String region, SnapshotSettings snapshotSettingsResource)

Patch region snapshot settings.

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 (RegionSnapshotSettingsClient regionSnapshotSettingsClient =
     RegionSnapshotSettingsClient.create()) {
   String project = "project-309310695";
   String region = "region-934795532";
   SnapshotSettings snapshotSettingsResource = SnapshotSettings.newBuilder().build();
   Operation response =
       regionSnapshotSettingsClient.patchAsync(project, region, snapshotSettingsResource).get();
 }
 
Parameters
Name Description
project String

Project ID for this request.

region String

Name of the region for this request.

snapshotSettingsResource SnapshotSettings

The body resource for this request

Returns
Type Description
OperationFuture<Operation,Operation>

patchCallable()

public final UnaryCallable<PatchRegionSnapshotSettingRequest,Operation> patchCallable()

Patch region snapshot settings.

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 (RegionSnapshotSettingsClient regionSnapshotSettingsClient =
     RegionSnapshotSettingsClient.create()) {
   PatchRegionSnapshotSettingRequest request =
       PatchRegionSnapshotSettingRequest.newBuilder()
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setRequestId("requestId693933066")
           .setSnapshotSettingsResource(SnapshotSettings.newBuilder().build())
           .setUpdateMask("updateMask-296147115")
           .build();
   ApiFuture<Operation> future =
       regionSnapshotSettingsClient.patchCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<PatchRegionSnapshotSettingRequest,Operation>

patchOperationCallable()

public final OperationCallable<PatchRegionSnapshotSettingRequest,Operation,Operation> patchOperationCallable()

Patch region snapshot settings.

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 (RegionSnapshotSettingsClient regionSnapshotSettingsClient =
     RegionSnapshotSettingsClient.create()) {
   PatchRegionSnapshotSettingRequest request =
       PatchRegionSnapshotSettingRequest.newBuilder()
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setRequestId("requestId693933066")
           .setSnapshotSettingsResource(SnapshotSettings.newBuilder().build())
           .setUpdateMask("updateMask-296147115")
           .build();
   OperationFuture<Operation, Operation> future =
       regionSnapshotSettingsClient.patchOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
OperationCallable<PatchRegionSnapshotSettingRequest,Operation,Operation>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()