class Google::Cloud::StorageTransfer::V1::StorageTransferService::Client

Client for the StorageTransferService service.

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.

Attributes

operations_client[R]

Get the associated client for long-running operations.

@return [::Google::Cloud::StorageTransfer::V1::StorageTransferService::Operations]

storage_transfer_service_stub[R]

@private

Public Class Methods

configure() { |configure| ... } click to toggle source

Configure the StorageTransferService Client class.

See {::Google::Cloud::StorageTransfer::V1::StorageTransferService::Client::Configuration} for a description of the configuration fields.

@example

# Modify the configuration for all StorageTransferService clients
::Google::Cloud::StorageTransfer::V1::StorageTransferService::Client.configure do |config|
  config.timeout = 10.0
end

@yield [config] Configure the Client client. @yieldparam config [Client::Configuration]

@return [Client::Configuration]

# File lib/google/cloud/storage_transfer/v1/storage_transfer_service/client.rb, line 56
def self.configure
  @configure ||= begin
    namespace = ["Google", "Cloud", "StorageTransfer", "V1"]
    parent_config = while namespace.any?
                      parent_name = namespace.join "::"
                      parent_const = const_get parent_name
                      break parent_const.configure if parent_const.respond_to? :configure
                      namespace.pop
                    end
    default_config = Client::Configuration.new parent_config

    default_config.timeout = 60.0

    default_config
  end
  yield @configure if block_given?
  @configure
end
new() { |config| ... } click to toggle source

Create a new StorageTransferService client object.

@example

# Create a client using the default configuration
client = ::Google::Cloud::StorageTransfer::V1::StorageTransferService::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::StorageTransfer::V1::StorageTransferService::Client.new do |config|
  config.timeout = 10.0
end

@yield [config] Configure the StorageTransferService client. @yieldparam config [Client::Configuration]

# File lib/google/cloud/storage_transfer/v1/storage_transfer_service/client.rb, line 111
def initialize
  # These require statements are intentionally placed here to initialize
  # the gRPC module only when it's required.
  # See https://github.com/googleapis/toolkit/issues/446
  require "gapic/grpc"
  require "google/storagetransfer/v1/transfer_services_pb"

  # Create the configuration object
  @config = Configuration.new Client.configure

  # Yield the configuration if needed
  yield @config if block_given?

  # Create credentials
  credentials = @config.credentials
  # Use self-signed JWT if the endpoint is unchanged from default,
  # but only if the default endpoint does not have a region prefix.
  enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
                           !@config.endpoint.split(".").first.include?("-")
  credentials ||= Credentials.default scope: @config.scope,
                                      enable_self_signed_jwt: enable_self_signed_jwt
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
    credentials = Credentials.new credentials, scope: @config.scope
  end
  @quota_project_id = @config.quota_project
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id

  @operations_client = Operations.new do |config|
    config.credentials = credentials
    config.endpoint = @config.endpoint
  end

  @storage_transfer_service_stub = ::Gapic::ServiceStub.new(
    ::Google::Cloud::StorageTransfer::V1::StorageTransferService::Stub,
    credentials:  credentials,
    endpoint:     @config.endpoint,
    channel_args: @config.channel_args,
    interceptors: @config.interceptors
  )
end

Public Instance Methods

configure() { |config| ... } click to toggle source

Configure the StorageTransferService Client instance.

The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on {Client.configure}.

See {::Google::Cloud::StorageTransfer::V1::StorageTransferService::Client::Configuration} for a description of the configuration fields.

@yield [config] Configure the Client client. @yieldparam config [Client::Configuration]

@return [Client::Configuration]

# File lib/google/cloud/storage_transfer/v1/storage_transfer_service/client.rb, line 90
def configure
  yield @config if block_given?
  @config
end
create_transfer_job(request, options = nil) { |response, operation| ... } click to toggle source

Creates a transfer job that runs periodically.

@overload create_transfer_job(request, options = nil)

Pass arguments to `create_transfer_job` via a request object, either of type
{::Google::Cloud::StorageTransfer::V1::CreateTransferJobRequest} or an equivalent Hash.

@param request [::Google::Cloud::StorageTransfer::V1::CreateTransferJobRequest, ::Hash]
  A request object representing the call parameters. Required. To specify no
  parameters, or to keep all the default parameter values, pass an empty Hash.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload create_transfer_job(transfer_job: nil)

Pass arguments to `create_transfer_job` via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).

@param transfer_job [::Google::Cloud::StorageTransfer::V1::TransferJob, ::Hash]
  Required. The job to create.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::StorageTransfer::V1::TransferJob] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Google::Cloud::StorageTransfer::V1::TransferJob]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/storage_transfer/v1/storage_transfer_service/client.rb, line 266
def create_transfer_job request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageTransfer::V1::CreateTransferJobRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
  metadata = @config.rpcs.create_transfer_job.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.create_transfer_job.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.create_transfer_job.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         retry_policy: @config.retry_policy

  @storage_transfer_service_stub.call_rpc :create_transfer_job, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end
get_google_service_account(request, options = nil) { |response, operation| ... } click to toggle source

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.

@overload get_google_service_account(request, options = nil)

Pass arguments to `get_google_service_account` via a request object, either of type
{::Google::Cloud::StorageTransfer::V1::GetGoogleServiceAccountRequest} or an equivalent Hash.

@param request [::Google::Cloud::StorageTransfer::V1::GetGoogleServiceAccountRequest, ::Hash]
  A request object representing the call parameters. Required. To specify no
  parameters, or to keep all the default parameter values, pass an empty Hash.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload get_google_service_account(project_id: nil)

Pass arguments to `get_google_service_account` via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).

@param project_id [::String]
  Required. The ID of the Google Cloud Platform Console project that the
  Google service account is associated with.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::StorageTransfer::V1::GoogleServiceAccount] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Google::Cloud::StorageTransfer::V1::GoogleServiceAccount]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/storage_transfer/v1/storage_transfer_service/client.rb, line 198
def get_google_service_account request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageTransfer::V1::GetGoogleServiceAccountRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
  metadata = @config.rpcs.get_google_service_account.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "project_id" => request.project_id
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.get_google_service_account.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.get_google_service_account.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         retry_policy: @config.retry_policy

  @storage_transfer_service_stub.call_rpc :get_google_service_account, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end
get_transfer_job(request, options = nil) { |response, operation| ... } click to toggle source

Gets a transfer job.

@overload get_transfer_job(request, options = nil)

Pass arguments to `get_transfer_job` via a request object, either of type
{::Google::Cloud::StorageTransfer::V1::GetTransferJobRequest} or an equivalent Hash.

@param request [::Google::Cloud::StorageTransfer::V1::GetTransferJobRequest, ::Hash]
  A request object representing the call parameters. Required. To specify no
  parameters, or to keep all the default parameter values, pass an empty Hash.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload get_transfer_job(job_name: nil, project_id: nil)

Pass arguments to `get_transfer_job` via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).

@param job_name [::String]
  Required.
  The job to get.
@param project_id [::String]
  Required. The ID of the Google Cloud Platform Console project that owns the
  job.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::StorageTransfer::V1::TransferJob] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Google::Cloud::StorageTransfer::V1::TransferJob]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/storage_transfer/v1/storage_transfer_service/client.rb, line 433
def get_transfer_job request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageTransfer::V1::GetTransferJobRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
  metadata = @config.rpcs.get_transfer_job.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "job_name" => request.job_name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.get_transfer_job.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.get_transfer_job.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         retry_policy: @config.retry_policy

  @storage_transfer_service_stub.call_rpc :get_transfer_job, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end
list_transfer_jobs(request, options = nil) { |response, operation| ... } click to toggle source

Lists transfer jobs.

@overload list_transfer_jobs(request, options = nil)

Pass arguments to `list_transfer_jobs` via a request object, either of type
{::Google::Cloud::StorageTransfer::V1::ListTransferJobsRequest} or an equivalent Hash.

@param request [::Google::Cloud::StorageTransfer::V1::ListTransferJobsRequest, ::Hash]
  A request object representing the call parameters. Required. To specify no
  parameters, or to keep all the default parameter values, pass an empty Hash.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload list_transfer_jobs(filter: nil, page_size: nil, page_token: nil)

Pass arguments to `list_transfer_jobs` via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).

@param 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:
  {::Google::Cloud::StorageTransfer::V1::TransferJob::Status::ENABLED ENABLED},
  {::Google::Cloud::StorageTransfer::V1::TransferJob::Status::DISABLED DISABLED}, and
  {::Google::Cloud::StorageTransfer::V1::TransferJob::Status::DELETED DELETED}.
@param page_size [::Integer]
  The list page size. The max allowed value is 256.
@param page_token [::String]
  The list page token.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::StorageTransfer::V1::TransferJob>] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Gapic::PagedEnumerable<::Google::Cloud::StorageTransfer::V1::TransferJob>]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/storage_transfer/v1/storage_transfer_service/client.rb, line 516
def list_transfer_jobs request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageTransfer::V1::ListTransferJobsRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
  metadata = @config.rpcs.list_transfer_jobs.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.list_transfer_jobs.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.list_transfer_jobs.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         retry_policy: @config.retry_policy

  @storage_transfer_service_stub.call_rpc :list_transfer_jobs, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @storage_transfer_service_stub, :list_transfer_jobs, request, response, operation, options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end
pause_transfer_operation(request, options = nil) { |response, operation| ... } click to toggle source

Pauses a transfer operation.

@overload pause_transfer_operation(request, options = nil)

Pass arguments to `pause_transfer_operation` via a request object, either of type
{::Google::Cloud::StorageTransfer::V1::PauseTransferOperationRequest} or an equivalent Hash.

@param request [::Google::Cloud::StorageTransfer::V1::PauseTransferOperationRequest, ::Hash]
  A request object representing the call parameters. Required. To specify no
  parameters, or to keep all the default parameter values, pass an empty Hash.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload pause_transfer_operation(name: nil)

Pass arguments to `pause_transfer_operation` via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).

@param name [::String]
  Required. The name of the transfer operation.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Protobuf::Empty] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Google::Protobuf::Empty]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/storage_transfer/v1/storage_transfer_service/client.rb, line 579
def pause_transfer_operation request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageTransfer::V1::PauseTransferOperationRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
  metadata = @config.rpcs.pause_transfer_operation.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "name" => request.name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.pause_transfer_operation.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.pause_transfer_operation.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         retry_policy: @config.retry_policy

  @storage_transfer_service_stub.call_rpc :pause_transfer_operation, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end
resume_transfer_operation(request, options = nil) { |response, operation| ... } click to toggle source

Resumes a transfer operation that is paused.

@overload resume_transfer_operation(request, options = nil)

Pass arguments to `resume_transfer_operation` via a request object, either of type
{::Google::Cloud::StorageTransfer::V1::ResumeTransferOperationRequest} or an equivalent Hash.

@param request [::Google::Cloud::StorageTransfer::V1::ResumeTransferOperationRequest, ::Hash]
  A request object representing the call parameters. Required. To specify no
  parameters, or to keep all the default parameter values, pass an empty Hash.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload resume_transfer_operation(name: nil)

Pass arguments to `resume_transfer_operation` via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).

@param name [::String]
  Required. The name of the transfer operation.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Protobuf::Empty] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Google::Protobuf::Empty]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/storage_transfer/v1/storage_transfer_service/client.rb, line 647
def resume_transfer_operation request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageTransfer::V1::ResumeTransferOperationRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
  metadata = @config.rpcs.resume_transfer_operation.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "name" => request.name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.resume_transfer_operation.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.resume_transfer_operation.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         retry_policy: @config.retry_policy

  @storage_transfer_service_stub.call_rpc :resume_transfer_operation, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end
run_transfer_job(request, options = nil) { |response, operation| ... } click to toggle source

Attempts to start a new TransferOperation for the current TransferJob. A TransferJob has a maximum of one active TransferOperation. If this method is called while a TransferOperation is active, an error wil be returned.

@overload run_transfer_job(request, options = nil)

Pass arguments to `run_transfer_job` via a request object, either of type
{::Google::Cloud::StorageTransfer::V1::RunTransferJobRequest} or an equivalent Hash.

@param request [::Google::Cloud::StorageTransfer::V1::RunTransferJobRequest, ::Hash]
  A request object representing the call parameters. Required. To specify no
  parameters, or to keep all the default parameter values, pass an empty Hash.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload run_transfer_job(job_name: nil, project_id: nil)

Pass arguments to `run_transfer_job` via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).

@param job_name [::String]
  Required. The name of the transfer job.
@param project_id [::String]
  Required. The ID of the Google Cloud Platform Console project that owns the
  transfer job.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::Operation] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Gapic::Operation]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/storage_transfer/v1/storage_transfer_service/client.rb, line 720
def run_transfer_job request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageTransfer::V1::RunTransferJobRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
  metadata = @config.rpcs.run_transfer_job.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "job_name" => request.job_name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.run_transfer_job.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.run_transfer_job.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         retry_policy: @config.retry_policy

  @storage_transfer_service_stub.call_rpc :run_transfer_job, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end
update_transfer_job(request, options = nil) { |response, operation| ... } click to toggle source

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

Note: The job's {::Google::Cloud::StorageTransfer::V1::TransferJob#status status} field can be modified using this RPC (for example, to set a job's status to {::Google::Cloud::StorageTransfer::V1::TransferJob::Status::DELETED DELETED}, {::Google::Cloud::StorageTransfer::V1::TransferJob::Status::DISABLED DISABLED}, or {::Google::Cloud::StorageTransfer::V1::TransferJob::Status::ENABLED ENABLED}).

@overload update_transfer_job(request, options = nil)

Pass arguments to `update_transfer_job` via a request object, either of type
{::Google::Cloud::StorageTransfer::V1::UpdateTransferJobRequest} or an equivalent Hash.

@param request [::Google::Cloud::StorageTransfer::V1::UpdateTransferJobRequest, ::Hash]
  A request object representing the call parameters. Required. To specify no
  parameters, or to keep all the default parameter values, pass an empty Hash.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload update_transfer_job(job_name: nil, project_id: nil, transfer_job: nil, update_transfer_job_field_mask: nil)

Pass arguments to `update_transfer_job` via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).

@param job_name [::String]
  Required. The name of job to update.
@param project_id [::String]
  Required. The ID of the Google Cloud Platform Console project that owns the
  job.
@param transfer_job [::Google::Cloud::StorageTransfer::V1::TransferJob, ::Hash]
  Required. The job to update. `transferJob` is expected to specify only
  four fields:
  {::Google::Cloud::StorageTransfer::V1::TransferJob#description description},
  {::Google::Cloud::StorageTransfer::V1::TransferJob#transfer_spec transfer_spec},
  {::Google::Cloud::StorageTransfer::V1::TransferJob#notification_config notification_config},
  and {::Google::Cloud::StorageTransfer::V1::TransferJob#status status}.  An
  `UpdateTransferJobRequest` that specifies other fields are rejected with
  the error {::Google::Rpc::Code::INVALID_ARGUMENT INVALID_ARGUMENT}. Updating a
  job status to
  {::Google::Cloud::StorageTransfer::V1::TransferJob::Status::DELETED DELETED} requires
  `storagetransfer.jobs.delete` permissions.
@param update_transfer_job_field_mask [::Google::Protobuf::FieldMask, ::Hash]
  The field mask of the fields in `transferJob` that are to be updated in
  this request.  Fields in `transferJob` that can be updated are:
  {::Google::Cloud::StorageTransfer::V1::TransferJob#description description},
  {::Google::Cloud::StorageTransfer::V1::TransferJob#transfer_spec transfer_spec},
  {::Google::Cloud::StorageTransfer::V1::TransferJob#notification_config notification_config},
  and {::Google::Cloud::StorageTransfer::V1::TransferJob#status status}.  To update the
  `transfer_spec` of the job, a complete transfer specification must be
  provided. An incomplete specification missing any required fields is
  rejected with the error
  {::Google::Rpc::Code::INVALID_ARGUMENT INVALID_ARGUMENT}.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::StorageTransfer::V1::TransferJob] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Google::Cloud::StorageTransfer::V1::TransferJob]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/storage_transfer/v1/storage_transfer_service/client.rb, line 361
def update_transfer_job request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageTransfer::V1::UpdateTransferJobRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
  metadata = @config.rpcs.update_transfer_job.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "job_name" => request.job_name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.update_transfer_job.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.update_transfer_job.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         retry_policy: @config.retry_policy

  @storage_transfer_service_stub.call_rpc :update_transfer_job, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end