Class: Google::Apis::ServiceconsumermanagementV1::MetricRule

Inherits:
Object
  • Object
show all
Includes:
Core::Hashable, Core::JsonObjectSupport
Defined in:
generated/google/apis/serviceconsumermanagement_v1/classes.rb,
generated/google/apis/serviceconsumermanagement_v1/representations.rb,
generated/google/apis/serviceconsumermanagement_v1/representations.rb

Overview

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Core::JsonObjectSupport

#to_json

Methods included from Core::Hashable

process_value, #to_h

Constructor Details

#initialize(**args) ⇒ MetricRule

Returns a new instance of MetricRule



2057
2058
2059
# File 'generated/google/apis/serviceconsumermanagement_v1/classes.rb', line 2057

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#metric_costsHash<String,Fixnum>

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. Corresponds to the JSON property metricCosts

Returns:

  • (Hash<String,Fixnum>)


2049
2050
2051
# File 'generated/google/apis/serviceconsumermanagement_v1/classes.rb', line 2049

def metric_costs
  @metric_costs
end

#selectorString

Selects the methods to which this rule applies. Refer to selector for syntax details. Corresponds to the JSON property selector

Returns:

  • (String)


2055
2056
2057
# File 'generated/google/apis/serviceconsumermanagement_v1/classes.rb', line 2055

def selector
  @selector
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



2062
2063
2064
2065
# File 'generated/google/apis/serviceconsumermanagement_v1/classes.rb', line 2062

def update!(**args)
  @metric_costs = args[:metric_costs] if args.key?(:metric_costs)
  @selector = args[:selector] if args.key?(:selector)
end