Class: AWSCDK::CloudWatch::CfnAnomalyDetector::MetricStatProperty

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

Overview

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

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::CfnAnomalyDetector::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)

    When you are using a Put operation, this defines what unit you want to use when storing the metric.



956
957
958
959
960
961
962
963
964
965
# File 'cloud_watch/cfn_anomaly_detector.rb', line 956

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

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



971
972
973
# File 'cloud_watch/cfn_anomaly_detector.rb', line 971

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


984
985
986
# File 'cloud_watch/cfn_anomaly_detector.rb', line 984

def period
  @period
end

#statString (readonly)

The statistic to return.

It can include any CloudWatch statistic or extended statistic.



991
992
993
# File 'cloud_watch/cfn_anomaly_detector.rb', line 991

def stat
  @stat
end

#unitString? (readonly)

When you are using a Put operation, this defines what unit you want to use when storing the metric.

In a Get operation, if you omit Unit then all data that was collected with any unit is returned, along with the corresponding units that were specified when the data was reported to CloudWatch. If you specify a unit, the operation returns only data that was collected with that unit specified. If you specify a unit that does not match the data collected, the results of the operation are null. CloudWatch does not perform unit conversions.



998
999
1000
# File 'cloud_watch/cfn_anomaly_detector.rb', line 998

def unit
  @unit
end

Class Method Details

.jsii_propertiesObject



1000
1001
1002
1003
1004
1005
1006
1007
# File 'cloud_watch/cfn_anomaly_detector.rb', line 1000

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

Instance Method Details

#to_jsiiObject



1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
# File 'cloud_watch/cfn_anomaly_detector.rb', line 1009

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