Class: AWSCDK::CloudWatch::SearchExpressionProps

Inherits:
SearchExpressionOptions
  • Object
show all
Defined in:
cloud_watch/search_expression_props.rb

Overview

Properties for a SearchExpression.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(color: nil, label: nil, period: nil, search_account: nil, search_region: nil, expression:) ⇒ SearchExpressionProps

Returns a new instance of SearchExpressionProps.

Parameters:

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

    Color for the metric produced by the search expression.

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

    Label for this search expression when added to a Graph in a Dashboard.

  • period (AWSCDK::Duration, nil) (defaults to: nil)

    The period over which the search expression's statistics are applied.

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

  • expression (String)

    The search expression defining the metrics to be retrieved.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'cloud_watch/search_expression_props.rb', line 13

def initialize(color: nil, label: nil, period: nil, search_account: nil, search_region: nil, expression:)
  @color = color
  Jsii::Type.check_type(@color, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "color") unless @color.nil?
  @label = label
  Jsii::Type.check_type(@label, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "label") unless @label.nil?
  @period = period
  Jsii::Type.check_type(@period, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "period") unless @period.nil?
  @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?
  @expression = expression
  Jsii::Type.check_type(@expression, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "expression")
end

Instance Attribute Details

#colorString? (readonly)

Note:

Default: - Automatically assigned.

Color for the metric produced by the search expression.

If the search expression produces more than one time series, the color is assigned to the first one. Other metrics are assigned colors automatically.

Returns:

  • (String, nil)


35
36
37
# File 'cloud_watch/search_expression_props.rb', line 35

def color
  @color
end

#expressionString (readonly)

The search expression defining the metrics to be retrieved.

A search expression cannot be used within an Alarm.

A search expression allows you to retrieve and graph multiple related metrics in a single statement. It can return up to 500 time series.

Examples:

  • SEARCH('{AWS/EC2,InstanceId} CPUUtilization', 'Average', 300)
  • SEARCH('{AWS/ApplicationELB,LoadBalancer} RequestCount', 'Sum', 60)
  • SEARCH('{MyNamespace,ServiceName} Errors', 'Sum')

For more information about search expression syntax, see: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/search-expression-syntax.html

Returns:

  • (String)


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

def expression
  @expression
end

#labelString? (readonly)

Note:

Default: - No label.

Label for this search expression when added to a Graph in a Dashboard.

If this expression evaluates to more than one time series, each time series will appear in the graph using a combination of the expression label and the individual metric label. Specify the empty string ('') to suppress the expression label and only keep the metric label.

You can use dynamic labels to show summary information about the displayed time series in the legend. For example, if you use:

[max: ${MAX}] MyMetric

As the metric label, the maximum value in the visible range will be shown next to the time series name in the graph's legend. If the search expression produces more than one time series, the maximum will be shown for each individual time series produce by this search expression.

Returns:

  • (String, nil)


60
61
62
# File 'cloud_watch/search_expression_props.rb', line 60

def label
  @label
end

#periodAWSCDK::Duration? (readonly)

Note:

Default: Duration.minutes(5)

The period over which the search expression's statistics are applied.

This period overrides the period defined within the search expression.

Returns:



67
68
69
# File 'cloud_watch/search_expression_props.rb', line 67

def period
  @period
end

#search_accountString? (readonly)

Note:

Default: - Deployment account.

Account to evaluate search expressions within.

Returns:

  • (String, nil)


72
73
74
# File 'cloud_watch/search_expression_props.rb', line 72

def 
  @search_account
end

#search_regionString? (readonly)

Note:

Default: - Deployment region.

Region to evaluate search expressions within.

Returns:

  • (String, nil)


77
78
79
# File 'cloud_watch/search_expression_props.rb', line 77

def search_region
  @search_region
end

Class Method Details

.jsii_propertiesObject



97
98
99
100
101
102
103
104
105
106
# File 'cloud_watch/search_expression_props.rb', line 97

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

Instance Method Details

#to_jsiiObject



108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'cloud_watch/search_expression_props.rb', line 108

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