Class: AWSCDK::CloudWatch::CfnAlarm::MetricStatProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
cloud_watch/cfn_alarm.rb

Overview

This structure defines the metric to be returned, along with the statistics, period, and units.

MetricStat is a property of the MetricDataQuery property type.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of MetricStatProperty.

Parameters:

  • metric (AWSCDK::IResolvable, AWSCDK::CloudWatch::CfnAlarm::MetricProperty)

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

  • period (Numeric)

    The granularity, in seconds, of the returned data points.

  • stat (String)

    The statistic to return.

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

    The unit to use for the returned data points.



1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
# File 'cloud_watch/cfn_alarm.rb', line 1163

def initialize(metric:, period:, stat:, unit: nil)
  @metric = metric.is_a?(Hash) ? ::AWSCDK::CloudWatch::CfnAlarm::MetricProperty.new(**metric.transform_keys(&:to_sym)) : metric
  Jsii::Type.check_type(@metric, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jbG91ZHdhdGNoLkNmbkFsYXJtLk1ldHJpY1Byb3BlcnR5In1dfX0=")), "metric")
  @period = period
  Jsii::Type.check_type(@period, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "period")
  @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::CloudWatch::CfnAlarm::MetricProperty (readonly)

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



1178
1179
1180
# File 'cloud_watch/cfn_alarm.rb', line 1178

def metric
  @metric
end

#periodNumeric (readonly)

The granularity, in seconds, of the returned data points.

For metrics with regular resolution, a period can be as short as one minute (60 seconds) and must be a multiple of 60. For high-resolution metrics that are collected at intervals of less than one minute, the period can be 1, 5, 10, 20, 30, 60, or any multiple of 60. High-resolution metrics are those metrics stored by a PutMetricData call that includes a StorageResolution of 1 second.

If the StartTime parameter specifies a time stamp that is greater than 3 hours ago, you must specify the period as follows or no data points in that time range is returned:

  • Start time between 3 hours and 15 days ago - Use a multiple of 60 seconds (1 minute).
  • Start time between 15 and 63 days ago - Use a multiple of 300 seconds (5 minutes).
  • Start time greater than 63 days ago - Use a multiple of 3600 seconds (1 hour).


1191
1192
1193
# File 'cloud_watch/cfn_alarm.rb', line 1191

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 .



1198
1199
1200
# File 'cloud_watch/cfn_alarm.rb', line 1198

def stat
  @stat
end

#unitString? (readonly)

The unit to use for the returned data points.

Valid values are: Seconds, Microseconds, Milliseconds, Bytes, Kilobytes, Megabytes, Gigabytes, Terabytes, Bits, Kilobits, Megabits, Gigabits, Terabits, Percent, Count, Bytes/Second, Kilobytes/Second, Megabytes/Second, Gigabytes/Second, Terabytes/Second, Bits/Second, Kilobits/Second, Megabits/Second, Gigabits/Second, Terabits/Second, Count/Second, or None.



1205
1206
1207
# File 'cloud_watch/cfn_alarm.rb', line 1205

def unit
  @unit
end

Class Method Details

.jsii_propertiesObject



1207
1208
1209
1210
1211
1212
1213
1214
# File 'cloud_watch/cfn_alarm.rb', line 1207

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

Instance Method Details

#to_jsiiObject



1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
# File 'cloud_watch/cfn_alarm.rb', line 1216

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