Class: Google::Iam::V1beta::WorkloadIdentityPools::Operations

Inherits:
Object
  • Object
show all
Defined in:
lib/google/iam/v1beta/workload_identity_pools/operations.rb

Overview

Service that implements Longrunning Operations API.

Defined Under Namespace

Classes: Configuration

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|config| ... } ⇒ Operations

Create a new Operations client object.

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/google/iam/v1beta/workload_identity_pools/operations.rb', line 83

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/longrunning/operations_services_pb"

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

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

  # Create credentials
  credentials = @config.credentials
  credentials ||= Credentials.default scope: @config.scope
  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_stub = ::Gapic::ServiceStub.new(
    ::Google::Longrunning::Operations::Stub,
    credentials: credentials,
    endpoint: @config.endpoint,
    endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
    universe_domain: @config.universe_domain,
    channel_args: @config.channel_args,
    interceptors: @config.interceptors,
    channel_pool_config: @config.channel_pool
  )

  # Used by an LRO wrapper for some methods of this service
  @operations_client = self
end

Class Method Details

.configure {|config| ... } ⇒ Operations::Configuration

Configuration for the WorkloadIdentityPools Operations API.

Yields:

  • (config)

    Configure the Operations client.

Yield Parameters:

Returns:



45
46
47
48
49
# File 'lib/google/iam/v1beta/workload_identity_pools/operations.rb', line 45

def self.configure
  @configure ||= Operations::Configuration.new
  yield @configure if block_given?
  @configure
end

Instance Method Details

#cancel_operation(request, options = nil) ⇒ ::Google::Protobuf::Empty #cancel_operation(name: nil) ⇒ ::Google::Protobuf::Empty

Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to Code.CANCELLED.

Examples:

Basic example

require "google/longrunning"

# Create a client object. The client can be reused for multiple calls.
client = Google::Longrunning::Operations::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Longrunning::CancelOperationRequest.new

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

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

Overloads:

  • #cancel_operation(request, options = nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to cancel_operation via a request object, either of type Longrunning::CancelOperationRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Longrunning::CancelOperationRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #cancel_operation(name: nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to cancel_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).

    Parameters:

    • name (::String) (defaults to: nil)

      The name of the operation resource to be cancelled.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
# File 'lib/google/iam/v1beta/workload_identity_pools/operations.rb', line 467

def cancel_operation request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest

  # 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
   = @config.rpcs.cancel_operation..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Iam::V1beta::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

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

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

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

  @operations_stub.call_rpc :cancel_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

#configure {|config| ... } ⇒ Operations::Configuration

Configure the WorkloadIdentityPools Operations 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 configure.

Yields:

  • (config)

    Configure the Operations client.

Yield Parameters:

Returns:



63
64
65
66
# File 'lib/google/iam/v1beta/workload_identity_pools/operations.rb', line 63

def configure
  yield @config if block_given?
  @config
end

#delete_operation(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_operation(name: nil) ⇒ ::Google::Protobuf::Empty

Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED.

Examples:

Basic example

require "google/longrunning"

# Create a client object. The client can be reused for multiple calls.
client = Google::Longrunning::Operations::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Longrunning::DeleteOperationRequest.new

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

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

Overloads:

  • #delete_operation(request, options = nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_operation via a request object, either of type Longrunning::DeleteOperationRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Longrunning::DeleteOperationRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #delete_operation(name: nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_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).

    Parameters:

    • name (::String) (defaults to: nil)

      The name of the operation resource to be deleted.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
# File 'lib/google/iam/v1beta/workload_identity_pools/operations.rb', line 372

def delete_operation request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest

  # 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
   = @config.rpcs.delete_operation..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Iam::V1beta::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

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

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

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

  @operations_stub.call_rpc :delete_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

#get_operation(request, options = nil) ⇒ ::Gapic::Operation #get_operation(name: nil) ⇒ ::Gapic::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.

Examples:

Basic example

require "google/longrunning"

# Create a client object. The client can be reused for multiple calls.
client = Google::Longrunning::Operations::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Longrunning::GetOperationRequest.new

# Call the get_operation method.
result = client.get_operation 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

Overloads:

  • #get_operation(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to get_operation via a request object, either of type Longrunning::GetOperationRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Longrunning::GetOperationRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #get_operation(name: nil) ⇒ ::Gapic::Operation

    Pass arguments to get_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).

    Parameters:

    • name (::String) (defaults to: nil)

      The name of the operation resource.

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.



282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
# File 'lib/google/iam/v1beta/workload_identity_pools/operations.rb', line 282

def get_operation request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest

  # 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
   = @config.rpcs.get_operation..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Iam::V1beta::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

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

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

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

  @operations_stub.call_rpc :get_operation, 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

#list_operations(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Gapic::Operation> #list_operations(name: nil, filter: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Gapic::Operation>

Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED.

NOTE: the name binding allows API services to override the binding to use different resource name schemes, such as users/*/operations. To override the binding, API services can add a binding such as "/v1/{name=users/*}/operations" to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must ensure the name binding is the parent resource, without the operations collection id.

Examples:

Basic example

require "google/longrunning"

# Create a client object. The client can be reused for multiple calls.
client = Google::Longrunning::Operations::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Longrunning::ListOperationsRequest.new

# Call the list_operations method.
result = client.list_operations 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::Longrunning::Operation.
  p item
end

Overloads:

  • #list_operations(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Gapic::Operation>

    Pass arguments to list_operations via a request object, either of type Longrunning::ListOperationsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Longrunning::ListOperationsRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_operations(name: nil, filter: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Gapic::Operation>

    Pass arguments to list_operations 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) (defaults to: nil)

      The name of the operation's parent resource.

    • filter (::String) (defaults to: nil)

      The standard list filter.

    • page_size (::Integer) (defaults to: nil)

      The standard list page size.

    • page_token (::String) (defaults to: nil)

      The standard list page token.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::PagedEnumerable<::Gapic::Operation>)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

  • (::Gapic::PagedEnumerable<::Gapic::Operation>)

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# File 'lib/google/iam/v1beta/workload_identity_pools/operations.rb', line 185

def list_operations request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest

  # 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
   = @config.rpcs.list_operations..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Iam::V1beta::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

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

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

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

  @operations_stub.call_rpc :list_operations, request, options: options do |response, operation|
    wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
    response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#universe_domainString

The effective universe domain

Returns:

  • (String)


73
74
75
# File 'lib/google/iam/v1beta/workload_identity_pools/operations.rb', line 73

def universe_domain
  @operations_stub.universe_domain
end

#wait_operation(request, options = nil) ⇒ ::Gapic::Operation #wait_operation(name: nil, timeout: nil) ⇒ ::Gapic::Operation

Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. If the operation is already done, the latest state is immediately returned. If the timeout specified is greater than the default HTTP/RPC timeout, the HTTP/RPC timeout is used. If the server does not support this method, it returns google.rpc.Code.UNIMPLEMENTED. Note that this method is on a best-effort basis. It may return the latest state before the specified timeout (including immediately), meaning even an immediate response is no guarantee that the operation is done.

Examples:

Basic example

require "google/longrunning"

# Create a client object. The client can be reused for multiple calls.
client = Google::Longrunning::Operations::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Longrunning::WaitOperationRequest.new

# Call the wait_operation method.
result = client.wait_operation 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

Overloads:

  • #wait_operation(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to wait_operation via a request object, either of type Longrunning::WaitOperationRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Longrunning::WaitOperationRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #wait_operation(name: nil, timeout: nil) ⇒ ::Gapic::Operation

    Pass arguments to wait_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).

    Parameters:

    • name (::String) (defaults to: nil)

      The name of the operation resource to wait on.

    • timeout (::Google::Protobuf::Duration, ::Hash) (defaults to: nil)

      The maximum duration to wait before timing out. If left blank, the wait will be at most the time permitted by the underlying HTTP/RPC protocol. If RPC context deadline is also specified, the shorter one will be used.

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.



572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
# File 'lib/google/iam/v1beta/workload_identity_pools/operations.rb', line 572

def wait_operation request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest

  # 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
   = @config.rpcs.wait_operation..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Iam::V1beta::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @operations_stub.call_rpc :wait_operation, 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