Class: Google::Apis::StoragetransferV1::StoragetransferService

Inherits:
Core::BaseService
  • Object
show all
Defined in:
generated/google/apis/storagetransfer_v1/service.rb

Overview

Storage Transfer API

Transfers data from external data sources to a Google Cloud Storage bucket or between Google Cloud Storage buckets.

Examples:

require 'google/apis/storagetransfer_v1'

Storagetransfer = Google::Apis::StoragetransferV1 # Alias the module
service = Storagetransfer::StoragetransferService.new

See Also:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeStoragetransferService

Returns a new instance of StoragetransferService.



46
47
48
49
# File 'generated/google/apis/storagetransfer_v1/service.rb', line 46

def initialize
  super('https://storagetransfer.googleapis.com/', '')
  @batch_path = 'batch'
end

Instance Attribute Details

#keyString

Returns API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.

Returns:

  • (String)

    API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.



39
40
41
# File 'generated/google/apis/storagetransfer_v1/service.rb', line 39

def key
  @key
end

#quota_userString

Returns Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

Returns:

  • (String)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.



44
45
46
# File 'generated/google/apis/storagetransfer_v1/service.rb', line 44

def quota_user
  @quota_user
end

Instance Method Details

#cancel_transfer_operation(name, cancel_operation_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::StoragetransferV1::Empty

Cancels a transfer. Use the transferOperations.get method to check if the cancellation succeeded or if the operation completed despite the cancel request. When you cancel an operation, the currently running transfer is interrupted. For recurring transfer jobs, the next instance of the transfer job will still run. For example, if your job is configured to run every day at 1pm and you cancel Monday's operation at 1:05pm, Monday's transfer will stop. However, a transfer job will still be attempted on Tuesday. This applies only to currently running operations. If an operation is not currently running, cancel does nothing. Caution: Canceling a transfer job can leave your data in an unknown state. We recommend that you restore the state at both the destination and the source after the cancel request completes so that your data is in a consistent state. When you cancel a job, the next job computes a delta of files and may repair any inconsistent state. For instance, if you run a job every day, and today's job found 10 new files and transferred five files before you canceled the job, tomorrow's transfer operation will compute a new delta with the five files that were not copied today plus any new files discovered tomorrow.

Parameters:

  • name (String)

    The name of the operation resource to be cancelled.

  • cancel_operation_request_object (Google::Apis::StoragetransferV1::CancelOperationRequest) (defaults to: nil)
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



266
267
268
269
270
271
272
273
274
275
276
# File 'generated/google/apis/storagetransfer_v1/service.rb', line 266

def cancel_transfer_operation(name, cancel_operation_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v1/{+name}:cancel', options)
  command.request_representation = Google::Apis::StoragetransferV1::CancelOperationRequest::Representation
  command.request_object = cancel_operation_request_object
  command.response_representation = Google::Apis::StoragetransferV1::Empty::Representation
  command.response_class = Google::Apis::StoragetransferV1::Empty
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#create_transfer_job(transfer_job_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::StoragetransferV1::TransferJob

Creates a transfer job that runs periodically.

Parameters:

  • transfer_job_object (Google::Apis::StoragetransferV1::TransferJob) (defaults to: nil)
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



107
108
109
110
111
112
113
114
115
116
# File 'generated/google/apis/storagetransfer_v1/service.rb', line 107

def create_transfer_job(transfer_job_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v1/transferJobs', options)
  command.request_representation = Google::Apis::StoragetransferV1::TransferJob::Representation
  command.request_object = transfer_job_object
  command.response_representation = Google::Apis::StoragetransferV1::TransferJob::Representation
  command.response_class = Google::Apis::StoragetransferV1::TransferJob
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#get_google_service_account(project_id, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::StoragetransferV1::GoogleServiceAccount

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 Platform Console 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.

Parameters:

  • project_id (String)

    Required. The ID of the Google Cloud Platform Console project that the Google service account is associated with.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



78
79
80
81
82
83
84
85
86
# File 'generated/google/apis/storagetransfer_v1/service.rb', line 78

def (project_id, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/googleServiceAccounts/{projectId}', options)
  command.response_representation = Google::Apis::StoragetransferV1::GoogleServiceAccount::Representation
  command.response_class = Google::Apis::StoragetransferV1::GoogleServiceAccount
  command.params['projectId'] = project_id unless project_id.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#get_transfer_job(job_name, project_id, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::StoragetransferV1::TransferJob

Gets a transfer job.

Parameters:

  • job_name (String)

    Required. " The job to get.

  • project_id (String)

    Required. The ID of the Google Cloud Platform Console project that owns the job.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



141
142
143
144
145
146
147
148
149
150
# File 'generated/google/apis/storagetransfer_v1/service.rb', line 141

def get_transfer_job(job_name, project_id, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/{+jobName}', options)
  command.response_representation = Google::Apis::StoragetransferV1::TransferJob::Representation
  command.response_class = Google::Apis::StoragetransferV1::TransferJob
  command.params['jobName'] = job_name unless job_name.nil?
  command.query['projectId'] = project_id unless project_id.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#get_transfer_operation(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::StoragetransferV1::Operation

Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.

Parameters:

  • name (String)

    The name of the operation resource.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



299
300
301
302
303
304
305
306
307
# File 'generated/google/apis/storagetransfer_v1/service.rb', line 299

def get_transfer_operation(name, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/{+name}', options)
  command.response_representation = Google::Apis::StoragetransferV1::Operation::Representation
  command.response_class = Google::Apis::StoragetransferV1::Operation
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#list_transfer_jobs(filter, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::StoragetransferV1::ListTransferJobsResponse

Lists transfer jobs.

Parameters:

  • filter (String)

    Required. A list of query parameters specified as JSON text in the form of: " projectId":"my_project_id", "jobNames":["jobid1","jobid2",...], "jobStatuses":[ "status1","status2",...] Since jobNames and jobStatuses support multiple values, their values must be specified with array notation. projectId is required. jobNames and jobStatuses are optional. The valid values for jobStatuses are case-insensitive: ENABLED, DISABLED, and DELETED.

  • page_size (Fixnum) (defaults to: nil)

    The list page size. The max allowed value is 256.

  • page_token (String) (defaults to: nil)

    The list page token.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



181
182
183
184
185
186
187
188
189
190
191
# File 'generated/google/apis/storagetransfer_v1/service.rb', line 181

def list_transfer_jobs(filter, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/transferJobs', options)
  command.response_representation = Google::Apis::StoragetransferV1::ListTransferJobsResponse::Representation
  command.response_class = Google::Apis::StoragetransferV1::ListTransferJobsResponse
  command.query['filter'] = filter unless filter.nil?
  command.query['pageSize'] = page_size unless page_size.nil?
  command.query['pageToken'] = page_token unless page_token.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#list_transfer_operations(name, filter, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::StoragetransferV1::ListOperationsResponse

Lists transfer operations.

Parameters:

  • name (String)

    Required. The value transferOperations.

  • filter (String)

    Required. A list of query parameters specified as JSON text in the form of: " projectId":"my_project_id", "jobNames":["jobid1","jobid2",...], " operationNames":["opid1","opid2",...], "transferStatuses":["status1","status2", ...] Since jobNames, operationNames, and transferStatuses support multiple values, they must be specified with array notation. projectId is required. jobNames, operationNames, and transferStatuses are optional. The valid values for transferStatuses are case-insensitive: IN_PROGRESS, PAUSED, SUCCESS, FAILED, and ABORTED.

  • page_size (Fixnum) (defaults to: nil)

    The list page size. The max allowed value is 256.

  • page_token (String) (defaults to: nil)

    The list page token.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



342
343
344
345
346
347
348
349
350
351
352
353
# File 'generated/google/apis/storagetransfer_v1/service.rb', line 342

def list_transfer_operations(name, filter, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/{+name}', options)
  command.response_representation = Google::Apis::StoragetransferV1::ListOperationsResponse::Representation
  command.response_class = Google::Apis::StoragetransferV1::ListOperationsResponse
  command.params['name'] = name unless name.nil?
  command.query['filter'] = filter unless filter.nil?
  command.query['pageSize'] = page_size unless page_size.nil?
  command.query['pageToken'] = page_token unless page_token.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#patch_transfer_job(job_name, update_transfer_job_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::StoragetransferV1::TransferJob

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).

Parameters:

  • job_name (String)

    Required. The name of job to update.

  • update_transfer_job_request_object (Google::Apis::StoragetransferV1::UpdateTransferJobRequest) (defaults to: nil)
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



217
218
219
220
221
222
223
224
225
226
227
# File 'generated/google/apis/storagetransfer_v1/service.rb', line 217

def patch_transfer_job(job_name, update_transfer_job_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:patch, 'v1/{+jobName}', options)
  command.request_representation = Google::Apis::StoragetransferV1::UpdateTransferJobRequest::Representation
  command.request_object = update_transfer_job_request_object
  command.response_representation = Google::Apis::StoragetransferV1::TransferJob::Representation
  command.response_class = Google::Apis::StoragetransferV1::TransferJob
  command.params['jobName'] = job_name unless job_name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#pause_transfer_operation(name, pause_transfer_operation_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::StoragetransferV1::Empty

Pauses a transfer operation.

Parameters:

  • name (String)

    Required. The name of the transfer operation.

  • pause_transfer_operation_request_object (Google::Apis::StoragetransferV1::PauseTransferOperationRequest) (defaults to: nil)
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



376
377
378
379
380
381
382
383
384
385
386
# File 'generated/google/apis/storagetransfer_v1/service.rb', line 376

def pause_transfer_operation(name, pause_transfer_operation_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v1/{+name}:pause', options)
  command.request_representation = Google::Apis::StoragetransferV1::PauseTransferOperationRequest::Representation
  command.request_object = pause_transfer_operation_request_object
  command.response_representation = Google::Apis::StoragetransferV1::Empty::Representation
  command.response_class = Google::Apis::StoragetransferV1::Empty
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#resume_transfer_operation(name, resume_transfer_operation_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::StoragetransferV1::Empty

Resumes a transfer operation that is paused.

Parameters:

  • name (String)

    Required. The name of the transfer operation.

  • resume_transfer_operation_request_object (Google::Apis::StoragetransferV1::ResumeTransferOperationRequest) (defaults to: nil)
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



409
410
411
412
413
414
415
416
417
418
419
# File 'generated/google/apis/storagetransfer_v1/service.rb', line 409

def resume_transfer_operation(name, resume_transfer_operation_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v1/{+name}:resume', options)
  command.request_representation = Google::Apis::StoragetransferV1::ResumeTransferOperationRequest::Representation
  command.request_object = resume_transfer_operation_request_object
  command.response_representation = Google::Apis::StoragetransferV1::Empty::Representation
  command.response_class = Google::Apis::StoragetransferV1::Empty
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end