Class StorageTransferServiceClient (1.70.0)

public class StorageTransferServiceClient implements BackgroundResource

Service Description: Storage Transfer Service and its protos. Transfers data between between Google Cloud Storage buckets or from a data source external to Google to a Cloud Storage bucket.

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 (StorageTransferServiceClient storageTransferServiceClient =
     StorageTransferServiceClient.create()) {
   TransferProto.GetGoogleServiceAccountRequest request =
       TransferProto.GetGoogleServiceAccountRequest.newBuilder()
           .setProjectId("projectId-894832108")
           .build();
   TransferTypes.GoogleServiceAccount response =
       storageTransferServiceClient.getGoogleServiceAccount(request);
 }
 

Note: close() needs to be called on the StorageTransferServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

Methods
Method Description Method Variants

GetGoogleServiceAccount

Returns the Google service account that is used by Storage Transfer Service to access buckets in the project where transfers run or in other projects. Each Google service account is associated with one Google Cloud project. Users should add this service account to the Google Cloud Storage bucket ACLs to grant access to Storage Transfer Service. This service account is created and owned by Storage Transfer Service and can only be used by Storage Transfer Service.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getGoogleServiceAccount(TransferProto.GetGoogleServiceAccountRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getGoogleServiceAccountCallable()

CreateTransferJob

Creates a transfer job that runs periodically.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • createTransferJob(TransferProto.CreateTransferJobRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • createTransferJobCallable()

UpdateTransferJob

Updates a transfer job. Updating a job's transfer spec does not affect transfer operations that are running already.

**Note:** The job's status field can be modified using this RPC (for example, to set a job's status to DELETED, DISABLED, or ENABLED).

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updateTransferJob(TransferProto.UpdateTransferJobRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updateTransferJobCallable()

GetTransferJob

Gets a transfer job.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getTransferJob(TransferProto.GetTransferJobRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getTransferJobCallable()

ListTransferJobs

Lists transfer jobs.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listTransferJobs(TransferProto.ListTransferJobsRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listTransferJobsPagedCallable()

  • listTransferJobsCallable()

PauseTransferOperation

Pauses a transfer operation.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • pauseTransferOperation(TransferProto.PauseTransferOperationRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • pauseTransferOperationCallable()

ResumeTransferOperation

Resumes a transfer operation that is paused.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • resumeTransferOperation(TransferProto.ResumeTransferOperationRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • resumeTransferOperationCallable()

RunTransferJob

Starts a new operation for the specified transfer job. A TransferJob has a maximum of one active TransferOperation. If this method is called while a TransferOperation is active, an error is returned.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • runTransferJobAsync(TransferProto.RunTransferJobRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • runTransferJobOperationCallable()

  • runTransferJobCallable()

DeleteTransferJob

Deletes a transfer job. Deleting a transfer job sets its status to DELETED.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deleteTransferJob(TransferProto.DeleteTransferJobRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • deleteTransferJobCallable()

CreateAgentPool

Creates an agent pool resource.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • createAgentPool(TransferProto.CreateAgentPoolRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • createAgentPool(String projectId, TransferTypes.AgentPool agentPool, String agentPoolId)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • createAgentPoolCallable()

UpdateAgentPool

Updates an existing agent pool resource.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updateAgentPool(TransferProto.UpdateAgentPoolRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • updateAgentPool(TransferTypes.AgentPool agentPool, FieldMask updateMask)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updateAgentPoolCallable()

GetAgentPool

Gets an agent pool.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getAgentPool(TransferProto.GetAgentPoolRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getAgentPool(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getAgentPoolCallable()

ListAgentPools

Lists agent pools.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listAgentPools(TransferProto.ListAgentPoolsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listAgentPools(String projectId)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listAgentPoolsPagedCallable()

  • listAgentPoolsCallable()

DeleteAgentPool

Deletes an agent pool.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deleteAgentPool(TransferProto.DeleteAgentPoolRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • deleteAgentPool(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • deleteAgentPoolCallable()

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 StorageTransferServiceSettings 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
 StorageTransferServiceSettings storageTransferServiceSettings =
     StorageTransferServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 StorageTransferServiceClient storageTransferServiceClient =
     StorageTransferServiceClient.create(storageTransferServiceSettings);
 

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
 StorageTransferServiceSettings storageTransferServiceSettings =
     StorageTransferServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 StorageTransferServiceClient storageTransferServiceClient =
     StorageTransferServiceClient.create(storageTransferServiceSettings);
 

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
 StorageTransferServiceSettings storageTransferServiceSettings =
     StorageTransferServiceSettings.newHttpJsonBuilder().build();
 StorageTransferServiceClient storageTransferServiceClient =
     StorageTransferServiceClient.create(storageTransferServiceSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

Inheritance

java.lang.Object > StorageTransferServiceClient

Implements

BackgroundResource