Class: AWSCDK::ApplicationAutoScaling::CfnScalingPolicy::TargetTrackingMetricDataQueryProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
application_auto_scaling/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 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 and examples, see Create a target tracking scaling policy for Application Auto Scaling using metric math in the Application Auto Scaling User Guide .

TargetTrackingMetricDataQuery is a property of the AWS::ApplicationAutoScaling::ScalingPolicy CustomizedMetricSpecification property type.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of TargetTrackingMetricDataQueryProperty.

Parameters:

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

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

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

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

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

    A human-readable label for this metric or expression.

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

    Information about the metric data to return.

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

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



1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
# File 'application_auto_scaling/cfn_scaling_policy.rb', line 1688

def initialize(expression: nil, id: nil, label: nil, metric_stat: nil, return_data: nil)
  @expression = expression
  Jsii::Type.check_type(@expression, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "expression") unless @expression.nil?
  @id = id
  Jsii::Type.check_type(@id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") unless @id.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::ApplicationAutoScaling::CfnScalingPolicy::TargetTrackingMetricStatProperty.new(**metric_stat.transform_keys(&:to_sym)) : metric_stat
  Jsii::Type.check_type(@metric_stat, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19hcHBsaWNhdGlvbmF1dG9zY2FsaW5nLkNmblNjYWxpbmdQb2xpY3kuVGFyZ2V0VHJhY2tpbmdNZXRyaWNTdGF0UHJvcGVydHkifV19fQ==")), "metricStat") unless @metric_stat.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.



1709
1710
1711
# File 'application_auto_scaling/cfn_scaling_policy.rb', line 1709

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 MetricDataQuery 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.



1716
1717
1718
# File 'application_auto_scaling/cfn_scaling_policy.rb', line 1716

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.



1723
1724
1725
# File 'application_auto_scaling/cfn_scaling_policy.rb', line 1723

def label
  @label
end

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

Information about the metric data to return.

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



1730
1731
1732
# File 'application_auto_scaling/cfn_scaling_policy.rb', line 1730

def metric_stat
  @metric_stat
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 ).



1739
1740
1741
# File 'application_auto_scaling/cfn_scaling_policy.rb', line 1739

def return_data
  @return_data
end

Class Method Details

.jsii_propertiesObject



1741
1742
1743
1744
1745
1746
1747
1748
1749
# File 'application_auto_scaling/cfn_scaling_policy.rb', line 1741

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

Instance Method Details

#to_jsiiObject



1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
# File 'application_auto_scaling/cfn_scaling_policy.rb', line 1751

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