shared/output/gapic/templates/showcase/lib/google/showcase/v1beta1/messaging/operations.rb
##
# Waits for the specified long-running operation until it 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.
#
# @overload wait_operation(request, options = nil)
#   Pass arguments to `wait_operation` via a request object, either of type
#   {::Google::Longrunning::WaitOperationRequest} or an equivalent Hash.
#
#   @param 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.
#   @param options [::Gapic::CallOptions, ::Hash]
#     Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
#
# @overload wait_operation(name: nil, timeout: nil)
#   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).
#
#   @param name [::String]
#     The name of the operation resource to wait on.
#   @param timeout [::Google::Protobuf::Duration, ::Hash]
#     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.
#
# @yield [response, operation] Access the result along with the RPC operation
# @yieldparam response [::Gapic::Operation]
# @yieldparam operation [::GRPC::ActiveCall::Operation]
#
# @return [::Gapic::Operation]
#
# @raise [::GRPC::BadStatus] if the RPC is aborted.
#
Waits for the specified long-running operation until it 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.
Waits for the specified long - running operation until it 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 .
def wait_operation request, options = nil
            raise ::ArgumentError, "request must be provided" if request.nil?
            request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest
            options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
            metadata = @config.rpcs.wait_operation.metadata.to_h
            metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
              lib_name: @config.lib_name, lib_version: @config.lib_version,
              gapic_version: ::Google::Showcase::VERSION
            metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
            options.apply_defaults timeout:      @config.rpcs.wait_operation.timeout,
                                   metadata:     metadata,
                                   retry_policy: @config.rpcs.wait_operation.retry_policy
            options.apply_defaults timeout:      @config.timeout,
                                   metadata:     @config.metadata,
                                   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
          end
def wait_operation request , options = nil raise :: ArgumentError , "request must be provided" if request . nil? request = :: Gapic :: Protobuf . coerce request , to : :: Google :: Longrunning :: WaitOperationRequest options = :: Gapic :: CallOptions . new ( ** options . to_h ) if options . respond_to? :to_h metadata = @config . rpcs . wait_operation . metadata . to_h metadata [ :" x-goog-api-client " ] ||= :: Gapic :: Headers . x_goog_api_client lib_name : @config . lib_name , lib_version : @config . lib_version , gapic_version : :: Google :: Showcase :: VERSION metadata [ :" x-goog-user-project " ] = @quota_project_id if @quota_project_id options . apply_defaults timeout : @config . rpcs . wait_operation . timeout , metadata : metadata , retry_policy : @config . rpcs . wait_operation . retry_policy options . apply_defaults timeout : @config . timeout , metadata : @config . metadata , 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 end
Waits for the specified long-running operation until it is done or reaches
at most a specified timeout, returning the latest state.
Waits for the specified long - running operation until it is done or reaches at most a specified timeout returning the latest state .
# Converts hash and nil to an options object # Customize the options with defaults # Set x-goog-api-client and x-goog-user-project headers
None
::Gapic::Operation
[::GRPC::BadStatus] if the RPC is aborted.
[ :: GRPC :: BadStatus ] if the RPC is aborted .
request
<not_specific>
options
<not_specific>
]
<not_specific>
Access the result along with the RPC operation
Access the result along with the RPC operation
<not_specific>
None
overload
wait_operation(request, options = nil) Pass arguments to `wait_operation` via a request object, either of type {::Google::Longrunning::WaitOperationRequest} or an equivalent Hash. @param 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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
wait_operation ( request options = nil ) Pass arguments to ` wait_operation ` via a request object either of type { :: Google :: Longrunning :: WaitOperationRequest } or an equivalent Hash . @param 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 . @param options [ :: Gapic :: CallOptions :: Hash ] Overrides the default settings for this call e . g timeout retries etc . Optional .
overload
nil, timeout: nil) 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 . @param name [::String] The name of the operation resource to wait on. @param timeout [::Google::Protobuf::Duration, ::Hash] 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.
nil timeout : nil ) 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 . @param name [ :: String ] The name of the operation resource to wait on . @param timeout [ :: Google :: Protobuf :: Duration :: Hash ] 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 .