Class: AWSCDK::CloudWatch::MetricWidgetProps

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

Overview

Basic properties for widgets that display metrics.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(account_id: nil, height: nil, region: nil, title: nil, width: nil) ⇒ MetricWidgetProps

Returns a new instance of MetricWidgetProps.

Parameters:

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

    The AWS account ID where the metrics are located.

  • height (Numeric, nil) (defaults to: nil)

    Height of the widget.

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

    The region the metrics of this graph should be taken from.

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

    Title for the graph.

  • width (Numeric, nil) (defaults to: nil)

    Width of the widget, in a grid of 24 units wide.



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

def initialize(account_id: nil, height: nil, region: nil, title: nil, width: nil)
  @account_id = 
  Jsii::Type.check_type(@account_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "accountId") unless @account_id.nil?
  @height = height
  Jsii::Type.check_type(@height, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "height") unless @height.nil?
  @region = region
  Jsii::Type.check_type(@region, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "region") unless @region.nil?
  @title = title
  Jsii::Type.check_type(@title, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "title") unless @title.nil?
  @width = width
  Jsii::Type.check_type(@width, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "width") unless @width.nil?
end

Instance Attribute Details

#account_idString? (readonly)

Note:

Default: - Current account

The AWS account ID where the metrics are located.

This enables cross-account functionality for CloudWatch dashboards. Before using this feature, ensure that proper cross-account sharing is configured between the monitoring account and source account.

For more information, see: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Unified-Cross-Account.html

Returns:

  • (String, nil)


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

def 
  @account_id
end

#heightNumeric? (readonly)

Note:

Default: - 6 for Alarm and Graph widgets. 3 for single value widgets where most recent value of a metric is displayed.

Height of the widget.

Returns:

  • (Numeric, nil)


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

def height
  @height
end

#regionString? (readonly)

Note:

Default: - Current region

The region the metrics of this graph should be taken from.

Returns:

  • (String, nil)


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

def region
  @region
end

#titleString? (readonly)

Note:

Default: - None

Title for the graph.

Returns:

  • (String, nil)


51
52
53
# File 'cloud_watch/metric_widget_props.rb', line 51

def title
  @title
end

#widthNumeric? (readonly)

Note:

Default: 6

Width of the widget, in a grid of 24 units wide.

Returns:

  • (Numeric, nil)


56
57
58
# File 'cloud_watch/metric_widget_props.rb', line 56

def width
  @width
end

Class Method Details

.jsii_propertiesObject



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

def self.jsii_properties
  {
    :account_id => "accountId",
    :height => "height",
    :region => "region",
    :title => "title",
    :width => "width",
  }
end

Instance Method Details

#to_jsiiObject



68
69
70
71
72
73
74
75
76
77
78
# File 'cloud_watch/metric_widget_props.rb', line 68

def to_jsii
  result = {}
  result.merge!({
    "accountId" => @account_id,
    "height" => @height,
    "region" => @region,
    "title" => @title,
    "width" => @width,
  })
  result.compact
end