Class: AWSCDK::CloudWatch::MetricExpressionConfig

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

Overview

Properties for a concrete metric.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(expression:, period:, using_metrics:, search_account: nil, search_region: nil) ⇒ MetricExpressionConfig

Returns a new instance of MetricExpressionConfig.

Parameters:

  • expression (String)

    Math expression for the metric.

  • period (Numeric)

    How many seconds to aggregate over.

  • using_metrics (Hash{String => AWSCDK::CloudWatch::IMetric})

    Metrics used in the math expression.

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

    Account to evaluate search expressions within.

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

    Region to evaluate search expressions within.



12
13
14
15
16
17
18
19
20
21
22
23
# File 'cloud_watch/metric_expression_config.rb', line 12

def initialize(expression:, period:, using_metrics:, search_account: nil, search_region: nil)
  @expression = expression
  Jsii::Type.check_type(@expression, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "expression")
  @period = period
  Jsii::Type.check_type(@period, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "period")
  @using_metrics = using_metrics
  Jsii::Type.check_type(@using_metrics, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jbG91ZHdhdGNoLklNZXRyaWMifSwia2luZCI6Im1hcCJ9fQ==")), "usingMetrics")
  @search_account = 
  Jsii::Type.check_type(@search_account, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "searchAccount") unless @search_account.nil?
  @search_region = search_region
  Jsii::Type.check_type(@search_region, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "searchRegion") unless @search_region.nil?
end

Instance Attribute Details

#expressionString (readonly)

Math expression for the metric.

Returns:

  • (String)


28
29
30
# File 'cloud_watch/metric_expression_config.rb', line 28

def expression
  @expression
end

#periodNumeric (readonly)

How many seconds to aggregate over.

Returns:

  • (Numeric)


32
33
34
# File 'cloud_watch/metric_expression_config.rb', line 32

def period
  @period
end

#search_accountString? (readonly)

Note:

Default: - Deployment account.

Account to evaluate search expressions within.

Returns:

  • (String, nil)


41
42
43
# File 'cloud_watch/metric_expression_config.rb', line 41

def 
  @search_account
end

#search_regionString? (readonly)

Note:

Default: - Deployment region.

Region to evaluate search expressions within.

Returns:

  • (String, nil)


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

def search_region
  @search_region
end

#using_metricsHash{String => AWSCDK::CloudWatch::IMetric} (readonly)

Metrics used in the math expression.

Returns:



36
37
38
# File 'cloud_watch/metric_expression_config.rb', line 36

def using_metrics
  @using_metrics
end

Class Method Details

.jsii_propertiesObject



48
49
50
51
52
53
54
55
56
# File 'cloud_watch/metric_expression_config.rb', line 48

def self.jsii_properties
  {
    :expression => "expression",
    :period => "period",
    :using_metrics => "usingMetrics",
    :search_account => "searchAccount",
    :search_region => "searchRegion",
  }
end

Instance Method Details

#to_jsiiObject



58
59
60
61
62
63
64
65
66
67
68
# File 'cloud_watch/metric_expression_config.rb', line 58

def to_jsii
  result = {}
  result.merge!({
    "expression" => @expression,
    "period" => @period,
    "usingMetrics" => @using_metrics,
    "searchAccount" => @search_account,
    "searchRegion" => @search_region,
  })
  result.compact
end