Class: AWSCDK::Autoscaling::CfnScalingPolicy::MetricDataQueryProperty
- Inherits:
-
Jsii::Struct
- Object
- Jsii::Struct
- AWSCDK::Autoscaling::CfnScalingPolicy::MetricDataQueryProperty
- 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.
MetricDataQuery is a property of the following property types:
- AWS::AutoScaling::ScalingPolicy PredictiveScalingCustomizedScalingMetric
- AWS::AutoScaling::ScalingPolicy PredictiveScalingCustomizedLoadMetric
- AWS::AutoScaling::ScalingPolicy PredictiveScalingCustomizedCapacityMetric
Predictive scaling uses the time series data received from CloudWatch to understand how to schedule capacity based on your historical workload patterns.
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 Advanced predictive scaling policy configurations using custom metrics in the Amazon EC2 Auto Scaling User Guide .
Instance Attribute Summary collapse
-
#expression ⇒ String?
readonly
The math expression to perform on the returned data, if this object is performing a math expression.
-
#id ⇒ String
readonly
A short name that identifies the object's results in the response.
-
#label ⇒ String?
readonly
A human-readable label for this metric or expression.
-
#metric_stat ⇒ AWSCDK::IResolvable, ...
readonly
Information about the metric data to return.
-
#return_data ⇒ Boolean, ...
readonly
Indicates whether to return the timestamps and raw data values of this metric.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id:, expression: nil, label: nil, metric_stat: nil, return_data: nil) ⇒ MetricDataQueryProperty
constructor
A new instance of MetricDataQueryProperty.
- #to_jsii ⇒ Object
Constructor Details
#initialize(id:, expression: nil, label: nil, metric_stat: nil, return_data: nil) ⇒ MetricDataQueryProperty
Returns a new instance of MetricDataQueryProperty.
783 784 785 786 787 788 789 790 791 792 793 794 |
# File 'autoscaling/cfn_scaling_policy.rb', line 783 def initialize(id:, expression: nil, label: nil, metric_stat: 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::MetricStatProperty.new(**metric_stat.transform_keys(&:to_sym)) : metric_stat Jsii::Type.check_type(@metric_stat, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19hdXRvc2NhbGluZy5DZm5TY2FsaW5nUG9saWN5Lk1ldHJpY1N0YXRQcm9wZXJ0eSJ9XX19")), "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
#expression ⇒ String? (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 MetricDataQuery object, you must specify either Expression or MetricStat , but not both.
811 812 813 |
# File 'autoscaling/cfn_scaling_policy.rb', line 811 def expression @expression end |
#id ⇒ String (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.
802 803 804 |
# File 'autoscaling/cfn_scaling_policy.rb', line 802 def id @id end |
#label ⇒ String? (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.
818 819 820 |
# File 'autoscaling/cfn_scaling_policy.rb', line 818 def label @label end |
#metric_stat ⇒ AWSCDK::IResolvable, ... (readonly)
Information about the metric data to return.
Conditional: Within each MetricDataQuery object, you must specify either Expression or MetricStat , but not both.
825 826 827 |
# File 'autoscaling/cfn_scaling_policy.rb', line 825 def metric_stat @metric_stat end |
#return_data ⇒ Boolean, ... (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 ).
834 835 836 |
# File 'autoscaling/cfn_scaling_policy.rb', line 834 def return_data @return_data end |
Class Method Details
.jsii_properties ⇒ Object
836 837 838 839 840 841 842 843 844 |
# File 'autoscaling/cfn_scaling_policy.rb', line 836 def self.jsii_properties { :id => "id", :expression => "expression", :label => "label", :metric_stat => "metricStat", :return_data => "returnData", } end |
Instance Method Details
#to_jsii ⇒ Object
846 847 848 849 850 851 852 853 854 855 856 |
# File 'autoscaling/cfn_scaling_policy.rb', line 846 def to_jsii result = {} result.merge!({ "id" => @id, "expression" => @expression, "label" => @label, "metricStat" => @metric_stat, "returnData" => @return_data, }) result.compact end |