Class RegionDisksClient (1.27.0)

public class RegionDisksClient implements BackgroundResource

Service Description: The RegionDisks 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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   String project = "project-309310695";
   String region = "region-934795532";
   String disk = "disk3083677";
   Disk response = regionDisksClient.get(project, region, disk);
 }
 

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

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

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

See the individual methods for example code.

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

This class can be customized by passing in a custom instance of RegionDisksSettings 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
 RegionDisksSettings regionDisksSettings =
     RegionDisksSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 RegionDisksClient regionDisksClient = RegionDisksClient.create(regionDisksSettings);
 

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
 RegionDisksSettings regionDisksSettings =
     RegionDisksSettings.newBuilder().setEndpoint(myEndpoint).build();
 RegionDisksClient regionDisksClient = RegionDisksClient.create(regionDisksSettings);
 

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

Inheritance

java.lang.Object > RegionDisksClient

Implements

BackgroundResource

Static Methods

create()

public static final RegionDisksClient create()

Constructs an instance of RegionDisksClient with default settings.

Returns
TypeDescription
RegionDisksClient
Exceptions
TypeDescription
IOException

create(RegionDisksSettings settings)

public static final RegionDisksClient create(RegionDisksSettings settings)

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

Parameter
NameDescription
settingsRegionDisksSettings
Returns
TypeDescription
RegionDisksClient
Exceptions
TypeDescription
IOException

create(RegionDisksStub stub)

public static final RegionDisksClient create(RegionDisksStub stub)

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

Parameter
NameDescription
stubRegionDisksStub
Returns
TypeDescription
RegionDisksClient

Constructors

RegionDisksClient(RegionDisksSettings settings)

protected RegionDisksClient(RegionDisksSettings settings)

Constructs an instance of RegionDisksClient, 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
NameDescription
settingsRegionDisksSettings

RegionDisksClient(RegionDisksStub stub)

protected RegionDisksClient(RegionDisksStub stub)
Parameter
NameDescription
stubRegionDisksStub

Methods

addResourcePoliciesAsync(AddResourcePoliciesRegionDiskRequest request)

public final OperationFuture<Operation,Operation> addResourcePoliciesAsync(AddResourcePoliciesRegionDiskRequest request)

Adds existing resource policies to a regional disk. You can only add one policy which will be applied to this disk for scheduling snapshot creation.

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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   AddResourcePoliciesRegionDiskRequest request =
       AddResourcePoliciesRegionDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setRegionDisksAddResourcePoliciesRequestResource(
               RegionDisksAddResourcePoliciesRequest.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   Operation response = regionDisksClient.addResourcePoliciesAsync(request).get();
 }
 
Parameter
NameDescription
requestAddResourcePoliciesRegionDiskRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

addResourcePoliciesAsync(String project, String region, String disk, RegionDisksAddResourcePoliciesRequest regionDisksAddResourcePoliciesRequestResource)

public final OperationFuture<Operation,Operation> addResourcePoliciesAsync(String project, String region, String disk, RegionDisksAddResourcePoliciesRequest regionDisksAddResourcePoliciesRequestResource)

Adds existing resource policies to a regional disk. You can only add one policy which will be applied to this disk for scheduling snapshot creation.

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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   String project = "project-309310695";
   String region = "region-934795532";
   String disk = "disk3083677";
   RegionDisksAddResourcePoliciesRequest regionDisksAddResourcePoliciesRequestResource =
       RegionDisksAddResourcePoliciesRequest.newBuilder().build();
   Operation response =
       regionDisksClient
           .addResourcePoliciesAsync(
               project, region, disk, regionDisksAddResourcePoliciesRequestResource)
           .get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

regionString

The name of the region for this request.

diskString

The disk name for this request.

regionDisksAddResourcePoliciesRequestResourceRegionDisksAddResourcePoliciesRequest

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

addResourcePoliciesCallable()

public final UnaryCallable<AddResourcePoliciesRegionDiskRequest,Operation> addResourcePoliciesCallable()

Adds existing resource policies to a regional disk. You can only add one policy which will be applied to this disk for scheduling snapshot creation.

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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   AddResourcePoliciesRegionDiskRequest request =
       AddResourcePoliciesRegionDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setRegionDisksAddResourcePoliciesRequestResource(
               RegionDisksAddResourcePoliciesRequest.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future =
       regionDisksClient.addResourcePoliciesCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<AddResourcePoliciesRegionDiskRequest,Operation>

addResourcePoliciesOperationCallable()

public final OperationCallable<AddResourcePoliciesRegionDiskRequest,Operation,Operation> addResourcePoliciesOperationCallable()

Adds existing resource policies to a regional disk. You can only add one policy which will be applied to this disk for scheduling snapshot creation.

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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   AddResourcePoliciesRegionDiskRequest request =
       AddResourcePoliciesRegionDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setRegionDisksAddResourcePoliciesRequestResource(
               RegionDisksAddResourcePoliciesRequest.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Operation, Operation> future =
       regionDisksClient.addResourcePoliciesOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<AddResourcePoliciesRegionDiskRequest,Operation,Operation>

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
NameDescription
durationlong
unitTimeUnit
Returns
TypeDescription
boolean
Exceptions
TypeDescription
InterruptedException

close()

public final void close()

createSnapshotAsync(CreateSnapshotRegionDiskRequest request)

public final OperationFuture<Operation,Operation> createSnapshotAsync(CreateSnapshotRegionDiskRequest request)

Creates a snapshot of a specified persistent disk. For regular snapshot creation, consider using snapshots.insert instead, as that method supports more features, such as creating snapshots in a project different from the source disk project.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   CreateSnapshotRegionDiskRequest request =
       CreateSnapshotRegionDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setRequestId("requestId693933066")
           .setSnapshotResource(Snapshot.newBuilder().build())
           .build();
   Operation response = regionDisksClient.createSnapshotAsync(request).get();
 }
 
Parameter
NameDescription
requestCreateSnapshotRegionDiskRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

createSnapshotAsync(String project, String region, String disk, Snapshot snapshotResource)

public final OperationFuture<Operation,Operation> createSnapshotAsync(String project, String region, String disk, Snapshot snapshotResource)

Creates a snapshot of a specified persistent disk. For regular snapshot creation, consider using snapshots.insert instead, as that method supports more features, such as creating snapshots in a project different from the source disk project.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   String project = "project-309310695";
   String region = "region-934795532";
   String disk = "disk3083677";
   Snapshot snapshotResource = Snapshot.newBuilder().build();
   Operation response =
       regionDisksClient.createSnapshotAsync(project, region, disk, snapshotResource).get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

regionString

Name of the region for this request.

diskString

Name of the regional persistent disk to snapshot.

snapshotResourceSnapshot

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

createSnapshotCallable()

public final UnaryCallable<CreateSnapshotRegionDiskRequest,Operation> createSnapshotCallable()

Creates a snapshot of a specified persistent disk. For regular snapshot creation, consider using snapshots.insert instead, as that method supports more features, such as creating snapshots in a project different from the source disk project.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   CreateSnapshotRegionDiskRequest request =
       CreateSnapshotRegionDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setRequestId("requestId693933066")
           .setSnapshotResource(Snapshot.newBuilder().build())
           .build();
   ApiFuture<Operation> future = regionDisksClient.createSnapshotCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<CreateSnapshotRegionDiskRequest,Operation>

createSnapshotOperationCallable()

public final OperationCallable<CreateSnapshotRegionDiskRequest,Operation,Operation> createSnapshotOperationCallable()

Creates a snapshot of a specified persistent disk. For regular snapshot creation, consider using snapshots.insert instead, as that method supports more features, such as creating snapshots in a project different from the source disk project.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   CreateSnapshotRegionDiskRequest request =
       CreateSnapshotRegionDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setRequestId("requestId693933066")
           .setSnapshotResource(Snapshot.newBuilder().build())
           .build();
   OperationFuture<Operation, Operation> future =
       regionDisksClient.createSnapshotOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<CreateSnapshotRegionDiskRequest,Operation,Operation>

deleteAsync(DeleteRegionDiskRequest request)

public final OperationFuture<Operation,Operation> deleteAsync(DeleteRegionDiskRequest request)

Deletes the specified regional persistent disk. Deleting a regional disk removes all the replicas of its data permanently and is irreversible. However, deleting a disk does not delete any snapshots previously made from the disk. You must separately delete snapshots.

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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   DeleteRegionDiskRequest request =
       DeleteRegionDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setRequestId("requestId693933066")
           .build();
   Operation response = regionDisksClient.deleteAsync(request).get();
 }
 
Parameter
NameDescription
requestDeleteRegionDiskRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

deleteAsync(String project, String region, String disk)

public final OperationFuture<Operation,Operation> deleteAsync(String project, String region, String disk)

Deletes the specified regional persistent disk. Deleting a regional disk removes all the replicas of its data permanently and is irreversible. However, deleting a disk does not delete any snapshots previously made from the disk. You must separately delete snapshots.

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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   String project = "project-309310695";
   String region = "region-934795532";
   String disk = "disk3083677";
   Operation response = regionDisksClient.deleteAsync(project, region, disk).get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

regionString

Name of the region for this request.

diskString

Name of the regional persistent disk to delete.

Returns
TypeDescription
OperationFuture<Operation,Operation>

deleteCallable()

public final UnaryCallable<DeleteRegionDiskRequest,Operation> deleteCallable()

Deletes the specified regional persistent disk. Deleting a regional disk removes all the replicas of its data permanently and is irreversible. However, deleting a disk does not delete any snapshots previously made from the disk. You must separately delete snapshots.

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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   DeleteRegionDiskRequest request =
       DeleteRegionDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future = regionDisksClient.deleteCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<DeleteRegionDiskRequest,Operation>

deleteOperationCallable()

public final OperationCallable<DeleteRegionDiskRequest,Operation,Operation> deleteOperationCallable()

Deletes the specified regional persistent disk. Deleting a regional disk removes all the replicas of its data permanently and is irreversible. However, deleting a disk does not delete any snapshots previously made from the disk. You must separately delete snapshots.

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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   DeleteRegionDiskRequest request =
       DeleteRegionDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Operation, Operation> future =
       regionDisksClient.deleteOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<DeleteRegionDiskRequest,Operation,Operation>

get(GetRegionDiskRequest request)

public final Disk get(GetRegionDiskRequest request)

Returns a specified regional persistent disk.

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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   GetRegionDiskRequest request =
       GetRegionDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .build();
   Disk response = regionDisksClient.get(request);
 }
 
Parameter
NameDescription
requestGetRegionDiskRequest

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

Returns
TypeDescription
Disk

get(String project, String region, String disk)

public final Disk get(String project, String region, String disk)

Returns a specified regional persistent disk.

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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   String project = "project-309310695";
   String region = "region-934795532";
   String disk = "disk3083677";
   Disk response = regionDisksClient.get(project, region, disk);
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

regionString

Name of the region for this request.

diskString

Name of the regional persistent disk to return.

Returns
TypeDescription
Disk

getCallable()

public final UnaryCallable<GetRegionDiskRequest,Disk> getCallable()

Returns a specified regional persistent disk.

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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   GetRegionDiskRequest request =
       GetRegionDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .build();
   ApiFuture<Disk> future = regionDisksClient.getCallable().futureCall(request);
   // Do something.
   Disk response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetRegionDiskRequest,Disk>

getIamPolicy(GetIamPolicyRegionDiskRequest request)

public final Policy getIamPolicy(GetIamPolicyRegionDiskRequest request)

Gets the access control policy for a resource. May be empty if no such policy or resource exists.

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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   GetIamPolicyRegionDiskRequest request =
       GetIamPolicyRegionDiskRequest.newBuilder()
           .setOptionsRequestedPolicyVersion(-574521795)
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setResource("resource-341064690")
           .build();
   Policy response = regionDisksClient.getIamPolicy(request);
 }
 
Parameter
NameDescription
requestGetIamPolicyRegionDiskRequest

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

Returns
TypeDescription
Policy

getIamPolicy(String project, String region, String resource)

public final Policy getIamPolicy(String project, String region, String resource)

Gets the access control policy for a resource. May be empty if no such policy or resource exists.

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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   String project = "project-309310695";
   String region = "region-934795532";
   String resource = "resource-341064690";
   Policy response = regionDisksClient.getIamPolicy(project, region, resource);
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

regionString

The name of the region for this request.

resourceString

Name or id of the resource for this request.

Returns
TypeDescription
Policy

getIamPolicyCallable()

public final UnaryCallable<GetIamPolicyRegionDiskRequest,Policy> getIamPolicyCallable()

Gets the access control policy for a resource. May be empty if no such policy or resource exists.

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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   GetIamPolicyRegionDiskRequest request =
       GetIamPolicyRegionDiskRequest.newBuilder()
           .setOptionsRequestedPolicyVersion(-574521795)
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setResource("resource-341064690")
           .build();
   ApiFuture<Policy> future = regionDisksClient.getIamPolicyCallable().futureCall(request);
   // Do something.
   Policy response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetIamPolicyRegionDiskRequest,Policy>

getSettings()

public final RegionDisksSettings getSettings()
Returns
TypeDescription
RegionDisksSettings

getStub()

public RegionDisksStub getStub()
Returns
TypeDescription
RegionDisksStub

insertAsync(InsertRegionDiskRequest request)

public final OperationFuture<Operation,Operation> insertAsync(InsertRegionDiskRequest request)

Creates a persistent regional disk in the specified project using the data included in the 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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   InsertRegionDiskRequest request =
       InsertRegionDiskRequest.newBuilder()
           .setDiskResource(Disk.newBuilder().build())
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setRequestId("requestId693933066")
           .setSourceImage("sourceImage-105174528")
           .build();
   Operation response = regionDisksClient.insertAsync(request).get();
 }
 
Parameter
NameDescription
requestInsertRegionDiskRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

insertAsync(String project, String region, Disk diskResource)

public final OperationFuture<Operation,Operation> insertAsync(String project, String region, Disk diskResource)

Creates a persistent regional disk in the specified project using the data included in the 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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   String project = "project-309310695";
   String region = "region-934795532";
   Disk diskResource = Disk.newBuilder().build();
   Operation response = regionDisksClient.insertAsync(project, region, diskResource).get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

regionString

Name of the region for this request.

diskResourceDisk

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

insertCallable()

public final UnaryCallable<InsertRegionDiskRequest,Operation> insertCallable()

Creates a persistent regional disk in the specified project using the data included in the 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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   InsertRegionDiskRequest request =
       InsertRegionDiskRequest.newBuilder()
           .setDiskResource(Disk.newBuilder().build())
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setRequestId("requestId693933066")
           .setSourceImage("sourceImage-105174528")
           .build();
   ApiFuture<Operation> future = regionDisksClient.insertCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<InsertRegionDiskRequest,Operation>

insertOperationCallable()

public final OperationCallable<InsertRegionDiskRequest,Operation,Operation> insertOperationCallable()

Creates a persistent regional disk in the specified project using the data included in the 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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   InsertRegionDiskRequest request =
       InsertRegionDiskRequest.newBuilder()
           .setDiskResource(Disk.newBuilder().build())
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setRequestId("requestId693933066")
           .setSourceImage("sourceImage-105174528")
           .build();
   OperationFuture<Operation, Operation> future =
       regionDisksClient.insertOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<InsertRegionDiskRequest,Operation,Operation>

isShutdown()

public boolean isShutdown()
Returns
TypeDescription
boolean

isTerminated()

public boolean isTerminated()
Returns
TypeDescription
boolean

list(ListRegionDisksRequest request)

public final RegionDisksClient.ListPagedResponse list(ListRegionDisksRequest request)

Retrieves the list of persistent disks contained within the specified region.

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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   ListRegionDisksRequest request =
       ListRegionDisksRequest.newBuilder()
           .setFilter("filter-1274492040")
           .setMaxResults(1128457243)
           .setOrderBy("orderBy-1207110587")
           .setPageToken("pageToken873572522")
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setReturnPartialSuccess(true)
           .build();
   for (Disk element : regionDisksClient.list(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestListRegionDisksRequest

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

Returns
TypeDescription
RegionDisksClient.ListPagedResponse

list(String project, String region)

public final RegionDisksClient.ListPagedResponse list(String project, String region)

Retrieves the list of persistent disks contained within the specified region.

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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   String project = "project-309310695";
   String region = "region-934795532";
   for (Disk element : regionDisksClient.list(project, region).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

regionString

Name of the region for this request.

Returns
TypeDescription
RegionDisksClient.ListPagedResponse

listCallable()

public final UnaryCallable<ListRegionDisksRequest,DiskList> listCallable()

Retrieves the list of persistent disks contained within the specified region.

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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   ListRegionDisksRequest request =
       ListRegionDisksRequest.newBuilder()
           .setFilter("filter-1274492040")
           .setMaxResults(1128457243)
           .setOrderBy("orderBy-1207110587")
           .setPageToken("pageToken873572522")
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setReturnPartialSuccess(true)
           .build();
   while (true) {
     DiskList response = regionDisksClient.listCallable().call(request);
     for (Disk element : response.getItemsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListRegionDisksRequest,DiskList>

listPagedCallable()

public final UnaryCallable<ListRegionDisksRequest,RegionDisksClient.ListPagedResponse> listPagedCallable()

Retrieves the list of persistent disks contained within the specified region.

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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   ListRegionDisksRequest request =
       ListRegionDisksRequest.newBuilder()
           .setFilter("filter-1274492040")
           .setMaxResults(1128457243)
           .setOrderBy("orderBy-1207110587")
           .setPageToken("pageToken873572522")
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setReturnPartialSuccess(true)
           .build();
   ApiFuture<Disk> future = regionDisksClient.listPagedCallable().futureCall(request);
   // Do something.
   for (Disk element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListRegionDisksRequest,ListPagedResponse>

removeResourcePoliciesAsync(RemoveResourcePoliciesRegionDiskRequest request)

public final OperationFuture<Operation,Operation> removeResourcePoliciesAsync(RemoveResourcePoliciesRegionDiskRequest request)

Removes resource policies from a regional disk.

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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   RemoveResourcePoliciesRegionDiskRequest request =
       RemoveResourcePoliciesRegionDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setRegionDisksRemoveResourcePoliciesRequestResource(
               RegionDisksRemoveResourcePoliciesRequest.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   Operation response = regionDisksClient.removeResourcePoliciesAsync(request).get();
 }
 
Parameter
NameDescription
requestRemoveResourcePoliciesRegionDiskRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

removeResourcePoliciesAsync(String project, String region, String disk, RegionDisksRemoveResourcePoliciesRequest regionDisksRemoveResourcePoliciesRequestResource)

public final OperationFuture<Operation,Operation> removeResourcePoliciesAsync(String project, String region, String disk, RegionDisksRemoveResourcePoliciesRequest regionDisksRemoveResourcePoliciesRequestResource)

Removes resource policies from a regional disk.

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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   String project = "project-309310695";
   String region = "region-934795532";
   String disk = "disk3083677";
   RegionDisksRemoveResourcePoliciesRequest regionDisksRemoveResourcePoliciesRequestResource =
       RegionDisksRemoveResourcePoliciesRequest.newBuilder().build();
   Operation response =
       regionDisksClient
           .removeResourcePoliciesAsync(
               project, region, disk, regionDisksRemoveResourcePoliciesRequestResource)
           .get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

regionString

The name of the region for this request.

diskString

The disk name for this request.

regionDisksRemoveResourcePoliciesRequestResourceRegionDisksRemoveResourcePoliciesRequest

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

removeResourcePoliciesCallable()

public final UnaryCallable<RemoveResourcePoliciesRegionDiskRequest,Operation> removeResourcePoliciesCallable()

Removes resource policies from a regional disk.

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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   RemoveResourcePoliciesRegionDiskRequest request =
       RemoveResourcePoliciesRegionDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setRegionDisksRemoveResourcePoliciesRequestResource(
               RegionDisksRemoveResourcePoliciesRequest.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future =
       regionDisksClient.removeResourcePoliciesCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<RemoveResourcePoliciesRegionDiskRequest,Operation>

removeResourcePoliciesOperationCallable()

public final OperationCallable<RemoveResourcePoliciesRegionDiskRequest,Operation,Operation> removeResourcePoliciesOperationCallable()

Removes resource policies from a regional disk.

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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   RemoveResourcePoliciesRegionDiskRequest request =
       RemoveResourcePoliciesRegionDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setRegionDisksRemoveResourcePoliciesRequestResource(
               RegionDisksRemoveResourcePoliciesRequest.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Operation, Operation> future =
       regionDisksClient.removeResourcePoliciesOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<RemoveResourcePoliciesRegionDiskRequest,Operation,Operation>

resizeAsync(ResizeRegionDiskRequest request)

public final OperationFuture<Operation,Operation> resizeAsync(ResizeRegionDiskRequest request)

Resizes the specified regional persistent disk.

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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   ResizeRegionDiskRequest request =
       ResizeRegionDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setRegionDisksResizeRequestResource(RegionDisksResizeRequest.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   Operation response = regionDisksClient.resizeAsync(request).get();
 }
 
Parameter
NameDescription
requestResizeRegionDiskRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

resizeAsync(String project, String region, String disk, RegionDisksResizeRequest regionDisksResizeRequestResource)

public final OperationFuture<Operation,Operation> resizeAsync(String project, String region, String disk, RegionDisksResizeRequest regionDisksResizeRequestResource)

Resizes the specified regional persistent disk.

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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   String project = "project-309310695";
   String region = "region-934795532";
   String disk = "disk3083677";
   RegionDisksResizeRequest regionDisksResizeRequestResource =
       RegionDisksResizeRequest.newBuilder().build();
   Operation response =
       regionDisksClient
           .resizeAsync(project, region, disk, regionDisksResizeRequestResource)
           .get();
 }
 
Parameters
NameDescription
projectString

The project ID for this request.

regionString

Name of the region for this request.

diskString

Name of the regional persistent disk.

regionDisksResizeRequestResourceRegionDisksResizeRequest

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

resizeCallable()

public final UnaryCallable<ResizeRegionDiskRequest,Operation> resizeCallable()

Resizes the specified regional persistent disk.

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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   ResizeRegionDiskRequest request =
       ResizeRegionDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setRegionDisksResizeRequestResource(RegionDisksResizeRequest.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future = regionDisksClient.resizeCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<ResizeRegionDiskRequest,Operation>

resizeOperationCallable()

public final OperationCallable<ResizeRegionDiskRequest,Operation,Operation> resizeOperationCallable()

Resizes the specified regional persistent disk.

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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   ResizeRegionDiskRequest request =
       ResizeRegionDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setRegionDisksResizeRequestResource(RegionDisksResizeRequest.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Operation, Operation> future =
       regionDisksClient.resizeOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<ResizeRegionDiskRequest,Operation,Operation>

setIamPolicy(SetIamPolicyRegionDiskRequest request)

public final Policy setIamPolicy(SetIamPolicyRegionDiskRequest request)

Sets the access control policy on the specified resource. Replaces any existing policy.

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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   SetIamPolicyRegionDiskRequest request =
       SetIamPolicyRegionDiskRequest.newBuilder()
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setRegionSetPolicyRequestResource(RegionSetPolicyRequest.newBuilder().build())
           .setResource("resource-341064690")
           .build();
   Policy response = regionDisksClient.setIamPolicy(request);
 }
 
Parameter
NameDescription
requestSetIamPolicyRegionDiskRequest

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

Returns
TypeDescription
Policy

setIamPolicy(String project, String region, String resource, RegionSetPolicyRequest regionSetPolicyRequestResource)

public final Policy setIamPolicy(String project, String region, String resource, RegionSetPolicyRequest regionSetPolicyRequestResource)

Sets the access control policy on the specified resource. Replaces any existing policy.

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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   String project = "project-309310695";
   String region = "region-934795532";
   String resource = "resource-341064690";
   RegionSetPolicyRequest regionSetPolicyRequestResource =
       RegionSetPolicyRequest.newBuilder().build();
   Policy response =
       regionDisksClient.setIamPolicy(project, region, resource, regionSetPolicyRequestResource);
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

regionString

The name of the region for this request.

resourceString

Name or id of the resource for this request.

regionSetPolicyRequestResourceRegionSetPolicyRequest

The body resource for this request

Returns
TypeDescription
Policy

setIamPolicyCallable()

public final UnaryCallable<SetIamPolicyRegionDiskRequest,Policy> setIamPolicyCallable()

Sets the access control policy on the specified resource. Replaces any existing policy.

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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   SetIamPolicyRegionDiskRequest request =
       SetIamPolicyRegionDiskRequest.newBuilder()
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setRegionSetPolicyRequestResource(RegionSetPolicyRequest.newBuilder().build())
           .setResource("resource-341064690")
           .build();
   ApiFuture<Policy> future = regionDisksClient.setIamPolicyCallable().futureCall(request);
   // Do something.
   Policy response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<SetIamPolicyRegionDiskRequest,Policy>

setLabelsAsync(SetLabelsRegionDiskRequest request)

public final OperationFuture<Operation,Operation> setLabelsAsync(SetLabelsRegionDiskRequest request)

Sets the labels on the target regional disk.

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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   SetLabelsRegionDiskRequest request =
       SetLabelsRegionDiskRequest.newBuilder()
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setRegionSetLabelsRequestResource(RegionSetLabelsRequest.newBuilder().build())
           .setRequestId("requestId693933066")
           .setResource("resource-341064690")
           .build();
   Operation response = regionDisksClient.setLabelsAsync(request).get();
 }
 
Parameter
NameDescription
requestSetLabelsRegionDiskRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

setLabelsAsync(String project, String region, String resource, RegionSetLabelsRequest regionSetLabelsRequestResource)

public final OperationFuture<Operation,Operation> setLabelsAsync(String project, String region, String resource, RegionSetLabelsRequest regionSetLabelsRequestResource)

Sets the labels on the target regional disk.

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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   String project = "project-309310695";
   String region = "region-934795532";
   String resource = "resource-341064690";
   RegionSetLabelsRequest regionSetLabelsRequestResource =
       RegionSetLabelsRequest.newBuilder().build();
   Operation response =
       regionDisksClient
           .setLabelsAsync(project, region, resource, regionSetLabelsRequestResource)
           .get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

regionString

The region for this request.

resourceString

Name or id of the resource for this request.

regionSetLabelsRequestResourceRegionSetLabelsRequest

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

setLabelsCallable()

public final UnaryCallable<SetLabelsRegionDiskRequest,Operation> setLabelsCallable()

Sets the labels on the target regional disk.

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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   SetLabelsRegionDiskRequest request =
       SetLabelsRegionDiskRequest.newBuilder()
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setRegionSetLabelsRequestResource(RegionSetLabelsRequest.newBuilder().build())
           .setRequestId("requestId693933066")
           .setResource("resource-341064690")
           .build();
   ApiFuture<Operation> future = regionDisksClient.setLabelsCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<SetLabelsRegionDiskRequest,Operation>

setLabelsOperationCallable()

public final OperationCallable<SetLabelsRegionDiskRequest,Operation,Operation> setLabelsOperationCallable()

Sets the labels on the target regional disk.

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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   SetLabelsRegionDiskRequest request =
       SetLabelsRegionDiskRequest.newBuilder()
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setRegionSetLabelsRequestResource(RegionSetLabelsRequest.newBuilder().build())
           .setRequestId("requestId693933066")
           .setResource("resource-341064690")
           .build();
   OperationFuture<Operation, Operation> future =
       regionDisksClient.setLabelsOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<SetLabelsRegionDiskRequest,Operation,Operation>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

testIamPermissions(TestIamPermissionsRegionDiskRequest request)

public final TestPermissionsResponse testIamPermissions(TestIamPermissionsRegionDiskRequest request)

Returns permissions that a caller has on the specified resource.

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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   TestIamPermissionsRegionDiskRequest request =
       TestIamPermissionsRegionDiskRequest.newBuilder()
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setResource("resource-341064690")
           .setTestPermissionsRequestResource(TestPermissionsRequest.newBuilder().build())
           .build();
   TestPermissionsResponse response = regionDisksClient.testIamPermissions(request);
 }
 
Parameter
NameDescription
requestTestIamPermissionsRegionDiskRequest

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

Returns
TypeDescription
TestPermissionsResponse

testIamPermissions(String project, String region, String resource, TestPermissionsRequest testPermissionsRequestResource)

public final TestPermissionsResponse testIamPermissions(String project, String region, String resource, TestPermissionsRequest testPermissionsRequestResource)

Returns permissions that a caller has on the specified resource.

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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   String project = "project-309310695";
   String region = "region-934795532";
   String resource = "resource-341064690";
   TestPermissionsRequest testPermissionsRequestResource =
       TestPermissionsRequest.newBuilder().build();
   TestPermissionsResponse response =
       regionDisksClient.testIamPermissions(
           project, region, resource, testPermissionsRequestResource);
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

regionString

The name of the region for this request.

resourceString

Name or id of the resource for this request.

testPermissionsRequestResourceTestPermissionsRequest

The body resource for this request

Returns
TypeDescription
TestPermissionsResponse

testIamPermissionsCallable()

public final UnaryCallable<TestIamPermissionsRegionDiskRequest,TestPermissionsResponse> testIamPermissionsCallable()

Returns permissions that a caller has on the specified resource.

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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   TestIamPermissionsRegionDiskRequest request =
       TestIamPermissionsRegionDiskRequest.newBuilder()
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setResource("resource-341064690")
           .setTestPermissionsRequestResource(TestPermissionsRequest.newBuilder().build())
           .build();
   ApiFuture<TestPermissionsResponse> future =
       regionDisksClient.testIamPermissionsCallable().futureCall(request);
   // Do something.
   TestPermissionsResponse response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<TestIamPermissionsRegionDiskRequest,TestPermissionsResponse>

updateAsync(UpdateRegionDiskRequest request)

public final OperationFuture<Operation,Operation> updateAsync(UpdateRegionDiskRequest request)

Update the specified disk with the data included in the request. Update is performed only on selected fields included as part of update-mask. Only the following fields can be modified: user_license.

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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   UpdateRegionDiskRequest request =
       UpdateRegionDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setDiskResource(Disk.newBuilder().build())
           .setPaths("paths106438894")
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setRequestId("requestId693933066")
           .setUpdateMask("updateMask-296147115")
           .build();
   Operation response = regionDisksClient.updateAsync(request).get();
 }
 
Parameter
NameDescription
requestUpdateRegionDiskRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

updateAsync(String project, String region, String disk, Disk diskResource)

public final OperationFuture<Operation,Operation> updateAsync(String project, String region, String disk, Disk diskResource)

Update the specified disk with the data included in the request. Update is performed only on selected fields included as part of update-mask. Only the following fields can be modified: user_license.

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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   String project = "project-309310695";
   String region = "region-934795532";
   String disk = "disk3083677";
   Disk diskResource = Disk.newBuilder().build();
   Operation response = regionDisksClient.updateAsync(project, region, disk, diskResource).get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

regionString

The name of the region for this request.

diskString

The disk name for this request.

diskResourceDisk

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

updateCallable()

public final UnaryCallable<UpdateRegionDiskRequest,Operation> updateCallable()

Update the specified disk with the data included in the request. Update is performed only on selected fields included as part of update-mask. Only the following fields can be modified: user_license.

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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   UpdateRegionDiskRequest request =
       UpdateRegionDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setDiskResource(Disk.newBuilder().build())
           .setPaths("paths106438894")
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setRequestId("requestId693933066")
           .setUpdateMask("updateMask-296147115")
           .build();
   ApiFuture<Operation> future = regionDisksClient.updateCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<UpdateRegionDiskRequest,Operation>

updateOperationCallable()

public final OperationCallable<UpdateRegionDiskRequest,Operation,Operation> updateOperationCallable()

Update the specified disk with the data included in the request. Update is performed only on selected fields included as part of update-mask. Only the following fields can be modified: user_license.

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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
   UpdateRegionDiskRequest request =
       UpdateRegionDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setDiskResource(Disk.newBuilder().build())
           .setPaths("paths106438894")
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setRequestId("requestId693933066")
           .setUpdateMask("updateMask-296147115")
           .build();
   OperationFuture<Operation, Operation> future =
       regionDisksClient.updateOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<UpdateRegionDiskRequest,Operation,Operation>