Class DisksClient (1.45.0)

GitHub RepositoryProduct Reference

Service Description: The Disks 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 (DisksClient disksClient = DisksClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String disk = "disk3083677";
   Disk response = disksClient.get(project, zone, disk);
 }
 

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

Methods
MethodDescriptionMethod Variants

AddResourcePolicies

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

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

  • addResourcePoliciesAsync(AddResourcePoliciesDiskRequest request)

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

  • addResourcePoliciesAsync(String project, String zone, String disk, DisksAddResourcePoliciesRequest disksAddResourcePoliciesRequestResource)

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

  • addResourcePoliciesOperationCallable()

  • addResourcePoliciesCallable()

AggregatedList

Retrieves an aggregated list of persistent disks.

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

  • aggregatedList(AggregatedListDisksRequest request)

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

  • aggregatedList(String project)

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

  • aggregatedListPagedCallable()

  • aggregatedListCallable()

BulkInsert

Bulk create a set of disks.

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

  • bulkInsertAsync(BulkInsertDiskRequest request)

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

  • bulkInsertAsync(String project, String zone, BulkInsertDiskResource bulkInsertDiskResourceResource)

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

  • bulkInsertOperationCallable()

  • bulkInsertCallable()

CreateSnapshot

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.

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

  • createSnapshotAsync(CreateSnapshotDiskRequest request)

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

  • createSnapshotAsync(String project, String zone, String disk, Snapshot snapshotResource)

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

  • createSnapshotOperationCallable()

  • createSnapshotCallable()

Delete

Deletes the specified persistent disk. Deleting a disk removes 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.

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

  • deleteAsync(DeleteDiskRequest request)

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

  • deleteAsync(String project, String zone, String disk)

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

  • deleteOperationCallable()

  • deleteCallable()

Get

Returns the specified persistent disk.

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

  • get(GetDiskRequest 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 zone, String disk)

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

  • getCallable()

GetIamPolicy

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

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

  • getIamPolicy(GetIamPolicyDiskRequest request)

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

  • getIamPolicy(String project, String zone, String resource)

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

  • getIamPolicyCallable()

Insert

Creates a persistent disk in the specified project using the data in the request. You can create a disk from a source (sourceImage, sourceSnapshot, or sourceDisk) or create an empty 500 GB data disk by omitting all properties. You can also create a disk that is larger than the default size by specifying the sizeGb property.

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

  • insertAsync(InsertDiskRequest request)

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

  • insertAsync(String project, String zone, Disk diskResource)

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

  • insertOperationCallable()

  • insertCallable()

List

Retrieves a list of persistent disks contained within the specified zone.

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

  • list(ListDisksRequest request)

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

  • list(String project, String zone)

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

  • listPagedCallable()

  • listCallable()

RemoveResourcePolicies

Removes resource policies from a disk.

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

  • removeResourcePoliciesAsync(RemoveResourcePoliciesDiskRequest request)

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

  • removeResourcePoliciesAsync(String project, String zone, String disk, DisksRemoveResourcePoliciesRequest disksRemoveResourcePoliciesRequestResource)

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

  • removeResourcePoliciesOperationCallable()

  • removeResourcePoliciesCallable()

Resize

Resizes the specified persistent disk. You can only increase the size of the disk.

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

  • resizeAsync(ResizeDiskRequest request)

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

  • resizeAsync(String project, String zone, String disk, DisksResizeRequest disksResizeRequestResource)

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

  • resizeOperationCallable()

  • resizeCallable()

SetIamPolicy

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

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

  • setIamPolicy(SetIamPolicyDiskRequest request)

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

  • setIamPolicy(String project, String zone, String resource, ZoneSetPolicyRequest zoneSetPolicyRequestResource)

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

  • setIamPolicyCallable()

SetLabels

Sets the labels on a disk. To learn more about labels, read the Labeling Resources documentation.

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

  • setLabelsAsync(SetLabelsDiskRequest request)

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

  • setLabelsAsync(String project, String zone, String resource, ZoneSetLabelsRequest zoneSetLabelsRequestResource)

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

  • setLabelsOperationCallable()

  • setLabelsCallable()

StartAsyncReplication

Starts asynchronous replication. Must be invoked on the primary disk.

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

  • startAsyncReplicationAsync(StartAsyncReplicationDiskRequest request)

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

  • startAsyncReplicationAsync(String project, String zone, String disk, DisksStartAsyncReplicationRequest disksStartAsyncReplicationRequestResource)

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

  • startAsyncReplicationOperationCallable()

  • startAsyncReplicationCallable()

StopAsyncReplication

Stops asynchronous replication. Can be invoked either on the primary or on the secondary disk.

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

  • stopAsyncReplicationAsync(StopAsyncReplicationDiskRequest request)

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

  • stopAsyncReplicationAsync(String project, String zone, String disk)

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

  • stopAsyncReplicationOperationCallable()

  • stopAsyncReplicationCallable()

StopGroupAsyncReplication

Stops asynchronous replication for a consistency group of disks. Can be invoked either in the primary or secondary scope.

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

  • stopGroupAsyncReplicationAsync(StopGroupAsyncReplicationDiskRequest request)

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

  • stopGroupAsyncReplicationAsync(String project, String zone, DisksStopGroupAsyncReplicationResource disksStopGroupAsyncReplicationResourceResource)

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

  • stopGroupAsyncReplicationOperationCallable()

  • stopGroupAsyncReplicationCallable()

TestIamPermissions

Returns permissions that a caller has on the specified resource.

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

  • testIamPermissions(TestIamPermissionsDiskRequest request)

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

  • testIamPermissions(String project, String zone, String resource, TestPermissionsRequest testPermissionsRequestResource)

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

  • testIamPermissionsCallable()

Update

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

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

  • updateAsync(UpdateDiskRequest request)

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

  • updateAsync(String project, String zone, String disk, Disk diskResource)

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

  • updateOperationCallable()

  • updateCallable()

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 DisksSettings 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
 DisksSettings disksSettings =
     DisksSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 DisksClient disksClient = DisksClient.create(disksSettings);
 

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
 DisksSettings disksSettings = DisksSettings.newBuilder().setEndpoint(myEndpoint).build();
 DisksClient disksClient = DisksClient.create(disksSettings);
 

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

Inheritance

java.lang.Object > DisksClient

Static Methods

create()

public static final DisksClient create()

Constructs an instance of DisksClient with default settings.

Returns
TypeDescription
DisksClient
Exceptions
TypeDescription
IOException

create(DisksSettings settings)

public static final DisksClient create(DisksSettings settings)

Constructs an instance of DisksClient, 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
settingsDisksSettings
Returns
TypeDescription
DisksClient
Exceptions
TypeDescription
IOException

create(DisksStub stub)

public static final DisksClient create(DisksStub stub)

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

Parameter
NameDescription
stubDisksStub
Returns
TypeDescription
DisksClient

Constructors

DisksClient(DisksSettings settings)

protected DisksClient(DisksSettings settings)

Constructs an instance of DisksClient, 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
settingsDisksSettings

DisksClient(DisksStub stub)

protected DisksClient(DisksStub stub)
Parameter
NameDescription
stubDisksStub

Methods

addResourcePoliciesAsync(AddResourcePoliciesDiskRequest request)

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

Adds existing resource policies to a 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 (DisksClient disksClient = DisksClient.create()) {
   AddResourcePoliciesDiskRequest request =
       AddResourcePoliciesDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setDisksAddResourcePoliciesRequestResource(
               DisksAddResourcePoliciesRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   Operation response = disksClient.addResourcePoliciesAsync(request).get();
 }
 
Parameter
NameDescription
requestAddResourcePoliciesDiskRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

addResourcePoliciesAsync(String project, String zone, String disk, DisksAddResourcePoliciesRequest disksAddResourcePoliciesRequestResource)

public final OperationFuture<Operation,Operation> addResourcePoliciesAsync(String project, String zone, String disk, DisksAddResourcePoliciesRequest disksAddResourcePoliciesRequestResource)

Adds existing resource policies to a 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 (DisksClient disksClient = DisksClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String disk = "disk3083677";
   DisksAddResourcePoliciesRequest disksAddResourcePoliciesRequestResource =
       DisksAddResourcePoliciesRequest.newBuilder().build();
   Operation response =
       disksClient
           .addResourcePoliciesAsync(
               project, zone, disk, disksAddResourcePoliciesRequestResource)
           .get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

diskString

The disk name for this request.

disksAddResourcePoliciesRequestResourceDisksAddResourcePoliciesRequest

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

addResourcePoliciesCallable()

public final UnaryCallable<AddResourcePoliciesDiskRequest,Operation> addResourcePoliciesCallable()

Adds existing resource policies to a 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 (DisksClient disksClient = DisksClient.create()) {
   AddResourcePoliciesDiskRequest request =
       AddResourcePoliciesDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setDisksAddResourcePoliciesRequestResource(
               DisksAddResourcePoliciesRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future = disksClient.addResourcePoliciesCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<AddResourcePoliciesDiskRequest,Operation>

addResourcePoliciesOperationCallable()

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

Adds existing resource policies to a 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 (DisksClient disksClient = DisksClient.create()) {
   AddResourcePoliciesDiskRequest request =
       AddResourcePoliciesDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setDisksAddResourcePoliciesRequestResource(
               DisksAddResourcePoliciesRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       disksClient.addResourcePoliciesOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<AddResourcePoliciesDiskRequest,Operation,Operation>

aggregatedList(AggregatedListDisksRequest request)

public final DisksClient.AggregatedListPagedResponse aggregatedList(AggregatedListDisksRequest request)

Retrieves an aggregated list of persistent disks.

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 (DisksClient disksClient = DisksClient.create()) {
   AggregatedListDisksRequest request =
       AggregatedListDisksRequest.newBuilder()
           .setFilter("filter-1274492040")
           .setIncludeAllScopes(true)
           .setMaxResults(1128457243)
           .setOrderBy("orderBy-1207110587")
           .setPageToken("pageToken873572522")
           .setProject("project-309310695")
           .setReturnPartialSuccess(true)
           .setServiceProjectNumber(-1293855239)
           .build();
   for (Map.Entry<String, DisksScopedList> element :
       disksClient.aggregatedList(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestAggregatedListDisksRequest

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

Returns
TypeDescription
DisksClient.AggregatedListPagedResponse

aggregatedList(String project)

public final DisksClient.AggregatedListPagedResponse aggregatedList(String project)

Retrieves an aggregated list of persistent disks.

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 (DisksClient disksClient = DisksClient.create()) {
   String project = "project-309310695";
   for (Map.Entry<String, DisksScopedList> element :
       disksClient.aggregatedList(project).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
projectString

Project ID for this request.

Returns
TypeDescription
DisksClient.AggregatedListPagedResponse

aggregatedListCallable()

public final UnaryCallable<AggregatedListDisksRequest,DiskAggregatedList> aggregatedListCallable()

Retrieves an aggregated list of persistent disks.

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 (DisksClient disksClient = DisksClient.create()) {
   AggregatedListDisksRequest request =
       AggregatedListDisksRequest.newBuilder()
           .setFilter("filter-1274492040")
           .setIncludeAllScopes(true)
           .setMaxResults(1128457243)
           .setOrderBy("orderBy-1207110587")
           .setPageToken("pageToken873572522")
           .setProject("project-309310695")
           .setReturnPartialSuccess(true)
           .setServiceProjectNumber(-1293855239)
           .build();
   while (true) {
     DiskAggregatedList response = disksClient.aggregatedListCallable().call(request);
     for (Map.Entry<String, DisksScopedList> element : response.getItemsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<AggregatedListDisksRequest,DiskAggregatedList>

aggregatedListPagedCallable()

public final UnaryCallable<AggregatedListDisksRequest,DisksClient.AggregatedListPagedResponse> aggregatedListPagedCallable()

Retrieves an aggregated list of persistent disks.

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 (DisksClient disksClient = DisksClient.create()) {
   AggregatedListDisksRequest request =
       AggregatedListDisksRequest.newBuilder()
           .setFilter("filter-1274492040")
           .setIncludeAllScopes(true)
           .setMaxResults(1128457243)
           .setOrderBy("orderBy-1207110587")
           .setPageToken("pageToken873572522")
           .setProject("project-309310695")
           .setReturnPartialSuccess(true)
           .setServiceProjectNumber(-1293855239)
           .build();
   ApiFuture<Map.Entry<String, DisksScopedList>> future =
       disksClient.aggregatedListPagedCallable().futureCall(request);
   // Do something.
   for (Map.Entry<String, DisksScopedList> element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<AggregatedListDisksRequest,AggregatedListPagedResponse>

awaitTermination(long duration, TimeUnit unit)

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

bulkInsertAsync(BulkInsertDiskRequest request)

public final OperationFuture<Operation,Operation> bulkInsertAsync(BulkInsertDiskRequest request)

Bulk create a set of disks.

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 (DisksClient disksClient = DisksClient.create()) {
   BulkInsertDiskRequest request =
       BulkInsertDiskRequest.newBuilder()
           .setBulkInsertDiskResourceResource(BulkInsertDiskResource.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   Operation response = disksClient.bulkInsertAsync(request).get();
 }
 
Parameter
NameDescription
requestBulkInsertDiskRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

bulkInsertAsync(String project, String zone, BulkInsertDiskResource bulkInsertDiskResourceResource)

public final OperationFuture<Operation,Operation> bulkInsertAsync(String project, String zone, BulkInsertDiskResource bulkInsertDiskResourceResource)

Bulk create a set of disks.

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 (DisksClient disksClient = DisksClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   BulkInsertDiskResource bulkInsertDiskResourceResource =
       BulkInsertDiskResource.newBuilder().build();
   Operation response =
       disksClient.bulkInsertAsync(project, zone, bulkInsertDiskResourceResource).get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

bulkInsertDiskResourceResourceBulkInsertDiskResource

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

bulkInsertCallable()

public final UnaryCallable<BulkInsertDiskRequest,Operation> bulkInsertCallable()

Bulk create a set of disks.

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 (DisksClient disksClient = DisksClient.create()) {
   BulkInsertDiskRequest request =
       BulkInsertDiskRequest.newBuilder()
           .setBulkInsertDiskResourceResource(BulkInsertDiskResource.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future = disksClient.bulkInsertCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<BulkInsertDiskRequest,Operation>

bulkInsertOperationCallable()

public final OperationCallable<BulkInsertDiskRequest,Operation,Operation> bulkInsertOperationCallable()

Bulk create a set of disks.

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 (DisksClient disksClient = DisksClient.create()) {
   BulkInsertDiskRequest request =
       BulkInsertDiskRequest.newBuilder()
           .setBulkInsertDiskResourceResource(BulkInsertDiskResource.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       disksClient.bulkInsertOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<BulkInsertDiskRequest,Operation,Operation>

close()

public final void close()

createSnapshotAsync(CreateSnapshotDiskRequest request)

public final OperationFuture<Operation,Operation> createSnapshotAsync(CreateSnapshotDiskRequest 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 (DisksClient disksClient = DisksClient.create()) {
   CreateSnapshotDiskRequest request =
       CreateSnapshotDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setGuestFlush(true)
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setSnapshotResource(Snapshot.newBuilder().build())
           .setZone("zone3744684")
           .build();
   Operation response = disksClient.createSnapshotAsync(request).get();
 }
 
Parameter
NameDescription
requestCreateSnapshotDiskRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

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

public final OperationFuture<Operation,Operation> createSnapshotAsync(String project, String zone, 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 (DisksClient disksClient = DisksClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String disk = "disk3083677";
   Snapshot snapshotResource = Snapshot.newBuilder().build();
   Operation response =
       disksClient.createSnapshotAsync(project, zone, disk, snapshotResource).get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

diskString

Name of the persistent disk to snapshot.

snapshotResourceSnapshot

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

createSnapshotCallable()

public final UnaryCallable<CreateSnapshotDiskRequest,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 (DisksClient disksClient = DisksClient.create()) {
   CreateSnapshotDiskRequest request =
       CreateSnapshotDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setGuestFlush(true)
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setSnapshotResource(Snapshot.newBuilder().build())
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future = disksClient.createSnapshotCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<CreateSnapshotDiskRequest,Operation>

createSnapshotOperationCallable()

public final OperationCallable<CreateSnapshotDiskRequest,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 (DisksClient disksClient = DisksClient.create()) {
   CreateSnapshotDiskRequest request =
       CreateSnapshotDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setGuestFlush(true)
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setSnapshotResource(Snapshot.newBuilder().build())
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       disksClient.createSnapshotOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<CreateSnapshotDiskRequest,Operation,Operation>

deleteAsync(DeleteDiskRequest request)

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

Deletes the specified persistent disk. Deleting a disk removes 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 (DisksClient disksClient = DisksClient.create()) {
   DeleteDiskRequest request =
       DeleteDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   Operation response = disksClient.deleteAsync(request).get();
 }
 
Parameter
NameDescription
requestDeleteDiskRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

deleteAsync(String project, String zone, String disk)

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

Deletes the specified persistent disk. Deleting a disk removes 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 (DisksClient disksClient = DisksClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String disk = "disk3083677";
   Operation response = disksClient.deleteAsync(project, zone, disk).get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

diskString

Name of the persistent disk to delete.

Returns
TypeDescription
OperationFuture<Operation,Operation>

deleteCallable()

public final UnaryCallable<DeleteDiskRequest,Operation> deleteCallable()

Deletes the specified persistent disk. Deleting a disk removes 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 (DisksClient disksClient = DisksClient.create()) {
   DeleteDiskRequest request =
       DeleteDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future = disksClient.deleteCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<DeleteDiskRequest,Operation>

deleteOperationCallable()

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

Deletes the specified persistent disk. Deleting a disk removes 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 (DisksClient disksClient = DisksClient.create()) {
   DeleteDiskRequest request =
       DeleteDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       disksClient.deleteOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<DeleteDiskRequest,Operation,Operation>

get(GetDiskRequest request)

public final Disk get(GetDiskRequest request)

Returns the specified 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 (DisksClient disksClient = DisksClient.create()) {
   GetDiskRequest request =
       GetDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setProject("project-309310695")
           .setZone("zone3744684")
           .build();
   Disk response = disksClient.get(request);
 }
 
Parameter
NameDescription
requestGetDiskRequest

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

Returns
TypeDescription
Disk

get(String project, String zone, String disk)

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

Returns the specified 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 (DisksClient disksClient = DisksClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String disk = "disk3083677";
   Disk response = disksClient.get(project, zone, disk);
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

diskString

Name of the persistent disk to return.

Returns
TypeDescription
Disk

getCallable()

public final UnaryCallable<GetDiskRequest,Disk> getCallable()

Returns the specified 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 (DisksClient disksClient = DisksClient.create()) {
   GetDiskRequest request =
       GetDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setProject("project-309310695")
           .setZone("zone3744684")
           .build();
   ApiFuture<Disk> future = disksClient.getCallable().futureCall(request);
   // Do something.
   Disk response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetDiskRequest,Disk>

getIamPolicy(GetIamPolicyDiskRequest request)

public final Policy getIamPolicy(GetIamPolicyDiskRequest 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 (DisksClient disksClient = DisksClient.create()) {
   GetIamPolicyDiskRequest request =
       GetIamPolicyDiskRequest.newBuilder()
           .setOptionsRequestedPolicyVersion(-574521795)
           .setProject("project-309310695")
           .setResource("resource-341064690")
           .setZone("zone3744684")
           .build();
   Policy response = disksClient.getIamPolicy(request);
 }
 
Parameter
NameDescription
requestGetIamPolicyDiskRequest

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

Returns
TypeDescription
Policy

getIamPolicy(String project, String zone, String resource)

public final Policy getIamPolicy(String project, String zone, 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 (DisksClient disksClient = DisksClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String resource = "resource-341064690";
   Policy response = disksClient.getIamPolicy(project, zone, resource);
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

resourceString

Name or id of the resource for this request.

Returns
TypeDescription
Policy

getIamPolicyCallable()

public final UnaryCallable<GetIamPolicyDiskRequest,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 (DisksClient disksClient = DisksClient.create()) {
   GetIamPolicyDiskRequest request =
       GetIamPolicyDiskRequest.newBuilder()
           .setOptionsRequestedPolicyVersion(-574521795)
           .setProject("project-309310695")
           .setResource("resource-341064690")
           .setZone("zone3744684")
           .build();
   ApiFuture<Policy> future = disksClient.getIamPolicyCallable().futureCall(request);
   // Do something.
   Policy response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetIamPolicyDiskRequest,Policy>

getSettings()

public final DisksSettings getSettings()
Returns
TypeDescription
DisksSettings

getStub()

public DisksStub getStub()
Returns
TypeDescription
DisksStub

insertAsync(InsertDiskRequest request)

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

Creates a persistent disk in the specified project using the data in the request. You can create a disk from a source (sourceImage, sourceSnapshot, or sourceDisk) or create an empty 500 GB data disk by omitting all properties. You can also create a disk that is larger than the default size by specifying the sizeGb property.

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 (DisksClient disksClient = DisksClient.create()) {
   InsertDiskRequest request =
       InsertDiskRequest.newBuilder()
           .setDiskResource(Disk.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setSourceImage("sourceImage-105174528")
           .setZone("zone3744684")
           .build();
   Operation response = disksClient.insertAsync(request).get();
 }
 
Parameter
NameDescription
requestInsertDiskRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

insertAsync(String project, String zone, Disk diskResource)

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

Creates a persistent disk in the specified project using the data in the request. You can create a disk from a source (sourceImage, sourceSnapshot, or sourceDisk) or create an empty 500 GB data disk by omitting all properties. You can also create a disk that is larger than the default size by specifying the sizeGb property.

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 (DisksClient disksClient = DisksClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   Disk diskResource = Disk.newBuilder().build();
   Operation response = disksClient.insertAsync(project, zone, diskResource).get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

diskResourceDisk

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

insertCallable()

public final UnaryCallable<InsertDiskRequest,Operation> insertCallable()

Creates a persistent disk in the specified project using the data in the request. You can create a disk from a source (sourceImage, sourceSnapshot, or sourceDisk) or create an empty 500 GB data disk by omitting all properties. You can also create a disk that is larger than the default size by specifying the sizeGb property.

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 (DisksClient disksClient = DisksClient.create()) {
   InsertDiskRequest request =
       InsertDiskRequest.newBuilder()
           .setDiskResource(Disk.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setSourceImage("sourceImage-105174528")
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future = disksClient.insertCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<InsertDiskRequest,Operation>

insertOperationCallable()

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

Creates a persistent disk in the specified project using the data in the request. You can create a disk from a source (sourceImage, sourceSnapshot, or sourceDisk) or create an empty 500 GB data disk by omitting all properties. You can also create a disk that is larger than the default size by specifying the sizeGb property.

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 (DisksClient disksClient = DisksClient.create()) {
   InsertDiskRequest request =
       InsertDiskRequest.newBuilder()
           .setDiskResource(Disk.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setSourceImage("sourceImage-105174528")
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       disksClient.insertOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<InsertDiskRequest,Operation,Operation>

isShutdown()

public boolean isShutdown()
Returns
TypeDescription
boolean

isTerminated()

public boolean isTerminated()
Returns
TypeDescription
boolean

list(ListDisksRequest request)

public final DisksClient.ListPagedResponse list(ListDisksRequest request)

Retrieves a list of persistent disks contained within the specified zone.

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 (DisksClient disksClient = DisksClient.create()) {
   ListDisksRequest request =
       ListDisksRequest.newBuilder()
           .setFilter("filter-1274492040")
           .setMaxResults(1128457243)
           .setOrderBy("orderBy-1207110587")
           .setPageToken("pageToken873572522")
           .setProject("project-309310695")
           .setReturnPartialSuccess(true)
           .setZone("zone3744684")
           .build();
   for (Disk element : disksClient.list(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestListDisksRequest

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

Returns
TypeDescription
DisksClient.ListPagedResponse

list(String project, String zone)

public final DisksClient.ListPagedResponse list(String project, String zone)

Retrieves a list of persistent disks contained within the specified zone.

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

Project ID for this request.

zoneString

The name of the zone for this request.

Returns
TypeDescription
DisksClient.ListPagedResponse

listCallable()

public final UnaryCallable<ListDisksRequest,DiskList> listCallable()

Retrieves a list of persistent disks contained within the specified zone.

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 (DisksClient disksClient = DisksClient.create()) {
   ListDisksRequest request =
       ListDisksRequest.newBuilder()
           .setFilter("filter-1274492040")
           .setMaxResults(1128457243)
           .setOrderBy("orderBy-1207110587")
           .setPageToken("pageToken873572522")
           .setProject("project-309310695")
           .setReturnPartialSuccess(true)
           .setZone("zone3744684")
           .build();
   while (true) {
     DiskList response = disksClient.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<ListDisksRequest,DiskList>

listPagedCallable()

public final UnaryCallable<ListDisksRequest,DisksClient.ListPagedResponse> listPagedCallable()

Retrieves a list of persistent disks contained within the specified zone.

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

removeResourcePoliciesAsync(RemoveResourcePoliciesDiskRequest request)

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

Removes resource policies from a 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 (DisksClient disksClient = DisksClient.create()) {
   RemoveResourcePoliciesDiskRequest request =
       RemoveResourcePoliciesDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setDisksRemoveResourcePoliciesRequestResource(
               DisksRemoveResourcePoliciesRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   Operation response = disksClient.removeResourcePoliciesAsync(request).get();
 }
 
Parameter
NameDescription
requestRemoveResourcePoliciesDiskRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

removeResourcePoliciesAsync(String project, String zone, String disk, DisksRemoveResourcePoliciesRequest disksRemoveResourcePoliciesRequestResource)

public final OperationFuture<Operation,Operation> removeResourcePoliciesAsync(String project, String zone, String disk, DisksRemoveResourcePoliciesRequest disksRemoveResourcePoliciesRequestResource)

Removes resource policies from a 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 (DisksClient disksClient = DisksClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String disk = "disk3083677";
   DisksRemoveResourcePoliciesRequest disksRemoveResourcePoliciesRequestResource =
       DisksRemoveResourcePoliciesRequest.newBuilder().build();
   Operation response =
       disksClient
           .removeResourcePoliciesAsync(
               project, zone, disk, disksRemoveResourcePoliciesRequestResource)
           .get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

diskString

The disk name for this request.

disksRemoveResourcePoliciesRequestResourceDisksRemoveResourcePoliciesRequest

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

removeResourcePoliciesCallable()

public final UnaryCallable<RemoveResourcePoliciesDiskRequest,Operation> removeResourcePoliciesCallable()

Removes resource policies from a 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 (DisksClient disksClient = DisksClient.create()) {
   RemoveResourcePoliciesDiskRequest request =
       RemoveResourcePoliciesDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setDisksRemoveResourcePoliciesRequestResource(
               DisksRemoveResourcePoliciesRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future =
       disksClient.removeResourcePoliciesCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<RemoveResourcePoliciesDiskRequest,Operation>

removeResourcePoliciesOperationCallable()

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

Removes resource policies from a 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 (DisksClient disksClient = DisksClient.create()) {
   RemoveResourcePoliciesDiskRequest request =
       RemoveResourcePoliciesDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setDisksRemoveResourcePoliciesRequestResource(
               DisksRemoveResourcePoliciesRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       disksClient.removeResourcePoliciesOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<RemoveResourcePoliciesDiskRequest,Operation,Operation>

resizeAsync(ResizeDiskRequest request)

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

Resizes the specified persistent disk. You can only increase the size of the 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 (DisksClient disksClient = DisksClient.create()) {
   ResizeDiskRequest request =
       ResizeDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setDisksResizeRequestResource(DisksResizeRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   Operation response = disksClient.resizeAsync(request).get();
 }
 
Parameter
NameDescription
requestResizeDiskRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

resizeAsync(String project, String zone, String disk, DisksResizeRequest disksResizeRequestResource)

public final OperationFuture<Operation,Operation> resizeAsync(String project, String zone, String disk, DisksResizeRequest disksResizeRequestResource)

Resizes the specified persistent disk. You can only increase the size of the 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 (DisksClient disksClient = DisksClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String disk = "disk3083677";
   DisksResizeRequest disksResizeRequestResource = DisksResizeRequest.newBuilder().build();
   Operation response =
       disksClient.resizeAsync(project, zone, disk, disksResizeRequestResource).get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

diskString

The name of the persistent disk.

disksResizeRequestResourceDisksResizeRequest

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

resizeCallable()

public final UnaryCallable<ResizeDiskRequest,Operation> resizeCallable()

Resizes the specified persistent disk. You can only increase the size of the 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 (DisksClient disksClient = DisksClient.create()) {
   ResizeDiskRequest request =
       ResizeDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setDisksResizeRequestResource(DisksResizeRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future = disksClient.resizeCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<ResizeDiskRequest,Operation>

resizeOperationCallable()

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

Resizes the specified persistent disk. You can only increase the size of the 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 (DisksClient disksClient = DisksClient.create()) {
   ResizeDiskRequest request =
       ResizeDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setDisksResizeRequestResource(DisksResizeRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       disksClient.resizeOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<ResizeDiskRequest,Operation,Operation>

setIamPolicy(SetIamPolicyDiskRequest request)

public final Policy setIamPolicy(SetIamPolicyDiskRequest 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 (DisksClient disksClient = DisksClient.create()) {
   SetIamPolicyDiskRequest request =
       SetIamPolicyDiskRequest.newBuilder()
           .setProject("project-309310695")
           .setResource("resource-341064690")
           .setZone("zone3744684")
           .setZoneSetPolicyRequestResource(ZoneSetPolicyRequest.newBuilder().build())
           .build();
   Policy response = disksClient.setIamPolicy(request);
 }
 
Parameter
NameDescription
requestSetIamPolicyDiskRequest

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

Returns
TypeDescription
Policy

setIamPolicy(String project, String zone, String resource, ZoneSetPolicyRequest zoneSetPolicyRequestResource)

public final Policy setIamPolicy(String project, String zone, String resource, ZoneSetPolicyRequest zoneSetPolicyRequestResource)

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 (DisksClient disksClient = DisksClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String resource = "resource-341064690";
   ZoneSetPolicyRequest zoneSetPolicyRequestResource = ZoneSetPolicyRequest.newBuilder().build();
   Policy response =
       disksClient.setIamPolicy(project, zone, resource, zoneSetPolicyRequestResource);
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

resourceString

Name or id of the resource for this request.

zoneSetPolicyRequestResourceZoneSetPolicyRequest

The body resource for this request

Returns
TypeDescription
Policy

setIamPolicyCallable()

public final UnaryCallable<SetIamPolicyDiskRequest,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 (DisksClient disksClient = DisksClient.create()) {
   SetIamPolicyDiskRequest request =
       SetIamPolicyDiskRequest.newBuilder()
           .setProject("project-309310695")
           .setResource("resource-341064690")
           .setZone("zone3744684")
           .setZoneSetPolicyRequestResource(ZoneSetPolicyRequest.newBuilder().build())
           .build();
   ApiFuture<Policy> future = disksClient.setIamPolicyCallable().futureCall(request);
   // Do something.
   Policy response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<SetIamPolicyDiskRequest,Policy>

setLabelsAsync(SetLabelsDiskRequest request)

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

Sets the labels on a disk. To learn more about labels, read the Labeling Resources documentation.

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 (DisksClient disksClient = DisksClient.create()) {
   SetLabelsDiskRequest request =
       SetLabelsDiskRequest.newBuilder()
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setResource("resource-341064690")
           .setZone("zone3744684")
           .setZoneSetLabelsRequestResource(ZoneSetLabelsRequest.newBuilder().build())
           .build();
   Operation response = disksClient.setLabelsAsync(request).get();
 }
 
Parameter
NameDescription
requestSetLabelsDiskRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

setLabelsAsync(String project, String zone, String resource, ZoneSetLabelsRequest zoneSetLabelsRequestResource)

public final OperationFuture<Operation,Operation> setLabelsAsync(String project, String zone, String resource, ZoneSetLabelsRequest zoneSetLabelsRequestResource)

Sets the labels on a disk. To learn more about labels, read the Labeling Resources documentation.

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 (DisksClient disksClient = DisksClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String resource = "resource-341064690";
   ZoneSetLabelsRequest zoneSetLabelsRequestResource = ZoneSetLabelsRequest.newBuilder().build();
   Operation response =
       disksClient.setLabelsAsync(project, zone, resource, zoneSetLabelsRequestResource).get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

resourceString

Name or id of the resource for this request.

zoneSetLabelsRequestResourceZoneSetLabelsRequest

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

setLabelsCallable()

public final UnaryCallable<SetLabelsDiskRequest,Operation> setLabelsCallable()

Sets the labels on a disk. To learn more about labels, read the Labeling Resources documentation.

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 (DisksClient disksClient = DisksClient.create()) {
   SetLabelsDiskRequest request =
       SetLabelsDiskRequest.newBuilder()
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setResource("resource-341064690")
           .setZone("zone3744684")
           .setZoneSetLabelsRequestResource(ZoneSetLabelsRequest.newBuilder().build())
           .build();
   ApiFuture<Operation> future = disksClient.setLabelsCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<SetLabelsDiskRequest,Operation>

setLabelsOperationCallable()

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

Sets the labels on a disk. To learn more about labels, read the Labeling Resources documentation.

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 (DisksClient disksClient = DisksClient.create()) {
   SetLabelsDiskRequest request =
       SetLabelsDiskRequest.newBuilder()
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setResource("resource-341064690")
           .setZone("zone3744684")
           .setZoneSetLabelsRequestResource(ZoneSetLabelsRequest.newBuilder().build())
           .build();
   OperationFuture<Operation, Operation> future =
       disksClient.setLabelsOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<SetLabelsDiskRequest,Operation,Operation>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

startAsyncReplicationAsync(StartAsyncReplicationDiskRequest request)

public final OperationFuture<Operation,Operation> startAsyncReplicationAsync(StartAsyncReplicationDiskRequest request)

Starts asynchronous replication. Must be invoked on the primary 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 (DisksClient disksClient = DisksClient.create()) {
   StartAsyncReplicationDiskRequest request =
       StartAsyncReplicationDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setDisksStartAsyncReplicationRequestResource(
               DisksStartAsyncReplicationRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   Operation response = disksClient.startAsyncReplicationAsync(request).get();
 }
 
Parameter
NameDescription
requestStartAsyncReplicationDiskRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

startAsyncReplicationAsync(String project, String zone, String disk, DisksStartAsyncReplicationRequest disksStartAsyncReplicationRequestResource)

public final OperationFuture<Operation,Operation> startAsyncReplicationAsync(String project, String zone, String disk, DisksStartAsyncReplicationRequest disksStartAsyncReplicationRequestResource)

Starts asynchronous replication. Must be invoked on the primary 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 (DisksClient disksClient = DisksClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String disk = "disk3083677";
   DisksStartAsyncReplicationRequest disksStartAsyncReplicationRequestResource =
       DisksStartAsyncReplicationRequest.newBuilder().build();
   Operation response =
       disksClient
           .startAsyncReplicationAsync(
               project, zone, disk, disksStartAsyncReplicationRequestResource)
           .get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

diskString

The name of the persistent disk.

disksStartAsyncReplicationRequestResourceDisksStartAsyncReplicationRequest

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

startAsyncReplicationCallable()

public final UnaryCallable<StartAsyncReplicationDiskRequest,Operation> startAsyncReplicationCallable()

Starts asynchronous replication. Must be invoked on the primary 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 (DisksClient disksClient = DisksClient.create()) {
   StartAsyncReplicationDiskRequest request =
       StartAsyncReplicationDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setDisksStartAsyncReplicationRequestResource(
               DisksStartAsyncReplicationRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future = disksClient.startAsyncReplicationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<StartAsyncReplicationDiskRequest,Operation>

startAsyncReplicationOperationCallable()

public final OperationCallable<StartAsyncReplicationDiskRequest,Operation,Operation> startAsyncReplicationOperationCallable()

Starts asynchronous replication. Must be invoked on the primary 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 (DisksClient disksClient = DisksClient.create()) {
   StartAsyncReplicationDiskRequest request =
       StartAsyncReplicationDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setDisksStartAsyncReplicationRequestResource(
               DisksStartAsyncReplicationRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       disksClient.startAsyncReplicationOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<StartAsyncReplicationDiskRequest,Operation,Operation>

stopAsyncReplicationAsync(StopAsyncReplicationDiskRequest request)

public final OperationFuture<Operation,Operation> stopAsyncReplicationAsync(StopAsyncReplicationDiskRequest request)

Stops asynchronous replication. Can be invoked either on the primary or on the secondary 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 (DisksClient disksClient = DisksClient.create()) {
   StopAsyncReplicationDiskRequest request =
       StopAsyncReplicationDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   Operation response = disksClient.stopAsyncReplicationAsync(request).get();
 }
 
Parameter
NameDescription
requestStopAsyncReplicationDiskRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

stopAsyncReplicationAsync(String project, String zone, String disk)

public final OperationFuture<Operation,Operation> stopAsyncReplicationAsync(String project, String zone, String disk)

Stops asynchronous replication. Can be invoked either on the primary or on the secondary 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 (DisksClient disksClient = DisksClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String disk = "disk3083677";
   Operation response = disksClient.stopAsyncReplicationAsync(project, zone, disk).get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

diskString

The name of the persistent disk.

Returns
TypeDescription
OperationFuture<Operation,Operation>

stopAsyncReplicationCallable()

public final UnaryCallable<StopAsyncReplicationDiskRequest,Operation> stopAsyncReplicationCallable()

Stops asynchronous replication. Can be invoked either on the primary or on the secondary 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 (DisksClient disksClient = DisksClient.create()) {
   StopAsyncReplicationDiskRequest request =
       StopAsyncReplicationDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future = disksClient.stopAsyncReplicationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<StopAsyncReplicationDiskRequest,Operation>

stopAsyncReplicationOperationCallable()

public final OperationCallable<StopAsyncReplicationDiskRequest,Operation,Operation> stopAsyncReplicationOperationCallable()

Stops asynchronous replication. Can be invoked either on the primary or on the secondary 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 (DisksClient disksClient = DisksClient.create()) {
   StopAsyncReplicationDiskRequest request =
       StopAsyncReplicationDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       disksClient.stopAsyncReplicationOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<StopAsyncReplicationDiskRequest,Operation,Operation>

stopGroupAsyncReplicationAsync(StopGroupAsyncReplicationDiskRequest request)

public final OperationFuture<Operation,Operation> stopGroupAsyncReplicationAsync(StopGroupAsyncReplicationDiskRequest request)

Stops asynchronous replication for a consistency group of disks. Can be invoked either in the primary or secondary scope.

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 (DisksClient disksClient = DisksClient.create()) {
   StopGroupAsyncReplicationDiskRequest request =
       StopGroupAsyncReplicationDiskRequest.newBuilder()
           .setDisksStopGroupAsyncReplicationResourceResource(
               DisksStopGroupAsyncReplicationResource.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   Operation response = disksClient.stopGroupAsyncReplicationAsync(request).get();
 }
 
Parameter
NameDescription
requestStopGroupAsyncReplicationDiskRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

stopGroupAsyncReplicationAsync(String project, String zone, DisksStopGroupAsyncReplicationResource disksStopGroupAsyncReplicationResourceResource)

public final OperationFuture<Operation,Operation> stopGroupAsyncReplicationAsync(String project, String zone, DisksStopGroupAsyncReplicationResource disksStopGroupAsyncReplicationResourceResource)

Stops asynchronous replication for a consistency group of disks. Can be invoked either in the primary or secondary scope.

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 (DisksClient disksClient = DisksClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   DisksStopGroupAsyncReplicationResource disksStopGroupAsyncReplicationResourceResource =
       DisksStopGroupAsyncReplicationResource.newBuilder().build();
   Operation response =
       disksClient
           .stopGroupAsyncReplicationAsync(
               project, zone, disksStopGroupAsyncReplicationResourceResource)
           .get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request. This must be the zone of the primary or secondary disks in the consistency group.

disksStopGroupAsyncReplicationResourceResourceDisksStopGroupAsyncReplicationResource

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

stopGroupAsyncReplicationCallable()

public final UnaryCallable<StopGroupAsyncReplicationDiskRequest,Operation> stopGroupAsyncReplicationCallable()

Stops asynchronous replication for a consistency group of disks. Can be invoked either in the primary or secondary scope.

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 (DisksClient disksClient = DisksClient.create()) {
   StopGroupAsyncReplicationDiskRequest request =
       StopGroupAsyncReplicationDiskRequest.newBuilder()
           .setDisksStopGroupAsyncReplicationResourceResource(
               DisksStopGroupAsyncReplicationResource.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future =
       disksClient.stopGroupAsyncReplicationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<StopGroupAsyncReplicationDiskRequest,Operation>

stopGroupAsyncReplicationOperationCallable()

public final OperationCallable<StopGroupAsyncReplicationDiskRequest,Operation,Operation> stopGroupAsyncReplicationOperationCallable()

Stops asynchronous replication for a consistency group of disks. Can be invoked either in the primary or secondary scope.

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 (DisksClient disksClient = DisksClient.create()) {
   StopGroupAsyncReplicationDiskRequest request =
       StopGroupAsyncReplicationDiskRequest.newBuilder()
           .setDisksStopGroupAsyncReplicationResourceResource(
               DisksStopGroupAsyncReplicationResource.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       disksClient.stopGroupAsyncReplicationOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<StopGroupAsyncReplicationDiskRequest,Operation,Operation>

testIamPermissions(TestIamPermissionsDiskRequest request)

public final TestPermissionsResponse testIamPermissions(TestIamPermissionsDiskRequest 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 (DisksClient disksClient = DisksClient.create()) {
   TestIamPermissionsDiskRequest request =
       TestIamPermissionsDiskRequest.newBuilder()
           .setProject("project-309310695")
           .setResource("resource-341064690")
           .setTestPermissionsRequestResource(TestPermissionsRequest.newBuilder().build())
           .setZone("zone3744684")
           .build();
   TestPermissionsResponse response = disksClient.testIamPermissions(request);
 }
 
Parameter
NameDescription
requestTestIamPermissionsDiskRequest

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

Returns
TypeDescription
TestPermissionsResponse

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

public final TestPermissionsResponse testIamPermissions(String project, String zone, 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 (DisksClient disksClient = DisksClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String resource = "resource-341064690";
   TestPermissionsRequest testPermissionsRequestResource =
       TestPermissionsRequest.newBuilder().build();
   TestPermissionsResponse response =
       disksClient.testIamPermissions(project, zone, resource, testPermissionsRequestResource);
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone 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<TestIamPermissionsDiskRequest,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 (DisksClient disksClient = DisksClient.create()) {
   TestIamPermissionsDiskRequest request =
       TestIamPermissionsDiskRequest.newBuilder()
           .setProject("project-309310695")
           .setResource("resource-341064690")
           .setTestPermissionsRequestResource(TestPermissionsRequest.newBuilder().build())
           .setZone("zone3744684")
           .build();
   ApiFuture<TestPermissionsResponse> future =
       disksClient.testIamPermissionsCallable().futureCall(request);
   // Do something.
   TestPermissionsResponse response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<TestIamPermissionsDiskRequest,TestPermissionsResponse>

updateAsync(UpdateDiskRequest request)

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

Updates the specified disk with the data included in the request. The 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 (DisksClient disksClient = DisksClient.create()) {
   UpdateDiskRequest request =
       UpdateDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setDiskResource(Disk.newBuilder().build())
           .setPaths("paths106438894")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setUpdateMask("updateMask-296147115")
           .setZone("zone3744684")
           .build();
   Operation response = disksClient.updateAsync(request).get();
 }
 
Parameter
NameDescription
requestUpdateDiskRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

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

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

Updates the specified disk with the data included in the request. The 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 (DisksClient disksClient = DisksClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String disk = "disk3083677";
   Disk diskResource = Disk.newBuilder().build();
   Operation response = disksClient.updateAsync(project, zone, disk, diskResource).get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone 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<UpdateDiskRequest,Operation> updateCallable()

Updates the specified disk with the data included in the request. The 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 (DisksClient disksClient = DisksClient.create()) {
   UpdateDiskRequest request =
       UpdateDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setDiskResource(Disk.newBuilder().build())
           .setPaths("paths106438894")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setUpdateMask("updateMask-296147115")
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future = disksClient.updateCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<UpdateDiskRequest,Operation>

updateOperationCallable()

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

Updates the specified disk with the data included in the request. The 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 (DisksClient disksClient = DisksClient.create()) {
   UpdateDiskRequest request =
       UpdateDiskRequest.newBuilder()
           .setDisk("disk3083677")
           .setDiskResource(Disk.newBuilder().build())
           .setPaths("paths106438894")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setUpdateMask("updateMask-296147115")
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       disksClient.updateOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<UpdateDiskRequest,Operation,Operation>