Method: Google::Cloud::Monitoring::V3::UptimeCheckService::Client#update_uptime_check_config

Defined in:
lib/google/cloud/monitoring/v3/uptime_check_service/client.rb

#update_uptime_check_config(request, options = nil) ⇒ ::Google::Cloud::Monitoring::V3::UptimeCheckConfig #update_uptime_check_config(update_mask: nil, uptime_check_config: nil) ⇒ ::Google::Cloud::Monitoring::V3::UptimeCheckConfig

Updates an Uptime check configuration. You can either replace the entire configuration with a new one or replace only certain fields in the current configuration by specifying the fields to be updated via updateMask. Returns the updated configuration.

Examples:

Basic example

require "google/cloud/monitoring/v3"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Monitoring::V3::UptimeCheckService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Monitoring::V3::UpdateUptimeCheckConfigRequest.new

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

# The returned object is of type Google::Cloud::Monitoring::V3::UptimeCheckConfig.
p result

Overloads:

  • #update_uptime_check_config(request, options = nil) ⇒ ::Google::Cloud::Monitoring::V3::UptimeCheckConfig

    Pass arguments to update_uptime_check_config via a request object, either of type Google::Cloud::Monitoring::V3::UpdateUptimeCheckConfigRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Monitoring::V3::UpdateUptimeCheckConfigRequest, ::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.

  • #update_uptime_check_config(update_mask: nil, uptime_check_config: nil) ⇒ ::Google::Cloud::Monitoring::V3::UptimeCheckConfig

    Pass arguments to update_uptime_check_config 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:

    • update_mask (::Google::Protobuf::FieldMask, ::Hash) (defaults to: nil)

      Optional. If present, only the listed fields in the current Uptime check configuration are updated with values from the new configuration. If this field is empty, then the current configuration is completely replaced with the new configuration.

    • uptime_check_config (::Google::Cloud::Monitoring::V3::UptimeCheckConfig, ::Hash) (defaults to: nil)

      Required. If an updateMask has been specified, this field gives the values for the set of fields mentioned in the updateMask. If an updateMask has not been given, this Uptime check configuration replaces the current configuration. If a field is mentioned in updateMask but the corresonding field is omitted in this partial Uptime check configuration, it has the effect of deleting/clearing the field from the configuration on the server.

      The following fields can be updated: display_name, http_check, tcp_check, timeout, content_matchers, and selected_regions.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.

[View source]

524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
# File 'lib/google/cloud/monitoring/v3/uptime_check_service/client.rb', line 524

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::V3::UpdateUptimeCheckConfigRequest

  # 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.update_uptime_check_config..to_h

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

  header_params = {}
  if request.uptime_check_config&.name
    header_params["uptime_check_config.name"] = request.uptime_check_config.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.update_uptime_check_config.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.update_uptime_check_config.retry_policy

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

  @uptime_check_service_stub.call_rpc :update_uptime_check_config, 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