- 1.65.0 (latest)
- 1.64.0
- 1.63.0
- 1.62.0
- 1.61.0
- 1.59.0
- 1.58.0
- 1.57.0
- 1.56.0
- 1.55.0
- 1.54.0
- 1.53.0
- 1.52.0
- 1.51.0
- 1.50.0
- 1.49.0
- 1.47.0
- 1.46.0
- 1.45.0
- 1.44.0
- 1.43.0
- 1.42.0
- 1.41.0
- 1.40.0
- 1.39.0
- 1.38.0
- 1.37.0
- 1.34.0
- 1.33.0
- 1.32.0
- 1.31.0
- 1.30.0
- 1.29.0
- 1.28.0
- 1.27.0
- 1.26.0
- 1.25.0
- 1.24.0
- 1.23.0
- 1.22.0
- 1.21.0
- 1.20.0
- 1.19.0
- 1.18.0
- 1.17.0
- 1.16.0
- 1.15.0
- 1.14.0
- 1.13.0
- 1.12.1
- 1.11.0
- 1.9.1
- 1.8.1
- 1.7.2
- 1.6.0-beta
public class SnapshotsClient implements BackgroundResource
Service Description: The Snapshots API.
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (SnapshotsClient snapshotsClient = SnapshotsClient.create()) {
String project = "project-309310695";
String snapshot = "snapshot284874180";
Snapshot response = snapshotsClient.get(project, snapshot);
}
Note: close() needs to be called on the SnapshotsClient 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:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of SnapshotsSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
SnapshotsSettings snapshotsSettings =
SnapshotsSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
SnapshotsClient snapshotsClient = SnapshotsClient.create(snapshotsSettings);
To customize the endpoint:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
SnapshotsSettings snapshotsSettings =
SnapshotsSettings.newBuilder().setEndpoint(myEndpoint).build();
SnapshotsClient snapshotsClient = SnapshotsClient.create(snapshotsSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Implements
BackgroundResourceStatic Methods
create()
public static final SnapshotsClient create()
Constructs an instance of SnapshotsClient with default settings.
Type | Description |
SnapshotsClient |
Type | Description |
IOException |
create(SnapshotsSettings settings)
public static final SnapshotsClient create(SnapshotsSettings settings)
Constructs an instance of SnapshotsClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
Name | Description |
settings | SnapshotsSettings |
Type | Description |
SnapshotsClient |
Type | Description |
IOException |
create(SnapshotsStub stub)
public static final SnapshotsClient create(SnapshotsStub stub)
Constructs an instance of SnapshotsClient, using the given stub for making calls. This is for advanced usage - prefer using create(SnapshotsSettings).
Name | Description |
stub | SnapshotsStub |
Type | Description |
SnapshotsClient |
Constructors
SnapshotsClient(SnapshotsSettings settings)
protected SnapshotsClient(SnapshotsSettings settings)
Constructs an instance of SnapshotsClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
Name | Description |
settings | SnapshotsSettings |
SnapshotsClient(SnapshotsStub stub)
protected SnapshotsClient(SnapshotsStub stub)
Name | Description |
stub | SnapshotsStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)
Name | Description |
duration | long |
unit | TimeUnit |
Type | Description |
boolean |
Type | Description |
InterruptedException |
close()
public final void close()
deleteAsync(DeleteSnapshotRequest request)
public final OperationFuture<Operation,Operation> deleteAsync(DeleteSnapshotRequest request)
Deletes the specified Snapshot resource. Keep in mind that deleting a single snapshot might not necessarily delete all the data on that snapshot. If any data on the snapshot that is marked for deletion is needed for subsequent snapshots, the data will be moved to the next corresponding snapshot. For more information, see Deleting snapshots.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (SnapshotsClient snapshotsClient = SnapshotsClient.create()) {
DeleteSnapshotRequest request =
DeleteSnapshotRequest.newBuilder()
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setSnapshot("snapshot284874180")
.build();
Operation response = snapshotsClient.deleteAsync(request).get();
}
Name | Description |
request | DeleteSnapshotRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
deleteAsync(String project, String snapshot)
public final OperationFuture<Operation,Operation> deleteAsync(String project, String snapshot)
Deletes the specified Snapshot resource. Keep in mind that deleting a single snapshot might not necessarily delete all the data on that snapshot. If any data on the snapshot that is marked for deletion is needed for subsequent snapshots, the data will be moved to the next corresponding snapshot. For more information, see Deleting snapshots.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (SnapshotsClient snapshotsClient = SnapshotsClient.create()) {
String project = "project-309310695";
String snapshot = "snapshot284874180";
Operation response = snapshotsClient.deleteAsync(project, snapshot).get();
}
Name | Description |
project | String Project ID for this request. |
snapshot | String Name of the Snapshot resource to delete. |
Type | Description |
OperationFuture<Operation,Operation> |
deleteCallable()
public final UnaryCallable<DeleteSnapshotRequest,Operation> deleteCallable()
Deletes the specified Snapshot resource. Keep in mind that deleting a single snapshot might not necessarily delete all the data on that snapshot. If any data on the snapshot that is marked for deletion is needed for subsequent snapshots, the data will be moved to the next corresponding snapshot. For more information, see Deleting snapshots.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (SnapshotsClient snapshotsClient = SnapshotsClient.create()) {
DeleteSnapshotRequest request =
DeleteSnapshotRequest.newBuilder()
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setSnapshot("snapshot284874180")
.build();
ApiFuture<Operation> future = snapshotsClient.deleteCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<DeleteSnapshotRequest,Operation> |
deleteOperationCallable()
public final OperationCallable<DeleteSnapshotRequest,Operation,Operation> deleteOperationCallable()
Deletes the specified Snapshot resource. Keep in mind that deleting a single snapshot might not necessarily delete all the data on that snapshot. If any data on the snapshot that is marked for deletion is needed for subsequent snapshots, the data will be moved to the next corresponding snapshot. For more information, see Deleting snapshots.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (SnapshotsClient snapshotsClient = SnapshotsClient.create()) {
DeleteSnapshotRequest request =
DeleteSnapshotRequest.newBuilder()
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setSnapshot("snapshot284874180")
.build();
OperationFuture<Operation, Operation> future =
snapshotsClient.deleteOperationCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
OperationCallable<DeleteSnapshotRequest,Operation,Operation> |
get(GetSnapshotRequest request)
public final Snapshot get(GetSnapshotRequest request)
Returns the specified Snapshot resource. Gets a list of available snapshots by making a list() request.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (SnapshotsClient snapshotsClient = SnapshotsClient.create()) {
GetSnapshotRequest request =
GetSnapshotRequest.newBuilder()
.setProject("project-309310695")
.setSnapshot("snapshot284874180")
.build();
Snapshot response = snapshotsClient.get(request);
}
Name | Description |
request | GetSnapshotRequest The request object containing all of the parameters for the API call. |
Type | Description |
Snapshot |
get(String project, String snapshot)
public final Snapshot get(String project, String snapshot)
Returns the specified Snapshot resource. Gets a list of available snapshots by making a list() request.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (SnapshotsClient snapshotsClient = SnapshotsClient.create()) {
String project = "project-309310695";
String snapshot = "snapshot284874180";
Snapshot response = snapshotsClient.get(project, snapshot);
}
Name | Description |
project | String Project ID for this request. |
snapshot | String Name of the Snapshot resource to return. |
Type | Description |
Snapshot |
getCallable()
public final UnaryCallable<GetSnapshotRequest,Snapshot> getCallable()
Returns the specified Snapshot resource. Gets a list of available snapshots by making a list() request.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (SnapshotsClient snapshotsClient = SnapshotsClient.create()) {
GetSnapshotRequest request =
GetSnapshotRequest.newBuilder()
.setProject("project-309310695")
.setSnapshot("snapshot284874180")
.build();
ApiFuture<Snapshot> future = snapshotsClient.getCallable().futureCall(request);
// Do something.
Snapshot response = future.get();
}
Type | Description |
UnaryCallable<GetSnapshotRequest,Snapshot> |
getIamPolicy(GetIamPolicySnapshotRequest request)
public final Policy getIamPolicy(GetIamPolicySnapshotRequest request)
Gets the access control policy for a resource. May be empty if no such policy or resource exists.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (SnapshotsClient snapshotsClient = SnapshotsClient.create()) {
GetIamPolicySnapshotRequest request =
GetIamPolicySnapshotRequest.newBuilder()
.setOptionsRequestedPolicyVersion(-574521795)
.setProject("project-309310695")
.setResource("resource-341064690")
.build();
Policy response = snapshotsClient.getIamPolicy(request);
}
Name | Description |
request | GetIamPolicySnapshotRequest The request object containing all of the parameters for the API call. |
Type | Description |
Policy |
getIamPolicy(String project, String resource)
public final Policy getIamPolicy(String project, String resource)
Gets the access control policy for a resource. May be empty if no such policy or resource exists.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (SnapshotsClient snapshotsClient = SnapshotsClient.create()) {
String project = "project-309310695";
String resource = "resource-341064690";
Policy response = snapshotsClient.getIamPolicy(project, resource);
}
Name | Description |
project | String Project ID for this request. |
resource | String Name or id of the resource for this request. |
Type | Description |
Policy |
getIamPolicyCallable()
public final UnaryCallable<GetIamPolicySnapshotRequest,Policy> getIamPolicyCallable()
Gets the access control policy for a resource. May be empty if no such policy or resource exists.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (SnapshotsClient snapshotsClient = SnapshotsClient.create()) {
GetIamPolicySnapshotRequest request =
GetIamPolicySnapshotRequest.newBuilder()
.setOptionsRequestedPolicyVersion(-574521795)
.setProject("project-309310695")
.setResource("resource-341064690")
.build();
ApiFuture<Policy> future = snapshotsClient.getIamPolicyCallable().futureCall(request);
// Do something.
Policy response = future.get();
}
Type | Description |
UnaryCallable<GetIamPolicySnapshotRequest,Policy> |
getSettings()
public final SnapshotsSettings getSettings()
Type | Description |
SnapshotsSettings |
getStub()
public SnapshotsStub getStub()
Type | Description |
SnapshotsStub |
insertAsync(InsertSnapshotRequest request)
public final OperationFuture<Operation,Operation> insertAsync(InsertSnapshotRequest request)
Creates a snapshot in the specified project using the data included in the request. For regular snapshot creation, consider using this method instead of disks.createSnapshot, as this method supports more features, such as creating snapshots in a project different from the source disk project.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (SnapshotsClient snapshotsClient = SnapshotsClient.create()) {
InsertSnapshotRequest request =
InsertSnapshotRequest.newBuilder()
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setSnapshotResource(Snapshot.newBuilder().build())
.build();
Operation response = snapshotsClient.insertAsync(request).get();
}
Name | Description |
request | InsertSnapshotRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
insertAsync(String project, Snapshot snapshotResource)
public final OperationFuture<Operation,Operation> insertAsync(String project, Snapshot snapshotResource)
Creates a snapshot in the specified project using the data included in the request. For regular snapshot creation, consider using this method instead of disks.createSnapshot, as this method supports more features, such as creating snapshots in a project different from the source disk project.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (SnapshotsClient snapshotsClient = SnapshotsClient.create()) {
String project = "project-309310695";
Snapshot snapshotResource = Snapshot.newBuilder().build();
Operation response = snapshotsClient.insertAsync(project, snapshotResource).get();
}
Name | Description |
project | String Project ID for this request. |
snapshotResource | Snapshot The body resource for this request |
Type | Description |
OperationFuture<Operation,Operation> |
insertCallable()
public final UnaryCallable<InsertSnapshotRequest,Operation> insertCallable()
Creates a snapshot in the specified project using the data included in the request. For regular snapshot creation, consider using this method instead of disks.createSnapshot, as this method supports more features, such as creating snapshots in a project different from the source disk project.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (SnapshotsClient snapshotsClient = SnapshotsClient.create()) {
InsertSnapshotRequest request =
InsertSnapshotRequest.newBuilder()
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setSnapshotResource(Snapshot.newBuilder().build())
.build();
ApiFuture<Operation> future = snapshotsClient.insertCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<InsertSnapshotRequest,Operation> |
insertOperationCallable()
public final OperationCallable<InsertSnapshotRequest,Operation,Operation> insertOperationCallable()
Creates a snapshot in the specified project using the data included in the request. For regular snapshot creation, consider using this method instead of disks.createSnapshot, as this method supports more features, such as creating snapshots in a project different from the source disk project.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (SnapshotsClient snapshotsClient = SnapshotsClient.create()) {
InsertSnapshotRequest request =
InsertSnapshotRequest.newBuilder()
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setSnapshotResource(Snapshot.newBuilder().build())
.build();
OperationFuture<Operation, Operation> future =
snapshotsClient.insertOperationCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
OperationCallable<InsertSnapshotRequest,Operation,Operation> |
isShutdown()
public boolean isShutdown()
Type | Description |
boolean |
isTerminated()
public boolean isTerminated()
Type | Description |
boolean |
list(ListSnapshotsRequest request)
public final SnapshotsClient.ListPagedResponse list(ListSnapshotsRequest request)
Retrieves the list of Snapshot resources contained within the specified project.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (SnapshotsClient snapshotsClient = SnapshotsClient.create()) {
ListSnapshotsRequest request =
ListSnapshotsRequest.newBuilder()
.setFilter("filter-1274492040")
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.build();
for (Snapshot element : snapshotsClient.list(request).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
request | ListSnapshotsRequest The request object containing all of the parameters for the API call. |
Type | Description |
SnapshotsClient.ListPagedResponse |
list(String project)
public final SnapshotsClient.ListPagedResponse list(String project)
Retrieves the list of Snapshot resources contained within the specified project.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (SnapshotsClient snapshotsClient = SnapshotsClient.create()) {
String project = "project-309310695";
for (Snapshot element : snapshotsClient.list(project).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
project | String Project ID for this request. |
Type | Description |
SnapshotsClient.ListPagedResponse |
listCallable()
public final UnaryCallable<ListSnapshotsRequest,SnapshotList> listCallable()
Retrieves the list of Snapshot resources contained within the specified project.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (SnapshotsClient snapshotsClient = SnapshotsClient.create()) {
ListSnapshotsRequest request =
ListSnapshotsRequest.newBuilder()
.setFilter("filter-1274492040")
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.build();
while (true) {
SnapshotList response = snapshotsClient.listCallable().call(request);
for (Snapshot element : response.getItemsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Type | Description |
UnaryCallable<ListSnapshotsRequest,SnapshotList> |
listPagedCallable()
public final UnaryCallable<ListSnapshotsRequest,SnapshotsClient.ListPagedResponse> listPagedCallable()
Retrieves the list of Snapshot resources contained within the specified project.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (SnapshotsClient snapshotsClient = SnapshotsClient.create()) {
ListSnapshotsRequest request =
ListSnapshotsRequest.newBuilder()
.setFilter("filter-1274492040")
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.build();
ApiFuture<Snapshot> future = snapshotsClient.listPagedCallable().futureCall(request);
// Do something.
for (Snapshot element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Type | Description |
UnaryCallable<ListSnapshotsRequest,ListPagedResponse> |
setIamPolicy(SetIamPolicySnapshotRequest request)
public final Policy setIamPolicy(SetIamPolicySnapshotRequest request)
Sets the access control policy on the specified resource. Replaces any existing policy.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (SnapshotsClient snapshotsClient = SnapshotsClient.create()) {
SetIamPolicySnapshotRequest request =
SetIamPolicySnapshotRequest.newBuilder()
.setGlobalSetPolicyRequestResource(GlobalSetPolicyRequest.newBuilder().build())
.setProject("project-309310695")
.setResource("resource-341064690")
.build();
Policy response = snapshotsClient.setIamPolicy(request);
}
Name | Description |
request | SetIamPolicySnapshotRequest The request object containing all of the parameters for the API call. |
Type | Description |
Policy |
setIamPolicy(String project, String resource, GlobalSetPolicyRequest globalSetPolicyRequestResource)
public final Policy setIamPolicy(String project, String resource, GlobalSetPolicyRequest globalSetPolicyRequestResource)
Sets the access control policy on the specified resource. Replaces any existing policy.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (SnapshotsClient snapshotsClient = SnapshotsClient.create()) {
String project = "project-309310695";
String resource = "resource-341064690";
GlobalSetPolicyRequest globalSetPolicyRequestResource =
GlobalSetPolicyRequest.newBuilder().build();
Policy response =
snapshotsClient.setIamPolicy(project, resource, globalSetPolicyRequestResource);
}
Name | Description |
project | String Project ID for this request. |
resource | String Name or id of the resource for this request. |
globalSetPolicyRequestResource | GlobalSetPolicyRequest The body resource for this request |
Type | Description |
Policy |
setIamPolicyCallable()
public final UnaryCallable<SetIamPolicySnapshotRequest,Policy> setIamPolicyCallable()
Sets the access control policy on the specified resource. Replaces any existing policy.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (SnapshotsClient snapshotsClient = SnapshotsClient.create()) {
SetIamPolicySnapshotRequest request =
SetIamPolicySnapshotRequest.newBuilder()
.setGlobalSetPolicyRequestResource(GlobalSetPolicyRequest.newBuilder().build())
.setProject("project-309310695")
.setResource("resource-341064690")
.build();
ApiFuture<Policy> future = snapshotsClient.setIamPolicyCallable().futureCall(request);
// Do something.
Policy response = future.get();
}
Type | Description |
UnaryCallable<SetIamPolicySnapshotRequest,Policy> |
setLabelsAsync(SetLabelsSnapshotRequest request)
public final OperationFuture<Operation,Operation> setLabelsAsync(SetLabelsSnapshotRequest request)
Sets the labels on a snapshot. To learn more about labels, read the Labeling Resources documentation.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (SnapshotsClient snapshotsClient = SnapshotsClient.create()) {
SetLabelsSnapshotRequest request =
SetLabelsSnapshotRequest.newBuilder()
.setGlobalSetLabelsRequestResource(GlobalSetLabelsRequest.newBuilder().build())
.setProject("project-309310695")
.setResource("resource-341064690")
.build();
Operation response = snapshotsClient.setLabelsAsync(request).get();
}
Name | Description |
request | SetLabelsSnapshotRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
setLabelsAsync(String project, String resource, GlobalSetLabelsRequest globalSetLabelsRequestResource)
public final OperationFuture<Operation,Operation> setLabelsAsync(String project, String resource, GlobalSetLabelsRequest globalSetLabelsRequestResource)
Sets the labels on a snapshot. To learn more about labels, read the Labeling Resources documentation.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (SnapshotsClient snapshotsClient = SnapshotsClient.create()) {
String project = "project-309310695";
String resource = "resource-341064690";
GlobalSetLabelsRequest globalSetLabelsRequestResource =
GlobalSetLabelsRequest.newBuilder().build();
Operation response =
snapshotsClient.setLabelsAsync(project, resource, globalSetLabelsRequestResource).get();
}
Name | Description |
project | String Project ID for this request. |
resource | String Name or id of the resource for this request. |
globalSetLabelsRequestResource | GlobalSetLabelsRequest The body resource for this request |
Type | Description |
OperationFuture<Operation,Operation> |
setLabelsCallable()
public final UnaryCallable<SetLabelsSnapshotRequest,Operation> setLabelsCallable()
Sets the labels on a snapshot. To learn more about labels, read the Labeling Resources documentation.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (SnapshotsClient snapshotsClient = SnapshotsClient.create()) {
SetLabelsSnapshotRequest request =
SetLabelsSnapshotRequest.newBuilder()
.setGlobalSetLabelsRequestResource(GlobalSetLabelsRequest.newBuilder().build())
.setProject("project-309310695")
.setResource("resource-341064690")
.build();
ApiFuture<Operation> future = snapshotsClient.setLabelsCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<SetLabelsSnapshotRequest,Operation> |
setLabelsOperationCallable()
public final OperationCallable<SetLabelsSnapshotRequest,Operation,Operation> setLabelsOperationCallable()
Sets the labels on a snapshot. To learn more about labels, read the Labeling Resources documentation.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (SnapshotsClient snapshotsClient = SnapshotsClient.create()) {
SetLabelsSnapshotRequest request =
SetLabelsSnapshotRequest.newBuilder()
.setGlobalSetLabelsRequestResource(GlobalSetLabelsRequest.newBuilder().build())
.setProject("project-309310695")
.setResource("resource-341064690")
.build();
OperationFuture<Operation, Operation> future =
snapshotsClient.setLabelsOperationCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
OperationCallable<SetLabelsSnapshotRequest,Operation,Operation> |
shutdown()
public void shutdown()
shutdownNow()
public void shutdownNow()
testIamPermissions(TestIamPermissionsSnapshotRequest request)
public final TestPermissionsResponse testIamPermissions(TestIamPermissionsSnapshotRequest request)
Returns permissions that a caller has on the specified resource.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (SnapshotsClient snapshotsClient = SnapshotsClient.create()) {
TestIamPermissionsSnapshotRequest request =
TestIamPermissionsSnapshotRequest.newBuilder()
.setProject("project-309310695")
.setResource("resource-341064690")
.setTestPermissionsRequestResource(TestPermissionsRequest.newBuilder().build())
.build();
TestPermissionsResponse response = snapshotsClient.testIamPermissions(request);
}
Name | Description |
request | TestIamPermissionsSnapshotRequest The request object containing all of the parameters for the API call. |
Type | Description |
TestPermissionsResponse |
testIamPermissions(String project, String resource, TestPermissionsRequest testPermissionsRequestResource)
public final TestPermissionsResponse testIamPermissions(String project, String resource, TestPermissionsRequest testPermissionsRequestResource)
Returns permissions that a caller has on the specified resource.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (SnapshotsClient snapshotsClient = SnapshotsClient.create()) {
String project = "project-309310695";
String resource = "resource-341064690";
TestPermissionsRequest testPermissionsRequestResource =
TestPermissionsRequest.newBuilder().build();
TestPermissionsResponse response =
snapshotsClient.testIamPermissions(project, resource, testPermissionsRequestResource);
}
Name | Description |
project | String Project ID for this request. |
resource | String Name or id of the resource for this request. |
testPermissionsRequestResource | TestPermissionsRequest The body resource for this request |
Type | Description |
TestPermissionsResponse |
testIamPermissionsCallable()
public final UnaryCallable<TestIamPermissionsSnapshotRequest,TestPermissionsResponse> testIamPermissionsCallable()
Returns permissions that a caller has on the specified resource.
Sample code:
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (SnapshotsClient snapshotsClient = SnapshotsClient.create()) {
TestIamPermissionsSnapshotRequest request =
TestIamPermissionsSnapshotRequest.newBuilder()
.setProject("project-309310695")
.setResource("resource-341064690")
.setTestPermissionsRequestResource(TestPermissionsRequest.newBuilder().build())
.build();
ApiFuture<TestPermissionsResponse> future =
snapshotsClient.testIamPermissionsCallable().futureCall(request);
// Do something.
TestPermissionsResponse response = future.get();
}
Type | Description |
UnaryCallable<TestIamPermissionsSnapshotRequest,TestPermissionsResponse> |