Class: AWSCDK::CloudWatch::MetricStatConfig

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

Overview

Properties for a concrete metric.

NOTE: unit is no longer on this object since it is only used for Alarms, and doesn't mean what one would expect it to mean there anyway. It is most likely to be misused.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(metric_name:, namespace:, period:, statistic:, account: nil, account_override: nil, dimensions: nil, region: nil, region_override: nil, unit_filter: nil) ⇒ MetricStatConfig

Returns a new instance of MetricStatConfig.

Parameters:

  • metric_name (String)

    Name of the metric.

  • namespace (String)

    Namespace of the metric.

  • period (AWSCDK::Duration)

    How many seconds to aggregate over.

  • statistic (String)

    Aggregation function to use (can be either simple or a percentile).

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

    Account which this metric comes from.

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

    Account set directly on the metric, not inherited from the attached stack.

  • dimensions (Array<AWSCDK::CloudWatch::Dimension>, nil) (defaults to: nil)

    The dimensions to apply to the alarm.

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

    Region which this metric comes from.

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

    Region set directly on the metric, not inherited from the attached stack.

  • unit_filter (AWSCDK::CloudWatch::Unit, nil) (defaults to: nil)

    Unit used to filter the metric stream.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'cloud_watch/metric_stat_config.rb', line 20

def initialize(metric_name:, namespace:, period:, statistic:, account: nil, account_override: nil, dimensions: nil, region: nil, region_override: nil, unit_filter: nil)
  @metric_name = metric_name
  Jsii::Type.check_type(@metric_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "metricName")
  @namespace = namespace
  Jsii::Type.check_type(@namespace, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "namespace")
  @period = period
  Jsii::Type.check_type(@period, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "period")
  @statistic = statistic
  Jsii::Type.check_type(@statistic, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "statistic")
  @account = 
  Jsii::Type.check_type(@account, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "account") unless @account.nil?
  @account_override = 
  Jsii::Type.check_type(@account_override, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "accountOverride") unless @account_override.nil?
  @dimensions = dimensions.is_a?(Array) ? dimensions.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::CloudWatch::Dimension.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : dimensions
  Jsii::Type.check_type(@dimensions, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jbG91ZHdhdGNoLkRpbWVuc2lvbiJ9LCJraW5kIjoiYXJyYXkifX0=")), "dimensions") unless @dimensions.nil?
  @region = region
  Jsii::Type.check_type(@region, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "region") unless @region.nil?
  @region_override = region_override
  Jsii::Type.check_type(@region_override, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "regionOverride") unless @region_override.nil?
  @unit_filter = unit_filter
  Jsii::Type.check_type(@unit_filter, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5Vbml0In0=")), "unitFilter") unless @unit_filter.nil?
end

Instance Attribute Details

#accountString? (readonly)

Note:

Default: Deployment account.

Account which this metric comes from.

Returns:

  • (String, nil)


63
64
65
# File 'cloud_watch/metric_stat_config.rb', line 63

def 
  @account
end

#account_overrideString? (readonly)

Note:

Default: No override.

Account set directly on the metric, not inherited from the attached stack.

Returns:

  • (String, nil)


68
69
70
# File 'cloud_watch/metric_stat_config.rb', line 68

def 
  @account_override
end

#dimensionsArray<AWSCDK::CloudWatch::Dimension>? (readonly)

Note:

Default: []

The dimensions to apply to the alarm.

Returns:



73
74
75
# File 'cloud_watch/metric_stat_config.rb', line 73

def dimensions
  @dimensions
end

#metric_nameString (readonly)

Name of the metric.

Returns:

  • (String)


46
47
48
# File 'cloud_watch/metric_stat_config.rb', line 46

def metric_name
  @metric_name
end

#namespaceString (readonly)

Namespace of the metric.

Returns:

  • (String)


50
51
52
# File 'cloud_watch/metric_stat_config.rb', line 50

def namespace
  @namespace
end

#periodAWSCDK::Duration (readonly)

How many seconds to aggregate over.

Returns:



54
55
56
# File 'cloud_watch/metric_stat_config.rb', line 54

def period
  @period
end

#regionString? (readonly)

Note:

Default: Deployment region.

Region which this metric comes from.

Returns:

  • (String, nil)


78
79
80
# File 'cloud_watch/metric_stat_config.rb', line 78

def region
  @region
end

#region_overrideString? (readonly)

Note:

Default: No override.

Region set directly on the metric, not inherited from the attached stack.

Returns:

  • (String, nil)


83
84
85
# File 'cloud_watch/metric_stat_config.rb', line 83

def region_override
  @region_override
end

#statisticString (readonly)

Aggregation function to use (can be either simple or a percentile).

Returns:

  • (String)


58
59
60
# File 'cloud_watch/metric_stat_config.rb', line 58

def statistic
  @statistic
end

#unit_filterAWSCDK::CloudWatch::Unit? (readonly)

Note:

Default: - Refer to all metric datums

Unit used to filter the metric stream.

Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units.

This field has been renamed from plain unit to clearly communicate its purpose.

Returns:



95
96
97
# File 'cloud_watch/metric_stat_config.rb', line 95

def unit_filter
  @unit_filter
end

Class Method Details

.jsii_propertiesObject



97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'cloud_watch/metric_stat_config.rb', line 97

def self.jsii_properties
  {
    :metric_name => "metricName",
    :namespace => "namespace",
    :period => "period",
    :statistic => "statistic",
    :account => "account",
    :account_override => "accountOverride",
    :dimensions => "dimensions",
    :region => "region",
    :region_override => "regionOverride",
    :unit_filter => "unitFilter",
  }
end

Instance Method Details

#to_jsiiObject



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'cloud_watch/metric_stat_config.rb', line 112

def to_jsii
  result = {}
  result.merge!({
    "metricName" => @metric_name,
    "namespace" => @namespace,
    "period" => @period,
    "statistic" => @statistic,
    "account" => @account,
    "accountOverride" => @account_override,
    "dimensions" => @dimensions,
    "region" => @region,
    "regionOverride" => @region_override,
    "unitFilter" => @unit_filter,
  })
  result.compact
end