Class: AWSCDK::Autoscaling::CfnScalingPolicy::TargetTrackingMetricStatProperty

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

Overview

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

TargetTrackingMetricStat is a property of the TargetTrackingMetricDataQuery object.

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:, period: nil, unit: nil) ⇒ TargetTrackingMetricStatProperty

Returns a new instance of TargetTrackingMetricStatProperty.

Parameters:



1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
# File 'autoscaling/cfn_scaling_policy.rb', line 1848

def initialize(metric:, stat:, period: nil, 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")
  @period = period
  Jsii::Type.check_type(@period, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "period") unless @period.nil?
  @unit = unit
  Jsii::Type.check_type(@unit, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "unit") unless @unit.nil?
end

Instance Attribute Details

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



1879
1880
1881
# File 'autoscaling/cfn_scaling_policy.rb', line 1879

def period
  @period
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 metric for scaling is Average .



1872
1873
1874
# File 'autoscaling/cfn_scaling_policy.rb', line 1872

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 .



1886
1887
1888
# File 'autoscaling/cfn_scaling_policy.rb', line 1886

def unit
  @unit
end

Class Method Details

.jsii_propertiesObject



1888
1889
1890
1891
1892
1893
1894
1895
# File 'autoscaling/cfn_scaling_policy.rb', line 1888

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

Instance Method Details

#to_jsiiObject



1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
# File 'autoscaling/cfn_scaling_policy.rb', line 1897

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