Storage Batch Operations V1 API - Class Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Client (v0.1.0)

Reference documentation and code samples for the Storage Batch Operations V1 API class Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Client.

Client for the StorageBatchOperations service.

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.

Inherits

  • Object

Methods

.configure

def self.configure() { |config| ... } -> Client::Configuration

Configure the StorageBatchOperations Client class.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# Modify the configuration for all StorageBatchOperations clients
::Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Client.configure do |config|
  config.timeout = 10.0
end

#cancel_job

def cancel_job(request, options = nil) -> ::Google::Cloud::StorageBatchOperations::V1::CancelJobResponse
def cancel_job(name: nil, request_id: nil) -> ::Google::Cloud::StorageBatchOperations::V1::CancelJobResponse

Cancels a batch job.

Overloads
def cancel_job(request, options = nil) -> ::Google::Cloud::StorageBatchOperations::V1::CancelJobResponse
Pass arguments to cancel_job via a request object, either of type CancelJobRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::StorageBatchOperations::V1::CancelJobRequest, ::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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def cancel_job(name: nil, request_id: nil) -> ::Google::Cloud::StorageBatchOperations::V1::CancelJobResponse
Pass arguments to cancel_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).
Parameters
  • name (::String) — Required. The name of the job to cancel. Format: projects/{project_id}/locations/{location_id}/jobs/{job_id}.
  • request_id (::String) — Optional. An optional request ID to identify requests. Specify a unique request ID in case you need to retry your request. Requests with same request_id will ignored for at least 60 minutes since the first request. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/storage_batch_operations/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::StorageBatchOperations::V1::CancelJobRequest.new

# Call the cancel_job method.
result = client.cancel_job request

# The returned object is of type Google::Cloud::StorageBatchOperations::V1::CancelJobResponse.
p result

#configure

def configure() { |config| ... } -> Client::Configuration

Configure the StorageBatchOperations 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 Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#create_job

def create_job(request, options = nil) -> ::Gapic::Operation
def create_job(parent: nil, job_id: nil, job: nil, request_id: nil) -> ::Gapic::Operation

Creates a batch job.

Overloads
def create_job(request, options = nil) -> ::Gapic::Operation
Pass arguments to create_job via a request object, either of type CreateJobRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::StorageBatchOperations::V1::CreateJobRequest, ::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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def create_job(parent: nil, job_id: nil, job: nil, request_id: nil) -> ::Gapic::Operation
Pass arguments to create_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).
Parameters
  • parent (::String) — Required. Value for parent.
  • job_id (::String) — Required. The optional job_id for this Job . If not specified, an id is generated. job_id should be no more than 128 characters and must include only characters available in DNS names, as defined by RFC-1123.
  • job (::Google::Cloud::StorageBatchOperations::V1::Job, ::Hash) — Required. The resource being created
  • request_id (::String) — Optional. An optional request ID to identify requests. Specify a unique request ID in case you need to retry your request. Requests with same request_id will ignored for at least 60 minutes since the first request. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/storage_batch_operations/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::StorageBatchOperations::V1::CreateJobRequest.new

# Call the create_job method.
result = client.create_job request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

#delete_job

def delete_job(request, options = nil) -> ::Google::Protobuf::Empty
def delete_job(name: nil, request_id: nil) -> ::Google::Protobuf::Empty

Deletes a batch job.

Overloads
def delete_job(request, options = nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_job via a request object, either of type DeleteJobRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::StorageBatchOperations::V1::DeleteJobRequest, ::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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def delete_job(name: nil, request_id: nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_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).
Parameters
  • name (::String) — Required. The name of the job to delete. Format: projects/{project_id}/locations/{location_id}/jobs/{job_id} .
  • request_id (::String) — Optional. An optional request ID to identify requests. Specify a unique request ID in case you need to retry your request. Requests with same request_id will ignored for at least 60 minutes since the first request. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/storage_batch_operations/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::StorageBatchOperations::V1::DeleteJobRequest.new

# Call the delete_job method.
result = client.delete_job request

# The returned object is of type Google::Protobuf::Empty.
p result

#get_job

def get_job(request, options = nil) -> ::Google::Cloud::StorageBatchOperations::V1::Job
def get_job(name: nil) -> ::Google::Cloud::StorageBatchOperations::V1::Job

Gets a batch job.

Overloads
def get_job(request, options = nil) -> ::Google::Cloud::StorageBatchOperations::V1::Job
Pass arguments to get_job via a request object, either of type GetJobRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::StorageBatchOperations::V1::GetJobRequest, ::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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_job(name: nil) -> ::Google::Cloud::StorageBatchOperations::V1::Job
Pass arguments to get_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).
Parameter
  • name (::String) — Required. name of the job to retrieve. Format: projects/{project_id}/locations/{location_id}/jobs/{job_id} .
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/storage_batch_operations/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::StorageBatchOperations::V1::GetJobRequest.new

# Call the get_job method.
result = client.get_job request

# The returned object is of type Google::Cloud::StorageBatchOperations::V1::Job.
p result

#initialize

def initialize() { |config| ... } -> Client

Create a new StorageBatchOperations client object.

Yields
  • (config) — Configure the StorageBatchOperations client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client = ::Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Client.new

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

#list_jobs

def list_jobs(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::StorageBatchOperations::V1::Job>
def list_jobs(parent: nil, filter: nil, page_size: nil, page_token: nil, order_by: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::StorageBatchOperations::V1::Job>

Lists Jobs in a given project and location.

Overloads
def list_jobs(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::StorageBatchOperations::V1::Job>
Pass arguments to list_jobs via a request object, either of type ListJobsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::StorageBatchOperations::V1::ListJobsRequest, ::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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_jobs(parent: nil, filter: nil, page_size: nil, page_token: nil, order_by: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::StorageBatchOperations::V1::Job>
Pass arguments to list_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).
Parameters
  • parent (::String) — Required. Format: projects/{project_id}/locations/{location_id} .
  • filter (::String) — Optional. Filters results as defined by https://google.aip.dev/160.
  • page_size (::Integer) — Optional. The list page size. default page size is 100.
  • page_token (::String) — Optional. The list page token.
  • order_by (::String) — Optional. Field to sort by. Supported fields are name, create_time.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/storage_batch_operations/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::StorageBatchOperations::V1::ListJobsRequest.new

# Call the list_jobs method.
result = client.list_jobs request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::StorageBatchOperations::V1::Job.
  p item
end

#location_client

def location_client() -> Google::Cloud::Location::Locations::Client

Get the associated client for mix-in of the Locations.

Returns
  • (Google::Cloud::Location::Locations::Client)

#logger

def logger() -> Logger

The logger used for request/response debug logging.

Returns
  • (Logger)

#operations_client

def operations_client() -> ::Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Operations

Get the associated client for long-running operations.

#universe_domain

def universe_domain() -> String

The effective universe domain

Returns
  • (String)