@Generated(value="by gapic-generator") @BetaApi public class RegionDiskClient extends Object implements 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]");
Snapshot snapshotResource = Snapshot.newBuilder().build();
Operation response = regionDiskClient.createSnapshotRegionDisk(disk, snapshotResource);
}
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 |
---|---|
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.
|
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.
|
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.
|
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.
|
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.
|
UnaryCallable<ListRegionDisksHttpRequest,DiskList> |
listRegionDisksCallable()
Retrieves the list of persistent disks contained within the specified region.
|
UnaryCallable<ListRegionDisksHttpRequest,RegionDiskClient.ListRegionDisksPagedResponse> |
listRegionDisksPagedCallable()
Retrieves the list of persistent disks contained within the specified region.
|
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.
|
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.
|
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.
|
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 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
- A persistent disk snapshot resource. (== resource_for beta.snapshots
==) (== resource_for v1.snapshots ==)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
- A persistent disk snapshot resource. (== resource_for beta.snapshots
==) (== resource_for v1.snapshots ==)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.ApiException
- if the remote call fails@BetaApi public final 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.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.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.ApiException
- if the remote call fails@BetaApi public final 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.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.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.ApiException
- if the remote call fails@BetaApi public final 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
- A Disk resource. (== resource_for beta.disks ==) (== resource_for v1.disks
==)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
- A Disk resource. (== resource_for beta.disks ==) (== resource_for v1.disks
==)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.ApiException
- if the remote call fails@BetaApi public final 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.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.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.ApiException
- if the remote call fails@BetaApi public final 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 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 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
- 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
- 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.ApiException
- if the remote call fails@BetaApi public final 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
- 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
- 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.ApiException
- if the remote call fails@BetaApi public final 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
- 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
- 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.ApiException
- if the remote call fails@BetaApi public final 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 BackgroundResource
public boolean isShutdown()
isShutdown
in interface BackgroundResource
public boolean isTerminated()
isTerminated
in interface BackgroundResource
public void shutdownNow()
shutdownNow
in interface BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.