Class: AWSCDK::Autoscaling::CfnScalingPolicy::TargetTrackingMetricDataQueryProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
autoscaling/cfn_scaling_policy.rb

Overview

The metric data to return.

Also defines whether this call is returning data for one metric only, or whether it is performing a math expression on the values of returned metric statistics to create a new time series. A time series is a series of data points, each of which is associated with a timestamp.

You can use TargetTrackingMetricDataQuery structures with a PutScalingPolicy operation when you specify a TargetTrackingConfiguration in the request.

You can call for a single metric or perform math expressions on multiple metrics. Any expressions used in a metric specification must eventually return a single time series.

For more information, see the Create a target tracking scaling policy for Amazon EC2 Auto Scaling using metric math in the Amazon EC2 Auto Scaling User Guide .

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, expression: nil, label: nil, metric_stat: nil, period: nil, return_data: nil) ⇒ TargetTrackingMetricDataQueryProperty

Returns a new instance of TargetTrackingMetricDataQueryProperty.

Parameters:

  • id (String)

    A short name that identifies the object's results in the response.

  • expression (String, nil) (defaults to: nil)

    The math expression to perform on the returned data, if this object is performing a math expression.

  • label (String, nil) (defaults to: nil)

    A human-readable label for this metric or expression.

  • metric_stat (AWSCDK::IResolvable, AWSCDK::Autoscaling::CfnScalingPolicy::TargetTrackingMetricStatProperty, nil) (defaults to: nil)

    Information about the metric data to return.

  • period (Numeric, nil) (defaults to: nil)

    The period of the metric in seconds.

  • return_data (Boolean, AWSCDK::IResolvable, nil) (defaults to: nil)

    Indicates whether to return the timestamps and raw data values of this metric.



1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
# File 'autoscaling/cfn_scaling_policy.rb', line 1747

def initialize(id:, expression: nil, label: nil, metric_stat: nil, period: nil, return_data: nil)
  @id = id
  Jsii::Type.check_type(@id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  @expression = expression
  Jsii::Type.check_type(@expression, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "expression") unless @expression.nil?
  @label = label
  Jsii::Type.check_type(@label, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "label") unless @label.nil?
  @metric_stat = metric_stat.is_a?(Hash) ? ::AWSCDK::Autoscaling::CfnScalingPolicy::TargetTrackingMetricStatProperty.new(**metric_stat.transform_keys(&:to_sym)) : metric_stat
  Jsii::Type.check_type(@metric_stat, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19hdXRvc2NhbGluZy5DZm5TY2FsaW5nUG9saWN5LlRhcmdldFRyYWNraW5nTWV0cmljU3RhdFByb3BlcnR5In1dfX0=")), "metricStat") unless @metric_stat.nil?
  @period = period
  Jsii::Type.check_type(@period, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "period") unless @period.nil?
  @return_data = return_data
  Jsii::Type.check_type(@return_data, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "returnData") unless @return_data.nil?
end

Instance Attribute Details

#expressionString? (readonly)

The math expression to perform on the returned data, if this object is performing a math expression.

This expression can use the Id of the other metrics to refer to those metrics, and can also use the Id of other expressions to use the result of those expressions.

Conditional: Within each TargetTrackingMetricDataQuery object, you must specify either Expression or MetricStat , but not both.



1777
1778
1779
# File 'autoscaling/cfn_scaling_policy.rb', line 1777

def expression
  @expression
end

#idString (readonly)

A short name that identifies the object's results in the response.

This name must be unique among all TargetTrackingMetricDataQuery objects specified for a single scaling policy. 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 underscores. The first character must be a lowercase letter.



1768
1769
1770
# File 'autoscaling/cfn_scaling_policy.rb', line 1768

def id
  @id
end

#labelString? (readonly)

A human-readable label for this metric or expression.

This is especially useful if this is a math expression, so that you know what the value represents.



1784
1785
1786
# File 'autoscaling/cfn_scaling_policy.rb', line 1784

def label
  @label
end

#metric_statAWSCDK::IResolvable, ... (readonly)

Information about the metric data to return.

Conditional: Within each TargetTrackingMetricDataQuery object, you must specify either Expression or MetricStat , but not both.



1791
1792
1793
# File 'autoscaling/cfn_scaling_policy.rb', line 1791

def metric_stat
  @metric_stat
end

#periodNumeric? (readonly)

The period of the metric in seconds.

The default value is 60. Accepted values are 10, 30, and 60. For high resolution metric, set the value to less than 60. For more information, see Create a target tracking policy using high-resolution metrics for faster response .



1798
1799
1800
# File 'autoscaling/cfn_scaling_policy.rb', line 1798

def period
  @period
end

#return_dataBoolean, ... (readonly)

Indicates whether to return the timestamps and raw data values of this metric.

If you use any math expressions, specify true for this value for only the final math expression that the metric specification is based on. You must specify false for ReturnData for all the other metrics and expressions used in the metric specification.

If you are only retrieving metrics and not performing any math expressions, do not specify anything for ReturnData . This sets it to its default ( true ).



1807
1808
1809
# File 'autoscaling/cfn_scaling_policy.rb', line 1807

def return_data
  @return_data
end

Class Method Details

.jsii_propertiesObject



1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
# File 'autoscaling/cfn_scaling_policy.rb', line 1809

def self.jsii_properties
  {
    :id => "id",
    :expression => "expression",
    :label => "label",
    :metric_stat => "metricStat",
    :period => "period",
    :return_data => "returnData",
  }
end

Instance Method Details

#to_jsiiObject



1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
# File 'autoscaling/cfn_scaling_policy.rb', line 1820

def to_jsii
  result = {}
  result.merge!({
    "id" => @id,
    "expression" => @expression,
    "label" => @label,
    "metricStat" => @metric_stat,
    "period" => @period,
    "returnData" => @return_data,
  })
  result.compact
end