@Generated(value="by gapic-generator") @BetaApi public class RegionDiskClient 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:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
ProjectRegionDiskName disk = ProjectRegionDiskName.of("[PROJECT]", "[REGION]", "[DISK]");
RegionDisksAddResourcePoliciesRequest regionDisksAddResourcePoliciesRequestResource = RegionDisksAddResourcePoliciesRequest.newBuilder().build();
Operation response = regionDiskClient.addResourcePoliciesRegionDisk(disk, regionDisksAddResourcePoliciesRequestResource);
}
Note: close() needs to be called on the regionDiskClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
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 RegionDiskSettings to create(). For example:
To customize credentials:
RegionDiskSettings regionDiskSettings =
RegionDiskSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
RegionDiskClient regionDiskClient =
RegionDiskClient.create(regionDiskSettings);
To customize the endpoint:
RegionDiskSettings regionDiskSettings =
RegionDiskSettings.newBuilder().setEndpoint(myEndpoint).build();
RegionDiskClient regionDiskClient =
RegionDiskClient.create(regionDiskSettings);
Modifier and Type | Class and Description |
---|---|
static class |
RegionDiskClient.ListRegionDisksFixedSizeCollection |
static class |
RegionDiskClient.ListRegionDisksPage |
static class |
RegionDiskClient.ListRegionDisksPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
RegionDiskClient(RegionDiskSettings settings)
Constructs an instance of RegionDiskClient, using the given settings.
|
protected |
RegionDiskClient(RegionDiskStub stub) |
Modifier and Type | Method and Description |
---|---|
Operation |
addResourcePoliciesRegionDisk(AddResourcePoliciesRegionDiskHttpRequest request)
Adds existing resource policies to a regional disk.
|
Operation |
addResourcePoliciesRegionDisk(ProjectRegionDiskName disk,
RegionDisksAddResourcePoliciesRequest regionDisksAddResourcePoliciesRequestResource)
Adds existing resource policies to a regional disk.
|
Operation |
addResourcePoliciesRegionDisk(String disk,
RegionDisksAddResourcePoliciesRequest regionDisksAddResourcePoliciesRequestResource)
Adds existing resource policies to a regional disk.
|
com.google.api.gax.rpc.UnaryCallable<AddResourcePoliciesRegionDiskHttpRequest,Operation> |
addResourcePoliciesRegionDiskCallable()
Adds existing resource policies to a regional disk.
|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static RegionDiskClient |
create()
Constructs an instance of RegionDiskClient with default settings.
|
static RegionDiskClient |
create(RegionDiskSettings settings)
Constructs an instance of RegionDiskClient, using the given settings.
|
static RegionDiskClient |
create(RegionDiskStub stub)
Constructs an instance of RegionDiskClient, using the given stub for making calls.
|
Operation |
createSnapshotRegionDisk(CreateSnapshotRegionDiskHttpRequest request)
Creates a snapshot of this regional disk.
|
Operation |
createSnapshotRegionDisk(ProjectRegionDiskName disk,
Snapshot snapshotResource)
Creates a snapshot of this regional disk.
|
Operation |
createSnapshotRegionDisk(String disk,
Snapshot snapshotResource)
Creates a snapshot of this regional disk.
|
com.google.api.gax.rpc.UnaryCallable<CreateSnapshotRegionDiskHttpRequest,Operation> |
createSnapshotRegionDiskCallable()
Creates a snapshot of this regional disk.
|
Operation |
deleteRegionDisk(DeleteRegionDiskHttpRequest request)
Deletes the specified regional persistent disk.
|
Operation |
deleteRegionDisk(ProjectRegionDiskName disk)
Deletes the specified regional persistent disk.
|
Operation |
deleteRegionDisk(String disk)
Deletes the specified regional persistent disk.
|
com.google.api.gax.rpc.UnaryCallable<DeleteRegionDiskHttpRequest,Operation> |
deleteRegionDiskCallable()
Deletes the specified regional persistent disk.
|
Disk |
getRegionDisk(GetRegionDiskHttpRequest request)
Returns a specified regional persistent disk.
|
Disk |
getRegionDisk(ProjectRegionDiskName disk)
Returns a specified regional persistent disk.
|
Disk |
getRegionDisk(String disk)
Returns a specified regional persistent disk.
|
com.google.api.gax.rpc.UnaryCallable<GetRegionDiskHttpRequest,Disk> |
getRegionDiskCallable()
Returns a specified regional persistent disk.
|
RegionDiskSettings |
getSettings() |
RegionDiskStub |
getStub() |
Operation |
insertRegionDisk(InsertRegionDiskHttpRequest request)
Creates a persistent regional disk in the specified project using the data included in the
request.
|
Operation |
insertRegionDisk(ProjectRegionName region,
Disk diskResource)
Creates a persistent regional disk in the specified project using the data included in the
request.
|
Operation |
insertRegionDisk(String region,
Disk diskResource)
Creates a persistent regional disk in the specified project using the data included in the
request.
|
com.google.api.gax.rpc.UnaryCallable<InsertRegionDiskHttpRequest,Operation> |
insertRegionDiskCallable()
Creates a persistent regional disk in the specified project using the data included in the
request.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
RegionDiskClient.ListRegionDisksPagedResponse |
listRegionDisks(ListRegionDisksHttpRequest request)
Retrieves the list of persistent disks contained within the specified region.
|
RegionDiskClient.ListRegionDisksPagedResponse |
listRegionDisks(ProjectRegionName region)
Retrieves the list of persistent disks contained within the specified region.
|
RegionDiskClient.ListRegionDisksPagedResponse |
listRegionDisks(String region)
Retrieves the list of persistent disks contained within the specified region.
|
com.google.api.gax.rpc.UnaryCallable<ListRegionDisksHttpRequest,DiskList> |
listRegionDisksCallable()
Retrieves the list of persistent disks contained within the specified region.
|
com.google.api.gax.rpc.UnaryCallable<ListRegionDisksHttpRequest,RegionDiskClient.ListRegionDisksPagedResponse> |
listRegionDisksPagedCallable()
Retrieves the list of persistent disks contained within the specified region.
|
Operation |
removeResourcePoliciesRegionDisk(ProjectRegionDiskName disk,
RegionDisksRemoveResourcePoliciesRequest regionDisksRemoveResourcePoliciesRequestResource)
Removes resource policies from a regional disk.
|
Operation |
removeResourcePoliciesRegionDisk(RemoveResourcePoliciesRegionDiskHttpRequest request)
Removes resource policies from a regional disk.
|
Operation |
removeResourcePoliciesRegionDisk(String disk,
RegionDisksRemoveResourcePoliciesRequest regionDisksRemoveResourcePoliciesRequestResource)
Removes resource policies from a regional disk.
|
com.google.api.gax.rpc.UnaryCallable<RemoveResourcePoliciesRegionDiskHttpRequest,Operation> |
removeResourcePoliciesRegionDiskCallable()
Removes resource policies from a regional disk.
|
Operation |
resizeRegionDisk(ProjectRegionDiskName disk,
RegionDisksResizeRequest regionDisksResizeRequestResource)
Resizes the specified regional persistent disk.
|
Operation |
resizeRegionDisk(ResizeRegionDiskHttpRequest request)
Resizes the specified regional persistent disk.
|
Operation |
resizeRegionDisk(String disk,
RegionDisksResizeRequest regionDisksResizeRequestResource)
Resizes the specified regional persistent disk.
|
com.google.api.gax.rpc.UnaryCallable<ResizeRegionDiskHttpRequest,Operation> |
resizeRegionDiskCallable()
Resizes the specified regional persistent disk.
|
Operation |
setLabelsRegionDisk(ProjectRegionDiskResourceName resource,
RegionSetLabelsRequest regionSetLabelsRequestResource)
Sets the labels on the target regional disk.
|
Operation |
setLabelsRegionDisk(SetLabelsRegionDiskHttpRequest request)
Sets the labels on the target regional disk.
|
Operation |
setLabelsRegionDisk(String resource,
RegionSetLabelsRequest regionSetLabelsRequestResource)
Sets the labels on the target regional disk.
|
com.google.api.gax.rpc.UnaryCallable<SetLabelsRegionDiskHttpRequest,Operation> |
setLabelsRegionDiskCallable()
Sets the labels on the target regional disk.
|
void |
shutdown() |
void |
shutdownNow() |
TestPermissionsResponse |
testIamPermissionsRegionDisk(ProjectRegionDiskResourceName resource,
TestPermissionsRequest testPermissionsRequestResource)
Returns permissions that a caller has on the specified resource.
|
TestPermissionsResponse |
testIamPermissionsRegionDisk(String resource,
TestPermissionsRequest testPermissionsRequestResource)
Returns permissions that a caller has on the specified resource.
|
TestPermissionsResponse |
testIamPermissionsRegionDisk(TestIamPermissionsRegionDiskHttpRequest request)
Returns permissions that a caller has on the specified resource.
|
com.google.api.gax.rpc.UnaryCallable<TestIamPermissionsRegionDiskHttpRequest,TestPermissionsResponse> |
testIamPermissionsRegionDiskCallable()
Returns permissions that a caller has on the specified resource.
|
protected RegionDiskClient(RegionDiskSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected RegionDiskClient(RegionDiskStub stub)
public static final RegionDiskClient create() throws IOException
IOException
public static final RegionDiskClient create(RegionDiskSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final RegionDiskClient create(RegionDiskStub stub)
public final RegionDiskSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public RegionDiskStub getStub()
@BetaApi public final Operation addResourcePoliciesRegionDisk(ProjectRegionDiskName disk, RegionDisksAddResourcePoliciesRequest regionDisksAddResourcePoliciesRequestResource)
Sample code:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
ProjectRegionDiskName disk = ProjectRegionDiskName.of("[PROJECT]", "[REGION]", "[DISK]");
RegionDisksAddResourcePoliciesRequest regionDisksAddResourcePoliciesRequestResource = RegionDisksAddResourcePoliciesRequest.newBuilder().build();
Operation response = regionDiskClient.addResourcePoliciesRegionDisk(disk, regionDisksAddResourcePoliciesRequestResource);
}
disk
- The disk name for this request.regionDisksAddResourcePoliciesRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation addResourcePoliciesRegionDisk(String disk, RegionDisksAddResourcePoliciesRequest regionDisksAddResourcePoliciesRequestResource)
Sample code:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
ProjectRegionDiskName disk = ProjectRegionDiskName.of("[PROJECT]", "[REGION]", "[DISK]");
RegionDisksAddResourcePoliciesRequest regionDisksAddResourcePoliciesRequestResource = RegionDisksAddResourcePoliciesRequest.newBuilder().build();
Operation response = regionDiskClient.addResourcePoliciesRegionDisk(disk.toString(), regionDisksAddResourcePoliciesRequestResource);
}
disk
- The disk name for this request.regionDisksAddResourcePoliciesRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation addResourcePoliciesRegionDisk(AddResourcePoliciesRegionDiskHttpRequest request)
Sample code:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
String formattedDisk = ProjectRegionDiskName.format("[PROJECT]", "[REGION]", "[DISK]");
RegionDisksAddResourcePoliciesRequest regionDisksAddResourcePoliciesRequestResource = RegionDisksAddResourcePoliciesRequest.newBuilder().build();
AddResourcePoliciesRegionDiskHttpRequest request = AddResourcePoliciesRegionDiskHttpRequest.newBuilder()
.setDisk(formattedDisk)
.setRegionDisksAddResourcePoliciesRequestResource(regionDisksAddResourcePoliciesRequestResource)
.build();
Operation response = regionDiskClient.addResourcePoliciesRegionDisk(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<AddResourcePoliciesRegionDiskHttpRequest,Operation> addResourcePoliciesRegionDiskCallable()
Sample code:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
String formattedDisk = ProjectRegionDiskName.format("[PROJECT]", "[REGION]", "[DISK]");
RegionDisksAddResourcePoliciesRequest regionDisksAddResourcePoliciesRequestResource = RegionDisksAddResourcePoliciesRequest.newBuilder().build();
AddResourcePoliciesRegionDiskHttpRequest request = AddResourcePoliciesRegionDiskHttpRequest.newBuilder()
.setDisk(formattedDisk)
.setRegionDisksAddResourcePoliciesRequestResource(regionDisksAddResourcePoliciesRequestResource)
.build();
ApiFuture<Operation> future = regionDiskClient.addResourcePoliciesRegionDiskCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation createSnapshotRegionDisk(ProjectRegionDiskName disk, Snapshot snapshotResource)
Sample code:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
ProjectRegionDiskName disk = ProjectRegionDiskName.of("[PROJECT]", "[REGION]", "[DISK]");
Snapshot snapshotResource = Snapshot.newBuilder().build();
Operation response = regionDiskClient.createSnapshotRegionDisk(disk, snapshotResource);
}
disk
- Name of the regional persistent disk to snapshot.snapshotResource
- Represents a Persistent Disk Snapshot resource.
You can use snapshots to back up data on a regular interval. For more information, read Creating persistent disk snapshots. (== resource_for beta.snapshots ==) (== resource_for v1.snapshots ==)
com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation createSnapshotRegionDisk(String disk, Snapshot snapshotResource)
Sample code:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
ProjectRegionDiskName disk = ProjectRegionDiskName.of("[PROJECT]", "[REGION]", "[DISK]");
Snapshot snapshotResource = Snapshot.newBuilder().build();
Operation response = regionDiskClient.createSnapshotRegionDisk(disk.toString(), snapshotResource);
}
disk
- Name of the regional persistent disk to snapshot.snapshotResource
- Represents a Persistent Disk Snapshot resource.
You can use snapshots to back up data on a regular interval. For more information, read Creating persistent disk snapshots. (== resource_for beta.snapshots ==) (== resource_for v1.snapshots ==)
com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation createSnapshotRegionDisk(CreateSnapshotRegionDiskHttpRequest request)
Sample code:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
String formattedDisk = ProjectRegionDiskName.format("[PROJECT]", "[REGION]", "[DISK]");
Snapshot snapshotResource = Snapshot.newBuilder().build();
CreateSnapshotRegionDiskHttpRequest request = CreateSnapshotRegionDiskHttpRequest.newBuilder()
.setDisk(formattedDisk)
.setSnapshotResource(snapshotResource)
.build();
Operation response = regionDiskClient.createSnapshotRegionDisk(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<CreateSnapshotRegionDiskHttpRequest,Operation> createSnapshotRegionDiskCallable()
Sample code:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
String formattedDisk = ProjectRegionDiskName.format("[PROJECT]", "[REGION]", "[DISK]");
Snapshot snapshotResource = Snapshot.newBuilder().build();
CreateSnapshotRegionDiskHttpRequest request = CreateSnapshotRegionDiskHttpRequest.newBuilder()
.setDisk(formattedDisk)
.setSnapshotResource(snapshotResource)
.build();
ApiFuture<Operation> future = regionDiskClient.createSnapshotRegionDiskCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation deleteRegionDisk(ProjectRegionDiskName disk)
Sample code:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
ProjectRegionDiskName disk = ProjectRegionDiskName.of("[PROJECT]", "[REGION]", "[DISK]");
Operation response = regionDiskClient.deleteRegionDisk(disk);
}
disk
- Name of the regional persistent disk to delete.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation deleteRegionDisk(String disk)
Sample code:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
ProjectRegionDiskName disk = ProjectRegionDiskName.of("[PROJECT]", "[REGION]", "[DISK]");
Operation response = regionDiskClient.deleteRegionDisk(disk.toString());
}
disk
- Name of the regional persistent disk to delete.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation deleteRegionDisk(DeleteRegionDiskHttpRequest request)
Sample code:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
String formattedDisk = ProjectRegionDiskName.format("[PROJECT]", "[REGION]", "[DISK]");
DeleteRegionDiskHttpRequest request = DeleteRegionDiskHttpRequest.newBuilder()
.setDisk(formattedDisk)
.build();
Operation response = regionDiskClient.deleteRegionDisk(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<DeleteRegionDiskHttpRequest,Operation> deleteRegionDiskCallable()
Sample code:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
String formattedDisk = ProjectRegionDiskName.format("[PROJECT]", "[REGION]", "[DISK]");
DeleteRegionDiskHttpRequest request = DeleteRegionDiskHttpRequest.newBuilder()
.setDisk(formattedDisk)
.build();
ApiFuture<Operation> future = regionDiskClient.deleteRegionDiskCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Disk getRegionDisk(ProjectRegionDiskName disk)
Sample code:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
ProjectRegionDiskName disk = ProjectRegionDiskName.of("[PROJECT]", "[REGION]", "[DISK]");
Disk response = regionDiskClient.getRegionDisk(disk);
}
disk
- Name of the regional persistent disk to return.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Disk getRegionDisk(String disk)
Sample code:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
ProjectRegionDiskName disk = ProjectRegionDiskName.of("[PROJECT]", "[REGION]", "[DISK]");
Disk response = regionDiskClient.getRegionDisk(disk.toString());
}
disk
- Name of the regional persistent disk to return.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Disk getRegionDisk(GetRegionDiskHttpRequest request)
Sample code:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
String formattedDisk = ProjectRegionDiskName.format("[PROJECT]", "[REGION]", "[DISK]");
GetRegionDiskHttpRequest request = GetRegionDiskHttpRequest.newBuilder()
.setDisk(formattedDisk)
.build();
Disk response = regionDiskClient.getRegionDisk(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<GetRegionDiskHttpRequest,Disk> getRegionDiskCallable()
Sample code:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
String formattedDisk = ProjectRegionDiskName.format("[PROJECT]", "[REGION]", "[DISK]");
GetRegionDiskHttpRequest request = GetRegionDiskHttpRequest.newBuilder()
.setDisk(formattedDisk)
.build();
ApiFuture<Disk> future = regionDiskClient.getRegionDiskCallable().futureCall(request);
// Do something
Disk response = future.get();
}
@BetaApi public final Operation insertRegionDisk(ProjectRegionName region, Disk diskResource)
Sample code:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
Disk diskResource = Disk.newBuilder().build();
Operation response = regionDiskClient.insertRegionDisk(region, diskResource);
}
region
- Name of the region for this request.diskResource
- Represents a Persistent Disk resource.
Persistent disks are required for running your VM instances. Create both boot and non-boot (data) persistent disks. For more information, read Persistent Disks. For more storage options, read Storage options.
The disks resource represents a zonal persistent disk. For more information, read Zonal persistent disks.
The regionDisks resource represents a regional persistent disk. For more information, read Regional resources. (== resource_for beta.disks ==) (== resource_for v1.disks ==) (== resource_for v1.regionDisks ==) (== resource_for beta.regionDisks ==)
com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation insertRegionDisk(String region, Disk diskResource)
Sample code:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
Disk diskResource = Disk.newBuilder().build();
Operation response = regionDiskClient.insertRegionDisk(region.toString(), diskResource);
}
region
- Name of the region for this request.diskResource
- Represents a Persistent Disk resource.
Persistent disks are required for running your VM instances. Create both boot and non-boot (data) persistent disks. For more information, read Persistent Disks. For more storage options, read Storage options.
The disks resource represents a zonal persistent disk. For more information, read Zonal persistent disks.
The regionDisks resource represents a regional persistent disk. For more information, read Regional resources. (== resource_for beta.disks ==) (== resource_for v1.disks ==) (== resource_for v1.regionDisks ==) (== resource_for beta.regionDisks ==)
com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation insertRegionDisk(InsertRegionDiskHttpRequest request)
Sample code:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
Disk diskResource = Disk.newBuilder().build();
InsertRegionDiskHttpRequest request = InsertRegionDiskHttpRequest.newBuilder()
.setRegion(formattedRegion)
.setDiskResource(diskResource)
.build();
Operation response = regionDiskClient.insertRegionDisk(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<InsertRegionDiskHttpRequest,Operation> insertRegionDiskCallable()
Sample code:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
Disk diskResource = Disk.newBuilder().build();
InsertRegionDiskHttpRequest request = InsertRegionDiskHttpRequest.newBuilder()
.setRegion(formattedRegion)
.setDiskResource(diskResource)
.build();
ApiFuture<Operation> future = regionDiskClient.insertRegionDiskCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final RegionDiskClient.ListRegionDisksPagedResponse listRegionDisks(ProjectRegionName region)
Sample code:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
for (Disk element : regionDiskClient.listRegionDisks(region).iterateAll()) {
// doThingsWith(element);
}
}
region
- Name of the region for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final RegionDiskClient.ListRegionDisksPagedResponse listRegionDisks(String region)
Sample code:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
for (Disk element : regionDiskClient.listRegionDisks(region.toString()).iterateAll()) {
// doThingsWith(element);
}
}
region
- Name of the region for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final RegionDiskClient.ListRegionDisksPagedResponse listRegionDisks(ListRegionDisksHttpRequest request)
Sample code:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
ListRegionDisksHttpRequest request = ListRegionDisksHttpRequest.newBuilder()
.setRegion(formattedRegion)
.build();
for (Disk element : regionDiskClient.listRegionDisks(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 fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<ListRegionDisksHttpRequest,RegionDiskClient.ListRegionDisksPagedResponse> listRegionDisksPagedCallable()
Sample code:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
ListRegionDisksHttpRequest request = ListRegionDisksHttpRequest.newBuilder()
.setRegion(formattedRegion)
.build();
ApiFuture<ListRegionDisksPagedResponse> future = regionDiskClient.listRegionDisksPagedCallable().futureCall(request);
// Do something
for (Disk element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final com.google.api.gax.rpc.UnaryCallable<ListRegionDisksHttpRequest,DiskList> listRegionDisksCallable()
Sample code:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
ListRegionDisksHttpRequest request = ListRegionDisksHttpRequest.newBuilder()
.setRegion(formattedRegion)
.build();
while (true) {
DiskList response = regionDiskClient.listRegionDisksCallable().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;
}
}
}
@BetaApi public final Operation removeResourcePoliciesRegionDisk(ProjectRegionDiskName disk, RegionDisksRemoveResourcePoliciesRequest regionDisksRemoveResourcePoliciesRequestResource)
Sample code:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
ProjectRegionDiskName disk = ProjectRegionDiskName.of("[PROJECT]", "[REGION]", "[DISK]");
RegionDisksRemoveResourcePoliciesRequest regionDisksRemoveResourcePoliciesRequestResource = RegionDisksRemoveResourcePoliciesRequest.newBuilder().build();
Operation response = regionDiskClient.removeResourcePoliciesRegionDisk(disk, regionDisksRemoveResourcePoliciesRequestResource);
}
disk
- The disk name for this request.regionDisksRemoveResourcePoliciesRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation removeResourcePoliciesRegionDisk(String disk, RegionDisksRemoveResourcePoliciesRequest regionDisksRemoveResourcePoliciesRequestResource)
Sample code:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
ProjectRegionDiskName disk = ProjectRegionDiskName.of("[PROJECT]", "[REGION]", "[DISK]");
RegionDisksRemoveResourcePoliciesRequest regionDisksRemoveResourcePoliciesRequestResource = RegionDisksRemoveResourcePoliciesRequest.newBuilder().build();
Operation response = regionDiskClient.removeResourcePoliciesRegionDisk(disk.toString(), regionDisksRemoveResourcePoliciesRequestResource);
}
disk
- The disk name for this request.regionDisksRemoveResourcePoliciesRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation removeResourcePoliciesRegionDisk(RemoveResourcePoliciesRegionDiskHttpRequest request)
Sample code:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
String formattedDisk = ProjectRegionDiskName.format("[PROJECT]", "[REGION]", "[DISK]");
RegionDisksRemoveResourcePoliciesRequest regionDisksRemoveResourcePoliciesRequestResource = RegionDisksRemoveResourcePoliciesRequest.newBuilder().build();
RemoveResourcePoliciesRegionDiskHttpRequest request = RemoveResourcePoliciesRegionDiskHttpRequest.newBuilder()
.setDisk(formattedDisk)
.setRegionDisksRemoveResourcePoliciesRequestResource(regionDisksRemoveResourcePoliciesRequestResource)
.build();
Operation response = regionDiskClient.removeResourcePoliciesRegionDisk(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<RemoveResourcePoliciesRegionDiskHttpRequest,Operation> removeResourcePoliciesRegionDiskCallable()
Sample code:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
String formattedDisk = ProjectRegionDiskName.format("[PROJECT]", "[REGION]", "[DISK]");
RegionDisksRemoveResourcePoliciesRequest regionDisksRemoveResourcePoliciesRequestResource = RegionDisksRemoveResourcePoliciesRequest.newBuilder().build();
RemoveResourcePoliciesRegionDiskHttpRequest request = RemoveResourcePoliciesRegionDiskHttpRequest.newBuilder()
.setDisk(formattedDisk)
.setRegionDisksRemoveResourcePoliciesRequestResource(regionDisksRemoveResourcePoliciesRequestResource)
.build();
ApiFuture<Operation> future = regionDiskClient.removeResourcePoliciesRegionDiskCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation resizeRegionDisk(ProjectRegionDiskName disk, RegionDisksResizeRequest regionDisksResizeRequestResource)
Sample code:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
ProjectRegionDiskName disk = ProjectRegionDiskName.of("[PROJECT]", "[REGION]", "[DISK]");
RegionDisksResizeRequest regionDisksResizeRequestResource = RegionDisksResizeRequest.newBuilder().build();
Operation response = regionDiskClient.resizeRegionDisk(disk, regionDisksResizeRequestResource);
}
disk
- Name of the regional persistent disk.regionDisksResizeRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation resizeRegionDisk(String disk, RegionDisksResizeRequest regionDisksResizeRequestResource)
Sample code:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
ProjectRegionDiskName disk = ProjectRegionDiskName.of("[PROJECT]", "[REGION]", "[DISK]");
RegionDisksResizeRequest regionDisksResizeRequestResource = RegionDisksResizeRequest.newBuilder().build();
Operation response = regionDiskClient.resizeRegionDisk(disk.toString(), regionDisksResizeRequestResource);
}
disk
- Name of the regional persistent disk.regionDisksResizeRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation resizeRegionDisk(ResizeRegionDiskHttpRequest request)
Sample code:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
String formattedDisk = ProjectRegionDiskName.format("[PROJECT]", "[REGION]", "[DISK]");
RegionDisksResizeRequest regionDisksResizeRequestResource = RegionDisksResizeRequest.newBuilder().build();
ResizeRegionDiskHttpRequest request = ResizeRegionDiskHttpRequest.newBuilder()
.setDisk(formattedDisk)
.setRegionDisksResizeRequestResource(regionDisksResizeRequestResource)
.build();
Operation response = regionDiskClient.resizeRegionDisk(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<ResizeRegionDiskHttpRequest,Operation> resizeRegionDiskCallable()
Sample code:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
String formattedDisk = ProjectRegionDiskName.format("[PROJECT]", "[REGION]", "[DISK]");
RegionDisksResizeRequest regionDisksResizeRequestResource = RegionDisksResizeRequest.newBuilder().build();
ResizeRegionDiskHttpRequest request = ResizeRegionDiskHttpRequest.newBuilder()
.setDisk(formattedDisk)
.setRegionDisksResizeRequestResource(regionDisksResizeRequestResource)
.build();
ApiFuture<Operation> future = regionDiskClient.resizeRegionDiskCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation setLabelsRegionDisk(ProjectRegionDiskResourceName resource, RegionSetLabelsRequest regionSetLabelsRequestResource)
Sample code:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
ProjectRegionDiskResourceName resource = ProjectRegionDiskResourceName.of("[PROJECT]", "[REGION]", "[RESOURCE]");
RegionSetLabelsRequest regionSetLabelsRequestResource = RegionSetLabelsRequest.newBuilder().build();
Operation response = regionDiskClient.setLabelsRegionDisk(resource, regionSetLabelsRequestResource);
}
resource
- Name or id of the resource for this request.regionSetLabelsRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation setLabelsRegionDisk(String resource, RegionSetLabelsRequest regionSetLabelsRequestResource)
Sample code:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
ProjectRegionDiskResourceName resource = ProjectRegionDiskResourceName.of("[PROJECT]", "[REGION]", "[RESOURCE]");
RegionSetLabelsRequest regionSetLabelsRequestResource = RegionSetLabelsRequest.newBuilder().build();
Operation response = regionDiskClient.setLabelsRegionDisk(resource.toString(), regionSetLabelsRequestResource);
}
resource
- Name or id of the resource for this request.regionSetLabelsRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation setLabelsRegionDisk(SetLabelsRegionDiskHttpRequest request)
Sample code:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
String formattedResource = ProjectRegionDiskResourceName.format("[PROJECT]", "[REGION]", "[RESOURCE]");
RegionSetLabelsRequest regionSetLabelsRequestResource = RegionSetLabelsRequest.newBuilder().build();
SetLabelsRegionDiskHttpRequest request = SetLabelsRegionDiskHttpRequest.newBuilder()
.setResource(formattedResource)
.setRegionSetLabelsRequestResource(regionSetLabelsRequestResource)
.build();
Operation response = regionDiskClient.setLabelsRegionDisk(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<SetLabelsRegionDiskHttpRequest,Operation> setLabelsRegionDiskCallable()
Sample code:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
String formattedResource = ProjectRegionDiskResourceName.format("[PROJECT]", "[REGION]", "[RESOURCE]");
RegionSetLabelsRequest regionSetLabelsRequestResource = RegionSetLabelsRequest.newBuilder().build();
SetLabelsRegionDiskHttpRequest request = SetLabelsRegionDiskHttpRequest.newBuilder()
.setResource(formattedResource)
.setRegionSetLabelsRequestResource(regionSetLabelsRequestResource)
.build();
ApiFuture<Operation> future = regionDiskClient.setLabelsRegionDiskCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final TestPermissionsResponse testIamPermissionsRegionDisk(ProjectRegionDiskResourceName resource, TestPermissionsRequest testPermissionsRequestResource)
Sample code:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
ProjectRegionDiskResourceName resource = ProjectRegionDiskResourceName.of("[PROJECT]", "[REGION]", "[RESOURCE]");
TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
TestPermissionsResponse response = regionDiskClient.testIamPermissionsRegionDisk(resource, testPermissionsRequestResource);
}
resource
- Name or id of the resource for this request.testPermissionsRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final TestPermissionsResponse testIamPermissionsRegionDisk(String resource, TestPermissionsRequest testPermissionsRequestResource)
Sample code:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
ProjectRegionDiskResourceName resource = ProjectRegionDiskResourceName.of("[PROJECT]", "[REGION]", "[RESOURCE]");
TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
TestPermissionsResponse response = regionDiskClient.testIamPermissionsRegionDisk(resource.toString(), testPermissionsRequestResource);
}
resource
- Name or id of the resource for this request.testPermissionsRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final TestPermissionsResponse testIamPermissionsRegionDisk(TestIamPermissionsRegionDiskHttpRequest request)
Sample code:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
String formattedResource = ProjectRegionDiskResourceName.format("[PROJECT]", "[REGION]", "[RESOURCE]");
TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
TestIamPermissionsRegionDiskHttpRequest request = TestIamPermissionsRegionDiskHttpRequest.newBuilder()
.setResource(formattedResource)
.setTestPermissionsRequestResource(testPermissionsRequestResource)
.build();
TestPermissionsResponse response = regionDiskClient.testIamPermissionsRegionDisk(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<TestIamPermissionsRegionDiskHttpRequest,TestPermissionsResponse> testIamPermissionsRegionDiskCallable()
Sample code:
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
String formattedResource = ProjectRegionDiskResourceName.format("[PROJECT]", "[REGION]", "[RESOURCE]");
TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
TestIamPermissionsRegionDiskHttpRequest request = TestIamPermissionsRegionDiskHttpRequest.newBuilder()
.setResource(formattedResource)
.setTestPermissionsRequestResource(testPermissionsRequestResource)
.build();
ApiFuture<TestPermissionsResponse> future = regionDiskClient.testIamPermissionsRegionDiskCallable().futureCall(request);
// Do something
TestPermissionsResponse response = future.get();
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isShutdown()
isShutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isTerminated()
isTerminated
in interface com.google.api.gax.core.BackgroundResource
public void shutdownNow()
shutdownNow
in interface com.google.api.gax.core.BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface com.google.api.gax.core.BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.