# Service Management V1 API - Class Google::Api::MetricRule (v1.8.0)

1.8.0 (latest) 1.7.1 1.6.0 1.5.1 1.4.0 1.3.0 1.2.1 1.1.0 1.0.2 0.11.0 0.10.2 0.9.0 0.8.0 0.7.0 0.6.1 0.5.0 0.4.1 0.3.10 Reference documentation and code samples for the Service Management V1 API class Google::Api::MetricRule.

Bind API methods to metrics. Binding a method to a metric causes that
metric's configured quota behaviors to apply to the method call.

## Inherits

- Object

## Extended By

- Google::Protobuf::MessageExts::ClassMethods

## Includes

- Google::Protobuf::MessageExts

## Methods

### #metric_costs

    def metric_costs() -> ::Google::Protobuf::Map{::String => ::Integer}

**Returns**

- (::Google::Protobuf::Map{::String =\> ::Integer}) --- Metrics to update when the selected methods are called, and the associated cost applied to each metric.

  The key of the map is the metric name, and the values are the amount
  increased for the metric against which the quota limits are defined.
  The value must not be negative.

### #metric_costs=

    def metric_costs=(value) -> ::Google::Protobuf::Map{::String => ::Integer}

**Parameter**

- **value** (::Google::Protobuf::Map{::String =\> ::Integer}) --- Metrics to update when the selected methods are called, and the associated cost applied to each metric.


  The key of the map is the metric name, and the values are the amount
  increased for the metric against which the quota limits are defined.
  The value must not be negative.
**Returns**

- (::Google::Protobuf::Map{::String =\> ::Integer}) --- Metrics to update when the selected methods are called, and the associated cost applied to each metric.

  The key of the map is the metric name, and the values are the amount
  increased for the metric against which the quota limits are defined.
  The value must not be negative.

### #selector

    def selector() -> ::String

**Returns**

- (::String) --- Selects the methods to which this rule applies.

  Refer to [selector](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-service_management-v1/latest/Google-Api-DocumentationRule#Google__Api__DocumentationRule_selector_instance_ "Google::Api::DocumentationRule#selector (method)") for syntax
  details.

### #selector=

    def selector=(value) -> ::String

**Parameter**

- **value** (::String) --- Selects the methods to which this rule applies.


  Refer to [selector](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-service_management-v1/latest/Google-Api-DocumentationRule#Google__Api__DocumentationRule_selector_instance_ "Google::Api::DocumentationRule#selector (method)") for syntax
  details.
**Returns**

- (::String) --- Selects the methods to which this rule applies.

  Refer to [selector](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-service_management-v1/latest/Google-Api-DocumentationRule#Google__Api__DocumentationRule_selector_instance_ "Google::Api::DocumentationRule#selector (method)") for syntax
  details.