@Generated(value="by gapic-generator-java") public class DisksClient extends Object implements com.google.api.gax.core.BackgroundResource
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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().
| Method | Description | Method 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.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
AggregatedList |
Retrieves an aggregated list of persistent disks. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
Get |
Returns the specified persistent disk. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
| Modifier and Type | Class and Description |
|---|---|
static class |
DisksClient.AggregatedListFixedSizeCollection |
static class |
DisksClient.AggregatedListPage |
static class |
DisksClient.AggregatedListPagedResponse |
static class |
DisksClient.ListFixedSizeCollection |
static class |
DisksClient.ListPage |
static class |
DisksClient.ListPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
DisksClient(DisksSettings settings)
Constructs an instance of DisksClient, using the given settings.
|
protected |
DisksClient(DisksStub stub) |
| Modifier and Type | Method and Description |
|---|---|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
addResourcePoliciesAsync(AddResourcePoliciesDiskRequest request)
Adds existing resource policies to a disk.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
addResourcePoliciesAsync(String project,
String zone,
String disk,
DisksAddResourcePoliciesRequest disksAddResourcePoliciesRequestResource)
Adds existing resource policies to a disk.
|
com.google.api.gax.rpc.UnaryCallable<AddResourcePoliciesDiskRequest,Operation> |
addResourcePoliciesCallable()
Adds existing resource policies to a disk.
|
com.google.api.gax.rpc.OperationCallable<AddResourcePoliciesDiskRequest,Operation,Operation> |
addResourcePoliciesOperationCallable()
Adds existing resource policies to a disk.
|
DisksClient.AggregatedListPagedResponse |
aggregatedList(AggregatedListDisksRequest request)
Retrieves an aggregated list of persistent disks.
|
DisksClient.AggregatedListPagedResponse |
aggregatedList(String project)
Retrieves an aggregated list of persistent disks.
|
com.google.api.gax.rpc.UnaryCallable<AggregatedListDisksRequest,DiskAggregatedList> |
aggregatedListCallable()
Retrieves an aggregated list of persistent disks.
|
com.google.api.gax.rpc.UnaryCallable<AggregatedListDisksRequest,DisksClient.AggregatedListPagedResponse> |
aggregatedListPagedCallable()
Retrieves an aggregated list of persistent disks.
|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
bulkInsertAsync(BulkInsertDiskRequest request)
Bulk create a set of disks.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
bulkInsertAsync(String project,
String zone,
BulkInsertDiskResource bulkInsertDiskResourceResource)
Bulk create a set of disks.
|
com.google.api.gax.rpc.UnaryCallable<BulkInsertDiskRequest,Operation> |
bulkInsertCallable()
Bulk create a set of disks.
|
com.google.api.gax.rpc.OperationCallable<BulkInsertDiskRequest,Operation,Operation> |
bulkInsertOperationCallable()
Bulk create a set of disks.
|
void |
close() |
static DisksClient |
create()
Constructs an instance of DisksClient with default settings.
|
static DisksClient |
create(DisksSettings settings)
Constructs an instance of DisksClient, using the given settings.
|
static DisksClient |
create(DisksStub stub)
Constructs an instance of DisksClient, using the given stub for making calls.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
createSnapshotAsync(CreateSnapshotDiskRequest request)
Creates a snapshot of a specified persistent disk.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
createSnapshotAsync(String project,
String zone,
String disk,
Snapshot snapshotResource)
Creates a snapshot of a specified persistent disk.
|
com.google.api.gax.rpc.UnaryCallable<CreateSnapshotDiskRequest,Operation> |
createSnapshotCallable()
Creates a snapshot of a specified persistent disk.
|
com.google.api.gax.rpc.OperationCallable<CreateSnapshotDiskRequest,Operation,Operation> |
createSnapshotOperationCallable()
Creates a snapshot of a specified persistent disk.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
deleteAsync(DeleteDiskRequest request)
Deletes the specified persistent disk.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
deleteAsync(String project,
String zone,
String disk)
Deletes the specified persistent disk.
|
com.google.api.gax.rpc.UnaryCallable<DeleteDiskRequest,Operation> |
deleteCallable()
Deletes the specified persistent disk.
|
com.google.api.gax.rpc.OperationCallable<DeleteDiskRequest,Operation,Operation> |
deleteOperationCallable()
Deletes the specified persistent disk.
|
Disk |
get(GetDiskRequest request)
Returns the specified persistent disk.
|
Disk |
get(String project,
String zone,
String disk)
Returns the specified persistent disk.
|
com.google.api.gax.rpc.UnaryCallable<GetDiskRequest,Disk> |
getCallable()
Returns the specified persistent disk.
|
Policy |
getIamPolicy(GetIamPolicyDiskRequest request)
Gets the access control policy for a resource.
|
Policy |
getIamPolicy(String project,
String zone,
String resource)
Gets the access control policy for a resource.
|
com.google.api.gax.rpc.UnaryCallable<GetIamPolicyDiskRequest,Policy> |
getIamPolicyCallable()
Gets the access control policy for a resource.
|
DisksSettings |
getSettings() |
DisksStub |
getStub() |
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
insertAsync(InsertDiskRequest request)
Creates a persistent disk in the specified project using the data in the request.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
insertAsync(String project,
String zone,
Disk diskResource)
Creates a persistent disk in the specified project using the data in the request.
|
com.google.api.gax.rpc.UnaryCallable<InsertDiskRequest,Operation> |
insertCallable()
Creates a persistent disk in the specified project using the data in the request.
|
com.google.api.gax.rpc.OperationCallable<InsertDiskRequest,Operation,Operation> |
insertOperationCallable()
Creates a persistent disk in the specified project using the data in the request.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
DisksClient.ListPagedResponse |
list(ListDisksRequest request)
Retrieves a list of persistent disks contained within the specified zone.
|
DisksClient.ListPagedResponse |
list(String project,
String zone)
Retrieves a list of persistent disks contained within the specified zone.
|
com.google.api.gax.rpc.UnaryCallable<ListDisksRequest,DiskList> |
listCallable()
Retrieves a list of persistent disks contained within the specified zone.
|
com.google.api.gax.rpc.UnaryCallable<ListDisksRequest,DisksClient.ListPagedResponse> |
listPagedCallable()
Retrieves a list of persistent disks contained within the specified zone.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
removeResourcePoliciesAsync(RemoveResourcePoliciesDiskRequest request)
Removes resource policies from a disk.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
removeResourcePoliciesAsync(String project,
String zone,
String disk,
DisksRemoveResourcePoliciesRequest disksRemoveResourcePoliciesRequestResource)
Removes resource policies from a disk.
|
com.google.api.gax.rpc.UnaryCallable<RemoveResourcePoliciesDiskRequest,Operation> |
removeResourcePoliciesCallable()
Removes resource policies from a disk.
|
com.google.api.gax.rpc.OperationCallable<RemoveResourcePoliciesDiskRequest,Operation,Operation> |
removeResourcePoliciesOperationCallable()
Removes resource policies from a disk.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
resizeAsync(ResizeDiskRequest request)
Resizes the specified persistent disk.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
resizeAsync(String project,
String zone,
String disk,
DisksResizeRequest disksResizeRequestResource)
Resizes the specified persistent disk.
|
com.google.api.gax.rpc.UnaryCallable<ResizeDiskRequest,Operation> |
resizeCallable()
Resizes the specified persistent disk.
|
com.google.api.gax.rpc.OperationCallable<ResizeDiskRequest,Operation,Operation> |
resizeOperationCallable()
Resizes the specified persistent disk.
|
Policy |
setIamPolicy(SetIamPolicyDiskRequest request)
Sets the access control policy on the specified resource.
|
Policy |
setIamPolicy(String project,
String zone,
String resource,
ZoneSetPolicyRequest zoneSetPolicyRequestResource)
Sets the access control policy on the specified resource.
|
com.google.api.gax.rpc.UnaryCallable<SetIamPolicyDiskRequest,Policy> |
setIamPolicyCallable()
Sets the access control policy on the specified resource.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
setLabelsAsync(SetLabelsDiskRequest request)
Sets the labels on a disk.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
setLabelsAsync(String project,
String zone,
String resource,
ZoneSetLabelsRequest zoneSetLabelsRequestResource)
Sets the labels on a disk.
|
com.google.api.gax.rpc.UnaryCallable<SetLabelsDiskRequest,Operation> |
setLabelsCallable()
Sets the labels on a disk.
|
com.google.api.gax.rpc.OperationCallable<SetLabelsDiskRequest,Operation,Operation> |
setLabelsOperationCallable()
Sets the labels on a disk.
|
void |
shutdown() |
void |
shutdownNow() |
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
startAsyncReplicationAsync(StartAsyncReplicationDiskRequest request)
Starts asynchronous replication.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
startAsyncReplicationAsync(String project,
String zone,
String disk,
DisksStartAsyncReplicationRequest disksStartAsyncReplicationRequestResource)
Starts asynchronous replication.
|
com.google.api.gax.rpc.UnaryCallable<StartAsyncReplicationDiskRequest,Operation> |
startAsyncReplicationCallable()
Starts asynchronous replication.
|
com.google.api.gax.rpc.OperationCallable<StartAsyncReplicationDiskRequest,Operation,Operation> |
startAsyncReplicationOperationCallable()
Starts asynchronous replication.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
stopAsyncReplicationAsync(StopAsyncReplicationDiskRequest request)
Stops asynchronous replication.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
stopAsyncReplicationAsync(String project,
String zone,
String disk)
Stops asynchronous replication.
|
com.google.api.gax.rpc.UnaryCallable<StopAsyncReplicationDiskRequest,Operation> |
stopAsyncReplicationCallable()
Stops asynchronous replication.
|
com.google.api.gax.rpc.OperationCallable<StopAsyncReplicationDiskRequest,Operation,Operation> |
stopAsyncReplicationOperationCallable()
Stops asynchronous replication.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
stopGroupAsyncReplicationAsync(StopGroupAsyncReplicationDiskRequest request)
Stops asynchronous replication for a consistency group of disks.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
stopGroupAsyncReplicationAsync(String project,
String zone,
DisksStopGroupAsyncReplicationResource disksStopGroupAsyncReplicationResourceResource)
Stops asynchronous replication for a consistency group of disks.
|
com.google.api.gax.rpc.UnaryCallable<StopGroupAsyncReplicationDiskRequest,Operation> |
stopGroupAsyncReplicationCallable()
Stops asynchronous replication for a consistency group of disks.
|
com.google.api.gax.rpc.OperationCallable<StopGroupAsyncReplicationDiskRequest,Operation,Operation> |
stopGroupAsyncReplicationOperationCallable()
Stops asynchronous replication for a consistency group of disks.
|
TestPermissionsResponse |
testIamPermissions(String project,
String zone,
String resource,
TestPermissionsRequest testPermissionsRequestResource)
Returns permissions that a caller has on the specified resource.
|
TestPermissionsResponse |
testIamPermissions(TestIamPermissionsDiskRequest request)
Returns permissions that a caller has on the specified resource.
|
com.google.api.gax.rpc.UnaryCallable<TestIamPermissionsDiskRequest,TestPermissionsResponse> |
testIamPermissionsCallable()
Returns permissions that a caller has on the specified resource.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
updateAsync(String project,
String zone,
String disk,
Disk diskResource)
Updates the specified disk with the data included in the request.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
updateAsync(UpdateDiskRequest request)
Updates the specified disk with the data included in the request.
|
com.google.api.gax.rpc.UnaryCallable<UpdateDiskRequest,Operation> |
updateCallable()
Updates the specified disk with the data included in the request.
|
com.google.api.gax.rpc.OperationCallable<UpdateDiskRequest,Operation,Operation> |
updateOperationCallable()
Updates the specified disk with the data included in the request.
|
protected DisksClient(DisksSettings settings) throws IOException
IOExceptionprotected DisksClient(DisksStub stub)
public static final DisksClient create() throws IOException
IOExceptionpublic static final DisksClient create(DisksSettings settings) throws IOException
IOExceptionpublic static final DisksClient create(DisksStub stub)
public final DisksSettings getSettings()
public DisksStub getStub()
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> addResourcePoliciesAsync(String project, String zone, String disk, DisksAddResourcePoliciesRequest disksAddResourcePoliciesRequestResource)
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();
}
project - Project ID for this request.zone - The name of the zone for this request.disk - The disk name for this request.disksAddResourcePoliciesRequestResource - The body resource for this requestcom.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> addResourcePoliciesAsync(AddResourcePoliciesDiskRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<AddResourcePoliciesDiskRequest,Operation,Operation> addResourcePoliciesOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<AddResourcePoliciesDiskRequest,Operation> addResourcePoliciesCallable()
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();
}
public final DisksClient.AggregatedListPagedResponse aggregatedList(String 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";
for (Map.Entry<String, DisksScopedList> element :
disksClient.aggregatedList(project).iterateAll()) {
// doThingsWith(element);
}
}
project - Project ID for this request.com.google.api.gax.rpc.ApiException - if the remote call failspublic final DisksClient.AggregatedListPagedResponse aggregatedList(AggregatedListDisksRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<AggregatedListDisksRequest,DisksClient.AggregatedListPagedResponse> aggregatedListPagedCallable()
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);
}
}
public final com.google.api.gax.rpc.UnaryCallable<AggregatedListDisksRequest,DiskAggregatedList> aggregatedListCallable()
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;
}
}
}
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> bulkInsertAsync(String project, String zone, BulkInsertDiskResource bulkInsertDiskResourceResource)
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();
}
project - Project ID for this request.zone - The name of the zone for this request.bulkInsertDiskResourceResource - The body resource for this requestcom.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> bulkInsertAsync(BulkInsertDiskRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<BulkInsertDiskRequest,Operation,Operation> bulkInsertOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<BulkInsertDiskRequest,Operation> bulkInsertCallable()
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();
}
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> createSnapshotAsync(String project, String zone, String disk, Snapshot snapshotResource)
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();
}
project - Project ID for this request.zone - The name of the zone for this request.disk - Name of the persistent disk to snapshot.snapshotResource - The body resource for this requestcom.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> createSnapshotAsync(CreateSnapshotDiskRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<CreateSnapshotDiskRequest,Operation,Operation> createSnapshotOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<CreateSnapshotDiskRequest,Operation> createSnapshotCallable()
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();
}
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> deleteAsync(String project, String zone, String 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.deleteAsync(project, zone, disk).get();
}
project - Project ID for this request.zone - The name of the zone for this request.disk - Name of the persistent disk to delete.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> deleteAsync(DeleteDiskRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (DisksClient disksClient = DisksClient.create()) {
DeleteDiskRequest request =
DeleteDiskRequest.newBuilder()
.setDisk("disk3083677")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
Operation response = disksClient.deleteAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<DeleteDiskRequest,Operation,Operation> deleteOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<DeleteDiskRequest,Operation> deleteCallable()
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();
}
public final Disk get(String project, String zone, String 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);
}
project - Project ID for this request.zone - The name of the zone for this request.disk - Name of the persistent disk to return.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Disk get(GetDiskRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (DisksClient disksClient = DisksClient.create()) {
GetDiskRequest request =
GetDiskRequest.newBuilder()
.setDisk("disk3083677")
.setProject("project-309310695")
.setZone("zone3744684")
.build();
Disk response = disksClient.get(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetDiskRequest,Disk> getCallable()
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();
}
public final Policy getIamPolicy(String project, String zone, String 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";
Policy response = disksClient.getIamPolicy(project, zone, resource);
}
project - Project ID for this request.zone - The name of the zone for this request.resource - Name or id of the resource for this request.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Policy getIamPolicy(GetIamPolicyDiskRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (DisksClient disksClient = DisksClient.create()) {
GetIamPolicyDiskRequest request =
GetIamPolicyDiskRequest.newBuilder()
.setOptionsRequestedPolicyVersion(-574521795)
.setProject("project-309310695")
.setResource("resource-341064690")
.setZone("zone3744684")
.build();
Policy response = disksClient.getIamPolicy(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetIamPolicyDiskRequest,Policy> getIamPolicyCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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();
}
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> insertAsync(String project, String zone, Disk diskResource)
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();
}
project - Project ID for this request.zone - The name of the zone for this request.diskResource - The body resource for this requestcom.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> insertAsync(InsertDiskRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<InsertDiskRequest,Operation,Operation> insertOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<InsertDiskRequest,Operation> insertCallable()
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();
}
public final DisksClient.ListPagedResponse list(String project, String 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);
}
}
project - Project ID for this request.zone - The name of the zone for this request.com.google.api.gax.rpc.ApiException - if the remote call failspublic final DisksClient.ListPagedResponse list(ListDisksRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListDisksRequest,DisksClient.ListPagedResponse> listPagedCallable()
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);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListDisksRequest,DiskList> listCallable()
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;
}
}
}
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> removeResourcePoliciesAsync(String project, String zone, String disk, DisksRemoveResourcePoliciesRequest disksRemoveResourcePoliciesRequestResource)
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();
}
project - Project ID for this request.zone - The name of the zone for this request.disk - The disk name for this request.disksRemoveResourcePoliciesRequestResource - The body resource for this requestcom.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> removeResourcePoliciesAsync(RemoveResourcePoliciesDiskRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<RemoveResourcePoliciesDiskRequest,Operation,Operation> removeResourcePoliciesOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<RemoveResourcePoliciesDiskRequest,Operation> removeResourcePoliciesCallable()
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();
}
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> resizeAsync(String project, String zone, String disk, DisksResizeRequest disksResizeRequestResource)
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();
}
project - Project ID for this request.zone - The name of the zone for this request.disk - The name of the persistent disk.disksResizeRequestResource - The body resource for this requestcom.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> resizeAsync(ResizeDiskRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<ResizeDiskRequest,Operation,Operation> resizeOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<ResizeDiskRequest,Operation> resizeCallable()
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();
}
public final Policy setIamPolicy(String project, String zone, String resource, ZoneSetPolicyRequest zoneSetPolicyRequestResource)
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);
}
project - Project ID for this request.zone - The name of the zone for this request.resource - Name or id of the resource for this request.zoneSetPolicyRequestResource - The body resource for this requestcom.google.api.gax.rpc.ApiException - if the remote call failspublic final Policy setIamPolicy(SetIamPolicyDiskRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<SetIamPolicyDiskRequest,Policy> setIamPolicyCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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();
}
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> setLabelsAsync(String project, String zone, String resource, ZoneSetLabelsRequest zoneSetLabelsRequestResource)
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();
}
project - Project ID for this request.zone - The name of the zone for this request.resource - Name or id of the resource for this request.zoneSetLabelsRequestResource - The body resource for this requestcom.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> setLabelsAsync(SetLabelsDiskRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<SetLabelsDiskRequest,Operation,Operation> setLabelsOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<SetLabelsDiskRequest,Operation> setLabelsCallable()
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();
}
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> startAsyncReplicationAsync(String project, String zone, String disk, DisksStartAsyncReplicationRequest disksStartAsyncReplicationRequestResource)
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();
}
project - Project ID for this request.zone - The name of the zone for this request.disk - The name of the persistent disk.disksStartAsyncReplicationRequestResource - The body resource for this requestcom.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> startAsyncReplicationAsync(StartAsyncReplicationDiskRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<StartAsyncReplicationDiskRequest,Operation,Operation> startAsyncReplicationOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<StartAsyncReplicationDiskRequest,Operation> startAsyncReplicationCallable()
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();
}
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> stopAsyncReplicationAsync(String project, String zone, String 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();
}
project - Project ID for this request.zone - The name of the zone for this request.disk - The name of the persistent disk.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> stopAsyncReplicationAsync(StopAsyncReplicationDiskRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (DisksClient disksClient = DisksClient.create()) {
StopAsyncReplicationDiskRequest request =
StopAsyncReplicationDiskRequest.newBuilder()
.setDisk("disk3083677")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
Operation response = disksClient.stopAsyncReplicationAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<StopAsyncReplicationDiskRequest,Operation,Operation> stopAsyncReplicationOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<StopAsyncReplicationDiskRequest,Operation> stopAsyncReplicationCallable()
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();
}
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> stopGroupAsyncReplicationAsync(String project, String zone, DisksStopGroupAsyncReplicationResource disksStopGroupAsyncReplicationResourceResource)
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();
}
project - Project ID for this request.zone - The name of the zone for this request. This must be the zone of the primary or
secondary disks in the consistency group.disksStopGroupAsyncReplicationResourceResource - The body resource for this requestcom.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> stopGroupAsyncReplicationAsync(StopGroupAsyncReplicationDiskRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<StopGroupAsyncReplicationDiskRequest,Operation,Operation> stopGroupAsyncReplicationOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<StopGroupAsyncReplicationDiskRequest,Operation> stopGroupAsyncReplicationCallable()
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();
}
public final TestPermissionsResponse testIamPermissions(String project, String zone, String resource, TestPermissionsRequest testPermissionsRequestResource)
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);
}
project - Project ID for this request.zone - The name of the zone for this request.resource - Name or id of the resource for this request.testPermissionsRequestResource - The body resource for this requestcom.google.api.gax.rpc.ApiException - if the remote call failspublic final TestPermissionsResponse testIamPermissions(TestIamPermissionsDiskRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<TestIamPermissionsDiskRequest,TestPermissionsResponse> testIamPermissionsCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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();
}
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> updateAsync(String project, String zone, String disk, Disk diskResource)
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();
}
project - Project ID for this request.zone - The name of the zone for this request.disk - The disk name for this request.diskResource - The body resource for this requestcom.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> updateAsync(UpdateDiskRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<UpdateDiskRequest,Operation,Operation> updateOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<UpdateDiskRequest,Operation> updateCallable()
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();
}
public final void close()
close in interface AutoCloseablepublic void shutdown()
shutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isShutdown()
isShutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isTerminated()
isTerminated in interface com.google.api.gax.core.BackgroundResourcepublic void shutdownNow()
shutdownNow in interface com.google.api.gax.core.BackgroundResourcepublic boolean awaitTermination(long duration,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface com.google.api.gax.core.BackgroundResourceInterruptedExceptionCopyright © 2024 Google LLC. All rights reserved.