Class: AWSCDK::CloudWatch::AlarmWidgetProps

Inherits:
MetricWidgetProps
  • Object
show all
Defined in:
cloud_watch/alarm_widget_props.rb

Overview

Properties for an AlarmWidget.

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, alarm:, left_y_axis: nil) ⇒ AlarmWidgetProps

Returns a new instance of AlarmWidgetProps.

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.

  • alarm (AWSCDK::Interfaces::AWSCloudwatch::IAlarmRef)

    The alarm to show.

  • left_y_axis (AWSCDK::CloudWatch::YAxisProps, nil) (defaults to: nil)

    Left Y axis.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'cloud_watch/alarm_widget_props.rb', line 14

def initialize(account_id: nil, height: nil, region: nil, title: nil, width: nil, alarm:, left_y_axis: 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?
  @alarm = alarm
  Jsii::Type.check_type(@alarm, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19jbG91ZHdhdGNoLklBbGFybVJlZiJ9")), "alarm")
  @left_y_axis = left_y_axis.is_a?(Hash) ? ::AWSCDK::CloudWatch::YAxisProps.new(**left_y_axis.transform_keys(&:to_sym)) : left_y_axis
  Jsii::Type.check_type(@left_y_axis, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5ZQXhpc1Byb3BzIn0=")), "leftYAxis") unless @left_y_axis.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)


42
43
44
# File 'cloud_watch/alarm_widget_props.rb', line 42

def 
  @account_id
end

#alarmAWSCDK::Interfaces::AWSCloudwatch::IAlarmRef (readonly)

The alarm to show.



66
67
68
# File 'cloud_watch/alarm_widget_props.rb', line 66

def alarm
  @alarm
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)


47
48
49
# File 'cloud_watch/alarm_widget_props.rb', line 47

def height
  @height
end

#left_y_axisAWSCDK::CloudWatch::YAxisProps? (readonly)

Note:

Default: - No minimum or maximum values for the left Y-axis

Left Y axis.



71
72
73
# File 'cloud_watch/alarm_widget_props.rb', line 71

def left_y_axis
  @left_y_axis
end

#regionString? (readonly)

Note:

Default: - Current region

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

Returns:

  • (String, nil)


52
53
54
# File 'cloud_watch/alarm_widget_props.rb', line 52

def region
  @region
end

#titleString? (readonly)

Note:

Default: - None

Title for the graph.

Returns:

  • (String, nil)


57
58
59
# File 'cloud_watch/alarm_widget_props.rb', line 57

def title
  @title
end

#widthNumeric? (readonly)

Note:

Default: 6

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

Returns:

  • (Numeric, nil)


62
63
64
# File 'cloud_watch/alarm_widget_props.rb', line 62

def width
  @width
end

Class Method Details

.jsii_propertiesObject



73
74
75
76
77
78
79
80
81
82
83
# File 'cloud_watch/alarm_widget_props.rb', line 73

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

Instance Method Details

#to_jsiiObject



85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'cloud_watch/alarm_widget_props.rb', line 85

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