shared/output/gapic/templates/showcase/lib/google/showcase/v1beta1/messaging/operations.rb
##
# 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 {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
# corresponding to `Code.CANCELLED`.
#
# @overload cancel_operation(request, options = nil)
#   Pass arguments to `cancel_operation` via a request object, either of type
#   {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash.
#
#   @param 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.
#   @param options [::Gapic::CallOptions, ::Hash]
#     Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
#
# @overload cancel_operation(name: nil)
#   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).
#
#   @param name [::String]
#     The name of the operation resource to be cancelled.
#
# @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 [::GRPC::BadStatus] if the RPC is aborted.
#
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.
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 .
def cancel_operation request, options = nil
            raise ::ArgumentError, "request must be provided" if request.nil?
            request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest
            options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
            metadata = @config.rpcs.cancel_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
            header_params = {}
            if request.name
              header_params["name"] = request.name
            end
            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.cancel_operation.timeout,
                                   metadata:     metadata,
                                   retry_policy: @config.rpcs.cancel_operation.retry_policy
            options.apply_defaults timeout:      @config.timeout,
                                   metadata:     @config.metadata,
                                   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
          end
def cancel_operation request , options = nil raise :: ArgumentError , "request must be provided" if request . nil? request = :: Gapic :: Protobuf . coerce request , to : :: Google :: Longrunning :: CancelOperationRequest options = :: Gapic :: CallOptions . new ( ** options . to_h ) if options . respond_to? :to_h metadata = @config . rpcs . cancel_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 header_params = { } if request . name header_params [ "name" ] = request . name end 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 . cancel_operation . timeout , metadata : metadata , retry_policy : @config . rpcs . cancel_operation . retry_policy options . apply_defaults timeout : @config . timeout , metadata : @config . metadata , 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 end
Starts asynchronous cancellation on a long-running operation.
Starts asynchronous cancellation on a long - running operation .
# 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
::Google::Protobuf::Empty
[::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
cancel_operation(request, options = nil) Pass arguments to `cancel_operation` via a request object, either of type {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash. @param 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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
cancel_operation ( request options = nil ) Pass arguments to ` cancel_operation ` via a request object either of type { :: Google :: Longrunning :: CancelOperationRequest } or an equivalent Hash . @param 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 . @param options [ :: Gapic :: CallOptions :: Hash ] Overrides the default settings for this call e . g timeout retries etc . Optional .
overload
nil) 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 . @param name [::String] The name of the operation resource to be cancelled.
nil ) 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 . @param name [ :: String ] The name of the operation resource to be cancelled .