GitHub Repository | Product Reference |
Service Description: Storage Batch Operations offers a managed experience to perform batch operations on millions of Cloud Storage objects in a serverless fashion. With this service, you can automate and simplify large scale API operations performed on Cloud Storage objects.
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (StorageBatchOperationsClient storageBatchOperationsClient =
StorageBatchOperationsClient.create()) {
JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]");
Job response = storageBatchOperationsClient.getJob(name);
}
Note: close() needs to be called on the StorageBatchOperationsClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
Method | Description | Method Variants |
---|---|---|
ListJobs |
Lists Jobs in a given project. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetJob |
Gets a batch job. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreateJob |
Creates a batch job. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteJob |
Deletes a batch job. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CancelJob |
Cancels a batch job. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListLocations |
Lists information about the supported locations for this service. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetLocation |
Gets information about a location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of StorageBatchOperationsSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
StorageBatchOperationsSettings storageBatchOperationsSettings =
StorageBatchOperationsSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
StorageBatchOperationsClient storageBatchOperationsClient =
StorageBatchOperationsClient.create(storageBatchOperationsSettings);
To customize the endpoint:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
StorageBatchOperationsSettings storageBatchOperationsSettings =
StorageBatchOperationsSettings.newBuilder().setEndpoint(myEndpoint).build();
StorageBatchOperationsClient storageBatchOperationsClient =
StorageBatchOperationsClient.create(storageBatchOperationsSettings);
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
StorageBatchOperationsSettings storageBatchOperationsSettings =
StorageBatchOperationsSettings.newHttpJsonBuilder().build();
StorageBatchOperationsClient storageBatchOperationsClient =
StorageBatchOperationsClient.create(storageBatchOperationsSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Static Methods
create()
public static final StorageBatchOperationsClient create()
Constructs an instance of StorageBatchOperationsClient with default settings.
Returns | |
---|---|
Type | Description |
StorageBatchOperationsClient |
Exceptions | |
---|---|
Type | Description |
IOException |
create(StorageBatchOperationsSettings settings)
public static final StorageBatchOperationsClient create(StorageBatchOperationsSettings settings)
Constructs an instance of StorageBatchOperationsClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
Parameter | |
---|---|
Name | Description |
settings |
StorageBatchOperationsSettings |
Returns | |
---|---|
Type | Description |
StorageBatchOperationsClient |
Exceptions | |
---|---|
Type | Description |
IOException |
create(StorageBatchOperationsStub stub)
public static final StorageBatchOperationsClient create(StorageBatchOperationsStub stub)
Constructs an instance of StorageBatchOperationsClient, using the given stub for making calls. This is for advanced usage - prefer using create(StorageBatchOperationsSettings).
Parameter | |
---|---|
Name | Description |
stub |
StorageBatchOperationsStub |
Returns | |
---|---|
Type | Description |
StorageBatchOperationsClient |
Constructors
StorageBatchOperationsClient(StorageBatchOperationsSettings settings)
protected StorageBatchOperationsClient(StorageBatchOperationsSettings settings)
Constructs an instance of StorageBatchOperationsClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
Parameter | |
---|---|
Name | Description |
settings |
StorageBatchOperationsSettings |
StorageBatchOperationsClient(StorageBatchOperationsStub stub)
protected StorageBatchOperationsClient(StorageBatchOperationsStub stub)
Parameter | |
---|---|
Name | Description |
stub |
StorageBatchOperationsStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)
Parameters | |
---|---|
Name | Description |
duration |
long |
unit |
TimeUnit |
Returns | |
---|---|
Type | Description |
boolean |
Exceptions | |
---|---|
Type | Description |
InterruptedException |
cancelJob(CancelJobRequest request)
public final CancelJobResponse cancelJob(CancelJobRequest request)
Cancels a batch job.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (StorageBatchOperationsClient storageBatchOperationsClient =
StorageBatchOperationsClient.create()) {
CancelJobRequest request =
CancelJobRequest.newBuilder()
.setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
.setRequestId("requestId693933066")
.build();
CancelJobResponse response = storageBatchOperationsClient.cancelJob(request);
}
Parameter | |
---|---|
Name | Description |
request |
CancelJobRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
CancelJobResponse |
cancelJob(JobName name)
public final CancelJobResponse cancelJob(JobName name)
Cancels a batch job.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (StorageBatchOperationsClient storageBatchOperationsClient =
StorageBatchOperationsClient.create()) {
JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]");
CancelJobResponse response = storageBatchOperationsClient.cancelJob(name);
}
Parameter | |
---|---|
Name | Description |
name |
JobName Required. The |
Returns | |
---|---|
Type | Description |
CancelJobResponse |
cancelJob(String name)
public final CancelJobResponse cancelJob(String name)
Cancels a batch job.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (StorageBatchOperationsClient storageBatchOperationsClient =
StorageBatchOperationsClient.create()) {
String name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString();
CancelJobResponse response = storageBatchOperationsClient.cancelJob(name);
}
Parameter | |
---|---|
Name | Description |
name |
String Required. The |
Returns | |
---|---|
Type | Description |
CancelJobResponse |
cancelJobCallable()
public final UnaryCallable<CancelJobRequest,CancelJobResponse> cancelJobCallable()
Cancels a batch job.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (StorageBatchOperationsClient storageBatchOperationsClient =
StorageBatchOperationsClient.create()) {
CancelJobRequest request =
CancelJobRequest.newBuilder()
.setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
.setRequestId("requestId693933066")
.build();
ApiFuture<CancelJobResponse> future =
storageBatchOperationsClient.cancelJobCallable().futureCall(request);
// Do something.
CancelJobResponse response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<CancelJobRequest,CancelJobResponse> |
close()
public final void close()
createJobAsync(CreateJobRequest request)
public final OperationFuture<Job,OperationMetadata> createJobAsync(CreateJobRequest request)
Creates a batch job.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (StorageBatchOperationsClient storageBatchOperationsClient =
StorageBatchOperationsClient.create()) {
CreateJobRequest request =
CreateJobRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setJobId("jobId101296568")
.setJob(Job.newBuilder().build())
.setRequestId("requestId693933066")
.build();
Job response = storageBatchOperationsClient.createJobAsync(request).get();
}
Parameter | |
---|---|
Name | Description |
request |
CreateJobRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OperationFuture<Job,OperationMetadata> |
createJobAsync(LocationName parent, Job job, String jobId)
public final OperationFuture<Job,OperationMetadata> createJobAsync(LocationName parent, Job job, String jobId)
Creates a batch job.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (StorageBatchOperationsClient storageBatchOperationsClient =
StorageBatchOperationsClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
Job job = Job.newBuilder().build();
String jobId = "jobId101296568";
Job response = storageBatchOperationsClient.createJobAsync(parent, job, jobId).get();
}
Parameters | |
---|---|
Name | Description |
parent |
LocationName Required. Value for parent. |
job |
Job Required. The resource being created |
jobId |
String Required. The optional |
Returns | |
---|---|
Type | Description |
OperationFuture<Job,OperationMetadata> |
createJobAsync(String parent, Job job, String jobId)
public final OperationFuture<Job,OperationMetadata> createJobAsync(String parent, Job job, String jobId)
Creates a batch job.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (StorageBatchOperationsClient storageBatchOperationsClient =
StorageBatchOperationsClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
Job job = Job.newBuilder().build();
String jobId = "jobId101296568";
Job response = storageBatchOperationsClient.createJobAsync(parent, job, jobId).get();
}
Parameters | |
---|---|
Name | Description |
parent |
String Required. Value for parent. |
job |
Job Required. The resource being created |
jobId |
String Required. The optional |
Returns | |
---|---|
Type | Description |
OperationFuture<Job,OperationMetadata> |
createJobCallable()
public final UnaryCallable<CreateJobRequest,Operation> createJobCallable()
Creates a batch job.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (StorageBatchOperationsClient storageBatchOperationsClient =
StorageBatchOperationsClient.create()) {
CreateJobRequest request =
CreateJobRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setJobId("jobId101296568")
.setJob(Job.newBuilder().build())
.setRequestId("requestId693933066")
.build();
ApiFuture<Operation> future =
storageBatchOperationsClient.createJobCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<CreateJobRequest,Operation> |
createJobOperationCallable()
public final OperationCallable<CreateJobRequest,Job,OperationMetadata> createJobOperationCallable()
Creates a batch job.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (StorageBatchOperationsClient storageBatchOperationsClient =
StorageBatchOperationsClient.create()) {
CreateJobRequest request =
CreateJobRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setJobId("jobId101296568")
.setJob(Job.newBuilder().build())
.setRequestId("requestId693933066")
.build();
OperationFuture<Job, OperationMetadata> future =
storageBatchOperationsClient.createJobOperationCallable().futureCall(request);
// Do something.
Job response = future.get();
}
Returns | |
---|---|
Type | Description |
OperationCallable<CreateJobRequest,Job,OperationMetadata> |
deleteJob(DeleteJobRequest request)
public final void deleteJob(DeleteJobRequest request)
Deletes a batch job.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (StorageBatchOperationsClient storageBatchOperationsClient =
StorageBatchOperationsClient.create()) {
DeleteJobRequest request =
DeleteJobRequest.newBuilder()
.setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
.setRequestId("requestId693933066")
.build();
storageBatchOperationsClient.deleteJob(request);
}
Parameter | |
---|---|
Name | Description |
request |
DeleteJobRequest The request object containing all of the parameters for the API call. |
deleteJob(JobName name)
public final void deleteJob(JobName name)
Deletes a batch job.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (StorageBatchOperationsClient storageBatchOperationsClient =
StorageBatchOperationsClient.create()) {
JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]");
storageBatchOperationsClient.deleteJob(name);
}
Parameter | |
---|---|
Name | Description |
name |
JobName Required. The |
deleteJob(String name)
public final void deleteJob(String name)
Deletes a batch job.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (StorageBatchOperationsClient storageBatchOperationsClient =
StorageBatchOperationsClient.create()) {
String name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString();
storageBatchOperationsClient.deleteJob(name);
}
Parameter | |
---|---|
Name | Description |
name |
String Required. The |
deleteJobCallable()
public final UnaryCallable<DeleteJobRequest,Empty> deleteJobCallable()
Deletes a batch job.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (StorageBatchOperationsClient storageBatchOperationsClient =
StorageBatchOperationsClient.create()) {
DeleteJobRequest request =
DeleteJobRequest.newBuilder()
.setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
.setRequestId("requestId693933066")
.build();
ApiFuture<Empty> future =
storageBatchOperationsClient.deleteJobCallable().futureCall(request);
// Do something.
future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<DeleteJobRequest,Empty> |
getHttpJsonOperationsClient()
public final OperationsClient getHttpJsonOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
Returns | |
---|---|
Type | Description |
OperationsClient |
getJob(GetJobRequest request)
public final Job getJob(GetJobRequest request)
Gets a batch job.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (StorageBatchOperationsClient storageBatchOperationsClient =
StorageBatchOperationsClient.create()) {
GetJobRequest request =
GetJobRequest.newBuilder()
.setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
.build();
Job response = storageBatchOperationsClient.getJob(request);
}
Parameter | |
---|---|
Name | Description |
request |
GetJobRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
Job |
getJob(JobName name)
public final Job getJob(JobName name)
Gets a batch job.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (StorageBatchOperationsClient storageBatchOperationsClient =
StorageBatchOperationsClient.create()) {
JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]");
Job response = storageBatchOperationsClient.getJob(name);
}
Parameter | |
---|---|
Name | Description |
name |
JobName Required. |
Returns | |
---|---|
Type | Description |
Job |
getJob(String name)
public final Job getJob(String name)
Gets a batch job.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (StorageBatchOperationsClient storageBatchOperationsClient =
StorageBatchOperationsClient.create()) {
String name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString();
Job response = storageBatchOperationsClient.getJob(name);
}
Parameter | |
---|---|
Name | Description |
name |
String Required. |
Returns | |
---|---|
Type | Description |
Job |
getJobCallable()
public final UnaryCallable<GetJobRequest,Job> getJobCallable()
Gets a batch job.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (StorageBatchOperationsClient storageBatchOperationsClient =
StorageBatchOperationsClient.create()) {
GetJobRequest request =
GetJobRequest.newBuilder()
.setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
.build();
ApiFuture<Job> future = storageBatchOperationsClient.getJobCallable().futureCall(request);
// Do something.
Job response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<GetJobRequest,Job> |
getLocation(GetLocationRequest request)
public final Location getLocation(GetLocationRequest request)
Gets information about a location.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (StorageBatchOperationsClient storageBatchOperationsClient =
StorageBatchOperationsClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
Location response = storageBatchOperationsClient.getLocation(request);
}
Parameter | |
---|---|
Name | Description |
request |
com.google.cloud.location.GetLocationRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
com.google.cloud.location.Location |
getLocationCallable()
public final UnaryCallable<GetLocationRequest,Location> getLocationCallable()
Gets information about a location.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (StorageBatchOperationsClient storageBatchOperationsClient =
StorageBatchOperationsClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
ApiFuture<Location> future =
storageBatchOperationsClient.getLocationCallable().futureCall(request);
// Do something.
Location response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> |
getOperationsClient()
public final OperationsClient getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
Returns | |
---|---|
Type | Description |
OperationsClient |
getSettings()
public final StorageBatchOperationsSettings getSettings()
Returns | |
---|---|
Type | Description |
StorageBatchOperationsSettings |
getStub()
public StorageBatchOperationsStub getStub()
Returns | |
---|---|
Type | Description |
StorageBatchOperationsStub |
isShutdown()
public boolean isShutdown()
Returns | |
---|---|
Type | Description |
boolean |
isTerminated()
public boolean isTerminated()
Returns | |
---|---|
Type | Description |
boolean |
listJobs(ListJobsRequest request)
public final StorageBatchOperationsClient.ListJobsPagedResponse listJobs(ListJobsRequest request)
Lists Jobs in a given project.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (StorageBatchOperationsClient storageBatchOperationsClient =
StorageBatchOperationsClient.create()) {
ListJobsRequest request =
ListJobsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setOrderBy("orderBy-1207110587")
.build();
for (Job element : storageBatchOperationsClient.listJobs(request).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
request |
ListJobsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
StorageBatchOperationsClient.ListJobsPagedResponse |
listJobs(LocationName parent)
public final StorageBatchOperationsClient.ListJobsPagedResponse listJobs(LocationName parent)
Lists Jobs in a given project.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (StorageBatchOperationsClient storageBatchOperationsClient =
StorageBatchOperationsClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
for (Job element : storageBatchOperationsClient.listJobs(parent).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
parent |
LocationName Required. Format: projects/{project_id}/locations/global. |
Returns | |
---|---|
Type | Description |
StorageBatchOperationsClient.ListJobsPagedResponse |
listJobs(String parent)
public final StorageBatchOperationsClient.ListJobsPagedResponse listJobs(String parent)
Lists Jobs in a given project.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (StorageBatchOperationsClient storageBatchOperationsClient =
StorageBatchOperationsClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
for (Job element : storageBatchOperationsClient.listJobs(parent).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
parent |
String Required. Format: projects/{project_id}/locations/global. |
Returns | |
---|---|
Type | Description |
StorageBatchOperationsClient.ListJobsPagedResponse |
listJobsCallable()
public final UnaryCallable<ListJobsRequest,ListJobsResponse> listJobsCallable()
Lists Jobs in a given project.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (StorageBatchOperationsClient storageBatchOperationsClient =
StorageBatchOperationsClient.create()) {
ListJobsRequest request =
ListJobsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setOrderBy("orderBy-1207110587")
.build();
while (true) {
ListJobsResponse response = storageBatchOperationsClient.listJobsCallable().call(request);
for (Job element : response.getJobsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListJobsRequest,ListJobsResponse> |
listJobsPagedCallable()
public final UnaryCallable<ListJobsRequest,StorageBatchOperationsClient.ListJobsPagedResponse> listJobsPagedCallable()
Lists Jobs in a given project.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (StorageBatchOperationsClient storageBatchOperationsClient =
StorageBatchOperationsClient.create()) {
ListJobsRequest request =
ListJobsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setOrderBy("orderBy-1207110587")
.build();
ApiFuture<Job> future =
storageBatchOperationsClient.listJobsPagedCallable().futureCall(request);
// Do something.
for (Job element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListJobsRequest,ListJobsPagedResponse> |
listLocations(ListLocationsRequest request)
public final StorageBatchOperationsClient.ListLocationsPagedResponse listLocations(ListLocationsRequest request)
Lists information about the supported locations for this service.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (StorageBatchOperationsClient storageBatchOperationsClient =
StorageBatchOperationsClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Location element : storageBatchOperationsClient.listLocations(request).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
request |
com.google.cloud.location.ListLocationsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
StorageBatchOperationsClient.ListLocationsPagedResponse |
listLocationsCallable()
public final UnaryCallable<ListLocationsRequest,ListLocationsResponse> listLocationsCallable()
Lists information about the supported locations for this service.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (StorageBatchOperationsClient storageBatchOperationsClient =
StorageBatchOperationsClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListLocationsResponse response =
storageBatchOperationsClient.listLocationsCallable().call(request);
for (Location element : response.getLocationsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> |
listLocationsPagedCallable()
public final UnaryCallable<ListLocationsRequest,StorageBatchOperationsClient.ListLocationsPagedResponse> listLocationsPagedCallable()
Lists information about the supported locations for this service.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (StorageBatchOperationsClient storageBatchOperationsClient =
StorageBatchOperationsClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Location> future =
storageBatchOperationsClient.listLocationsPagedCallable().futureCall(request);
// Do something.
for (Location element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<com.google.cloud.location.ListLocationsRequest,ListLocationsPagedResponse> |
shutdown()
public void shutdown()
shutdownNow()
public void shutdownNow()