Class: AWSCDK::Autoscaling::CfnScalingPolicy::MetricStatProperty

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

Overview

MetricStat is a property of the AWS::AutoScaling::ScalingPolicy MetricDataQuery property type.

This structure defines the CloudWatch metric to return, along with the statistic and unit.

For more information about the CloudWatch terminology below, see Amazon CloudWatch concepts in the Amazon CloudWatch User Guide .

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(metric:, stat:, unit: nil) ⇒ MetricStatProperty

Returns a new instance of MetricStatProperty.

Parameters:



976
977
978
979
980
981
982
983
# File 'autoscaling/cfn_scaling_policy.rb', line 976

def initialize(metric:, stat:, unit: nil)
  @metric = metric.is_a?(Hash) ? ::AWSCDK::Autoscaling::CfnScalingPolicy::MetricProperty.new(**metric.transform_keys(&:to_sym)) : metric
  Jsii::Type.check_type(@metric, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19hdXRvc2NhbGluZy5DZm5TY2FsaW5nUG9saWN5Lk1ldHJpY1Byb3BlcnR5In1dfX0=")), "metric")
  @stat = stat
  Jsii::Type.check_type(@stat, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "stat")
  @unit = unit
  Jsii::Type.check_type(@unit, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "unit") unless @unit.nil?
end

Instance Attribute Details

#metricAWSCDK::IResolvable, AWSCDK::Autoscaling::CfnScalingPolicy::MetricProperty (readonly)

The CloudWatch metric to return, including the metric name, namespace, and dimensions.

To get the exact metric name, namespace, and dimensions, inspect the Metric object that is returned by a call to ListMetrics .



991
992
993
# File 'autoscaling/cfn_scaling_policy.rb', line 991

def metric
  @metric
end

#statString (readonly)

The statistic to return.

It can include any CloudWatch statistic or extended statistic. For a list of valid values, see the table in Statistics in the Amazon CloudWatch User Guide .

The most commonly used metrics for predictive scaling are Average and Sum .



1000
1001
1002
# File 'autoscaling/cfn_scaling_policy.rb', line 1000

def stat
  @stat
end

#unitString? (readonly)

The unit to use for the returned data points.

For a complete list of the units that CloudWatch supports, see the MetricDatum data type in the Amazon CloudWatch API Reference .



1007
1008
1009
# File 'autoscaling/cfn_scaling_policy.rb', line 1007

def unit
  @unit
end

Class Method Details

.jsii_propertiesObject



1009
1010
1011
1012
1013
1014
1015
# File 'autoscaling/cfn_scaling_policy.rb', line 1009

def self.jsii_properties
  {
    :metric => "metric",
    :stat => "stat",
    :unit => "unit",
  }
end

Instance Method Details

#to_jsiiObject



1017
1018
1019
1020
1021
1022
1023
1024
1025
# File 'autoscaling/cfn_scaling_policy.rb', line 1017

def to_jsii
  result = {}
  result.merge!({
    "metric" => @metric,
    "stat" => @stat,
    "unit" => @unit,
  })
  result.compact
end