Class: AWSCDK::CloudWatch::MetricConfig

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

Overview

Properties of a rendered metric.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(math_expression: nil, metric_stat: nil, rendering_properties: nil, search_expression: nil) ⇒ MetricConfig

Returns a new instance of MetricConfig.

Parameters:

  • math_expression (AWSCDK::CloudWatch::MetricExpressionConfig, nil) (defaults to: nil)

    In case the metric is a math expression, the details of the math expression.

  • metric_stat (AWSCDK::CloudWatch::MetricStatConfig, nil) (defaults to: nil)

    In case the metric represents a query, the details of the query.

  • rendering_properties (Hash{String => Object}, nil) (defaults to: nil)

    Additional properties which will be rendered if the metric is used in a dashboard.

  • search_expression (AWSCDK::CloudWatch::MetricExpressionConfig, nil) (defaults to: nil)

    In case the metric is a search expression, the details of the search expression.



11
12
13
14
15
16
17
18
19
20
# File 'cloud_watch/metric_config.rb', line 11

def initialize(math_expression: nil, metric_stat: nil, rendering_properties: nil, search_expression: nil)
  @math_expression = math_expression.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricExpressionConfig.new(**math_expression.transform_keys(&:to_sym)) : math_expression
  Jsii::Type.check_type(@math_expression, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNFeHByZXNzaW9uQ29uZmlnIn0=")), "mathExpression") unless @math_expression.nil?
  @metric_stat = metric_stat.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricStatConfig.new(**metric_stat.transform_keys(&:to_sym)) : metric_stat
  Jsii::Type.check_type(@metric_stat, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNTdGF0Q29uZmlnIn0=")), "metricStat") unless @metric_stat.nil?
  @rendering_properties = rendering_properties
  Jsii::Type.check_type(@rendering_properties, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6ImFueSJ9LCJraW5kIjoibWFwIn19")), "renderingProperties") unless @rendering_properties.nil?
  @search_expression = search_expression.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricExpressionConfig.new(**search_expression.transform_keys(&:to_sym)) : search_expression
  Jsii::Type.check_type(@search_expression, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNFeHByZXNzaW9uQ29uZmlnIn0=")), "searchExpression") unless @search_expression.nil?
end

Instance Attribute Details

#math_expressionAWSCDK::CloudWatch::MetricExpressionConfig? (readonly)

Note:

Default: - None

In case the metric is a math expression, the details of the math expression.



26
27
28
# File 'cloud_watch/metric_config.rb', line 26

def math_expression
  @math_expression
end

#metric_statAWSCDK::CloudWatch::MetricStatConfig? (readonly)

Note:

Default: - None

In case the metric represents a query, the details of the query.



31
32
33
# File 'cloud_watch/metric_config.rb', line 31

def metric_stat
  @metric_stat
end

#rendering_propertiesHash{String => Object}? (readonly)

Note:

Default: - None

Additional properties which will be rendered if the metric is used in a dashboard.

Examples are 'label' and 'color', but any key in here will be added to dashboard graphs.

Returns:

  • (Hash{String => Object}, nil)


39
40
41
# File 'cloud_watch/metric_config.rb', line 39

def rendering_properties
  @rendering_properties
end

#search_expressionAWSCDK::CloudWatch::MetricExpressionConfig? (readonly)

Note:

Default: - None

In case the metric is a search expression, the details of the search expression.



44
45
46
# File 'cloud_watch/metric_config.rb', line 44

def search_expression
  @search_expression
end

Class Method Details

.jsii_propertiesObject



46
47
48
49
50
51
52
53
# File 'cloud_watch/metric_config.rb', line 46

def self.jsii_properties
  {
    :math_expression => "mathExpression",
    :metric_stat => "metricStat",
    :rendering_properties => "renderingProperties",
    :search_expression => "searchExpression",
  }
end

Instance Method Details

#to_jsiiObject



55
56
57
58
59
60
61
62
63
64
# File 'cloud_watch/metric_config.rb', line 55

def to_jsii
  result = {}
  result.merge!({
    "mathExpression" => @math_expression,
    "metricStat" => @metric_stat,
    "renderingProperties" => @rendering_properties,
    "searchExpression" => @search_expression,
  })
  result.compact
end