Class: Pingram::IngishtsPostRequestMetricDataQueriesInner

Inherits:
ApiModelBase
  • Object
show all
Defined in:
lib/pingram/models/ingishts_post_request_metric_data_queries_inner.rb

Overview

<p>This structure is used in both GetMetricData and PutMetricAlarm. The supported use of this structure is different for those two operations.</p> <p>When used in GetMetricData, it indicates the metric data to return, and whether this call is just retrieving a batch set of data for one metric, or is performing a Metrics Insights query or a math expression. A single GetMetricData call can include up to 500 MetricDataQuery structures.</p> <p>When used in PutMetricAlarm, it enables you to create an alarm based on a metric math expression. Each MetricDataQuery in the array specifies either a metric to retrieve, or a math expression to be performed on retrieved metrics. A single PutMetricAlarm call can include up to 20 MetricDataQuery structures in the array. The 20 structures can include as many as 10 structures that contain a MetricStat parameter to retrieve a metric, and as many as 10 structures that contain the Expression parameter to perform a math expression. Of those Expression structures, one must have true as the value for ReturnData. The result of this expression is the value the alarm watches.</p> <p>Any expression used in a PutMetricAlarm operation must return a single time series. For more information, see <a href="docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/using-metric-math.html#metric-math-syntax">Metric Math Syntax and Functions</a> in the Amazon CloudWatch User Guide.</p> <p>Some of the parameters of this structure also have different uses whether you are using this structure in a GetMetricData operation or a PutMetricAlarm operation. These differences are explained in the following parameter list.</p>

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ IngishtsPostRequestMetricDataQueriesInner

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/pingram/models/ingishts_post_request_metric_data_queries_inner.rb', line 83

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Pingram::IngishtsPostRequestMetricDataQueriesInner` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Pingram::IngishtsPostRequestMetricDataQueriesInner`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.key?(:'metric_stat')
    self.metric_stat = attributes[:'metric_stat']
  end

  if attributes.key?(:'expression')
    self.expression = attributes[:'expression']
  end

  if attributes.key?(:'label')
    self.label = attributes[:'label']
  end

  if attributes.key?(:'return_data')
    self.return_data = attributes[:'return_data']
  end

  if attributes.key?(:'period')
    self.period = attributes[:'period']
  end

  if attributes.key?(:'account_id')
    self. = attributes[:'account_id']
  end
end

Instance Attribute Details

#account_idObject

<p>The ID of the account where the metrics are located.</p> <p>If you are performing a GetMetricData operation in a monitoring account, use this to specify which account to retrieve this metric from.</p> <p>If you are performing a PutMetricAlarm operation, use this to specify which account contains the metric that the alarm is watching.</p>



37
38
39
# File 'lib/pingram/models/ingishts_post_request_metric_data_queries_inner.rb', line 37

def 
  @account_id
end

#expressionObject

<p>This field can contain either a Metrics Insights query, or a metric math expression to be performed on the returned data. For more information about Metrics Insights queries, see <a href="docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch-metrics-insights-querylanguage">Metrics Insights query components and syntax</a> in the Amazon CloudWatch User Guide.</p> <p>A math expression can use the Id of the other metrics or queries to refer to those metrics, and can also use the Id of other expressions to use the result of those expressions. For more information about metric math expressions, see <a href="docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/using-metric-math.html#metric-math-syntax">Metric Math Syntax and Functions</a> in the Amazon CloudWatch User Guide.</p> <p>Within each MetricDataQuery object, you must specify either Expression or MetricStat but not both.</p>



25
26
27
# File 'lib/pingram/models/ingishts_post_request_metric_data_queries_inner.rb', line 25

def expression
  @expression
end

#idObject

<p>A short name used to tie this object to the results in the response. This name must be unique within a single call to GetMetricData. If you are performing math expressions on this set of data, this name represents that data and can serve as a variable in the mathematical expression. The valid characters are letters, numbers, and underscore. The first character must be a lowercase letter.</p>



20
21
22
# File 'lib/pingram/models/ingishts_post_request_metric_data_queries_inner.rb', line 20

def id
  @id
end

#labelObject

<p>A human-readable label for this metric or expression. This is especially useful if this is an expression, so that you know what the value represents. If the metric or expression is shown in a CloudWatch dashboard widget, the label is shown. If Label is omitted, CloudWatch generates a default.</p> <p>You can put dynamic expressions into a label, so that it is more descriptive. For more information, see <a href="docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/graph-dynamic-labels.html">Using Dynamic Labels</a>.</p>



28
29
30
# File 'lib/pingram/models/ingishts_post_request_metric_data_queries_inner.rb', line 28

def label
  @label
end

#metric_statObject

Returns the value of attribute metric_stat.



22
23
24
# File 'lib/pingram/models/ingishts_post_request_metric_data_queries_inner.rb', line 22

def metric_stat
  @metric_stat
end

#periodObject

<p>The granularity, in seconds, of the returned data points. For metrics with regular resolution, a period can be as short as one minute (60 seconds) and must be a multiple of 60. For high-resolution metrics that are collected at intervals of less than one minute, the period can be 1, 5, 10, 20, 30, 60, or any multiple of 60. High-resolution metrics are those metrics stored by a PutMetricData operation that includes a StorageResolution of 1 second.</p>



34
35
36
# File 'lib/pingram/models/ingishts_post_request_metric_data_queries_inner.rb', line 34

def period
  @period
end

#return_dataObject

<p>When used in GetMetricData, this option indicates whether to return the timestamps and raw data values of this metric. If you are performing this call just to do math expressions and do not also need the raw data returned, you can specify false. If you omit this, the default of true is used.</p> <p>When used in PutMetricAlarm, specify true for the one expression result to use as the alarm. For all other metrics and expressions in the same PutMetricAlarm operation, specify ReturnData as False.</p>



31
32
33
# File 'lib/pingram/models/ingishts_post_request_metric_data_queries_inner.rb', line 31

def return_data
  @return_data
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



53
54
55
# File 'lib/pingram/models/ingishts_post_request_metric_data_queries_inner.rb', line 53

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



58
59
60
# File 'lib/pingram/models/ingishts_post_request_metric_data_queries_inner.rb', line 58

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/pingram/models/ingishts_post_request_metric_data_queries_inner.rb', line 40

def self.attribute_map
  {
    :'id' => :'Id',
    :'metric_stat' => :'MetricStat',
    :'expression' => :'Expression',
    :'label' => :'Label',
    :'return_data' => :'ReturnData',
    :'period' => :'Period',
    :'account_id' => :'AccountId'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/pingram/models/ingishts_post_request_metric_data_queries_inner.rb', line 170

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



76
77
78
79
# File 'lib/pingram/models/ingishts_post_request_metric_data_queries_inner.rb', line 76

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



63
64
65
66
67
68
69
70
71
72
73
# File 'lib/pingram/models/ingishts_post_request_metric_data_queries_inner.rb', line 63

def self.openapi_types
  {
    :'id' => :'String',
    :'metric_stat' => :'IngishtsPostRequestMetricDataQueriesInnerMetricStat',
    :'expression' => :'String',
    :'label' => :'String',
    :'return_data' => :'Boolean',
    :'period' => :'Float',
    :'account_id' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



143
144
145
146
147
148
149
150
151
152
153
# File 'lib/pingram/models/ingishts_post_request_metric_data_queries_inner.rb', line 143

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      metric_stat == o.metric_stat &&
      expression == o.expression &&
      label == o.label &&
      return_data == o.return_data &&
      period == o.period &&
       == o.
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


157
158
159
# File 'lib/pingram/models/ingishts_post_request_metric_data_queries_inner.rb', line 157

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



163
164
165
# File 'lib/pingram/models/ingishts_post_request_metric_data_queries_inner.rb', line 163

def hash
  [id, metric_stat, expression, label, return_data, period, ].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



128
129
130
131
132
# File 'lib/pingram/models/ingishts_post_request_metric_data_queries_inner.rb', line 128

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



192
193
194
195
196
197
198
199
200
201
202
203
204
# File 'lib/pingram/models/ingishts_post_request_metric_data_queries_inner.rb', line 192

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



136
137
138
139
# File 'lib/pingram/models/ingishts_post_request_metric_data_queries_inner.rb', line 136

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  true
end