Method: Google::Cloud::Monitoring::V3::GroupService::Client#update_group

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

#update_group(request, options = nil) ⇒ ::Google::Cloud::Monitoring::V3::Group #update_group(group: nil, validate_only: nil) ⇒ ::Google::Cloud::Monitoring::V3::Group

Updates an existing group. You can change any group attributes except name.

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::GroupService::Client.new

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

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

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

Overloads:

  • #update_group(request, options = nil) ⇒ ::Google::Cloud::Monitoring::V3::Group

    Pass arguments to update_group via a request object, either of type UpdateGroupRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Monitoring::V3::UpdateGroupRequest, ::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_group(group: nil, validate_only: nil) ⇒ ::Google::Cloud::Monitoring::V3::Group

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

    • group (::Google::Cloud::Monitoring::V3::Group, ::Hash) (defaults to: nil)

      Required. The new definition of the group. All fields of the existing group, excepting name, are replaced with the corresponding fields of this group.

    • validate_only (::Boolean) (defaults to: nil)

      If true, validate this request but do not update the existing group.

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]

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
564
565
566
567
568
569
570
571
572
573
574
575
576
577
# File 'lib/google/cloud/monitoring/v3/group_service/client.rb', line 538

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

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

  # 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_group..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.group&.name
    header_params["group.name"] = request.group.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_group.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.update_group.retry_policy

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

  @group_service_stub.call_rpc :update_group, 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