Class: AWSCDK::CloudWatch::GaugeWidgetProps

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

Overview

Properties for a GaugeWidget.

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, annotations: nil, _end: nil, left_y_axis: nil, legend_position: nil, live_data: nil, metrics: nil, period: nil, set_period_to_time_range: nil, start: nil, statistic: nil) ⇒ GaugeWidgetProps

Returns a new instance of GaugeWidgetProps.

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.

  • annotations (Array<AWSCDK::CloudWatch::HorizontalAnnotation>, nil) (defaults to: nil)

    Annotations for the left Y axis.

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

    The end of the time range to use for each widget independently from those of the dashboard.

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

    Left Y axis.

  • legend_position (AWSCDK::CloudWatch::LegendPosition, nil) (defaults to: nil)

    Position of the legend.

  • live_data (Boolean, nil) (defaults to: nil)

    Whether the graph should show live data.

  • metrics (Array<AWSCDK::CloudWatch::IMetric>, nil) (defaults to: nil)

    Metrics to display on left Y axis.

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

    The default period for all metrics in this widget.

  • set_period_to_time_range (Boolean, nil) (defaults to: nil)

    Whether to show the value from the entire time range. Only applicable for Bar and Pie charts.

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

    The start of the time range to use for each widget independently from those of the dashboard.

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

    The default statistic to be displayed for each metric.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'cloud_watch/gauge_widget_props.rb', line 22

def initialize(account_id: nil, height: nil, region: nil, title: nil, width: nil, annotations: nil, _end: nil, left_y_axis: nil, legend_position: nil, live_data: nil, metrics: nil, period: nil, set_period_to_time_range: nil, start: nil, statistic: 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?
  @annotations = annotations.is_a?(Array) ? annotations.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::CloudWatch::HorizontalAnnotation.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : annotations
  Jsii::Type.check_type(@annotations, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jbG91ZHdhdGNoLkhvcml6b250YWxBbm5vdGF0aW9uIn0sImtpbmQiOiJhcnJheSJ9fQ==")), "annotations") unless @annotations.nil?
  @_end = _end
  Jsii::Type.check_type(@_end, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "end") unless @_end.nil?
  @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?
  @legend_position = legend_position
  Jsii::Type.check_type(@legend_position, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5MZWdlbmRQb3NpdGlvbiJ9")), "legendPosition") unless @legend_position.nil?
  @live_data = live_data
  Jsii::Type.check_type(@live_data, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "liveData") unless @live_data.nil?
  @metrics = metrics
  Jsii::Type.check_type(@metrics, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jbG91ZHdhdGNoLklNZXRyaWMifSwia2luZCI6ImFycmF5In19")), "metrics") unless @metrics.nil?
  @period = period
  Jsii::Type.check_type(@period, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "period") unless @period.nil?
  @set_period_to_time_range = set_period_to_time_range
  Jsii::Type.check_type(@set_period_to_time_range, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "setPeriodToTimeRange") unless @set_period_to_time_range.nil?
  @start = start
  Jsii::Type.check_type(@start, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "start") unless @start.nil?
  @statistic = statistic
  Jsii::Type.check_type(@statistic, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "statistic") unless @statistic.nil?
end

Instance Attribute Details

#_endString? (readonly)

Note:

Default: When the dashboard loads, the end date will be the current time.

The end of the time range to use for each widget independently from those of the dashboard.

If you specify a value for end, you must also specify a value for start. Specify an absolute time in the ISO 8601 format. For example, 2018-12-17T06:00:00.000Z.

Returns:

  • (String, nil)


99
100
101
# File 'cloud_watch/gauge_widget_props.rb', line 99

def _end
  @_end
end

#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)


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

def 
  @account_id
end

#annotationsArray<AWSCDK::CloudWatch::HorizontalAnnotation>? (readonly)

Note:

Default: - No annotations

Annotations for the left Y axis.



91
92
93
# File 'cloud_watch/gauge_widget_props.rb', line 91

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


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

def height
  @height
end

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

Note:

Default: min:0,max:100

Left Y axis.



104
105
106
# File 'cloud_watch/gauge_widget_props.rb', line 104

def left_y_axis
  @left_y_axis
end

#legend_positionAWSCDK::CloudWatch::LegendPosition? (readonly)

Note:

Default: - bottom

Position of the legend.



109
110
111
# File 'cloud_watch/gauge_widget_props.rb', line 109

def legend_position
  @legend_position
end

#live_dataBoolean? (readonly)

Note:

Default: false

Whether the graph should show live data.

Returns:

  • (Boolean, nil)


114
115
116
# File 'cloud_watch/gauge_widget_props.rb', line 114

def live_data
  @live_data
end

#metricsArray<AWSCDK::CloudWatch::IMetric>? (readonly)

Note:

Default: - No metrics

Metrics to display on left Y axis.

Returns:



119
120
121
# File 'cloud_watch/gauge_widget_props.rb', line 119

def metrics
  @metrics
end

#periodAWSCDK::Duration? (readonly)

Note:

Default: cdk.Duration.seconds(300)

The default period for all metrics in this widget.

The period is the length of time represented by one data point on the graph. This default can be overridden within each metric definition.

Returns:



127
128
129
# File 'cloud_watch/gauge_widget_props.rb', line 127

def period
  @period
end

#regionString? (readonly)

Note:

Default: - Current region

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

Returns:

  • (String, nil)


76
77
78
# File 'cloud_watch/gauge_widget_props.rb', line 76

def region
  @region
end

#set_period_to_time_rangeBoolean? (readonly)

Note:

Default: false

Whether to show the value from the entire time range. Only applicable for Bar and Pie charts.

If false, values will be from the most recent period of your chosen time range; if true, shows the value from the entire time range.

Returns:

  • (Boolean, nil)


135
136
137
# File 'cloud_watch/gauge_widget_props.rb', line 135

def set_period_to_time_range
  @set_period_to_time_range
end

#startString? (readonly)

Note:

Default: When the dashboard loads, the start time will be the default time range.

The start of the time range to use for each widget independently from those of the dashboard.

You can specify start without specifying end to specify a relative time range that ends with the current time. In this case, the value of start must begin with -P, and you can use M, H, D, W and M as abbreviations for minutes, hours, days, weeks and months. For example, -PT8H shows the last 8 hours and -P3M shows the last three months. You can also use start along with an end field, to specify an absolute time range. When specifying an absolute time range, use the ISO 8601 format. For example, 2018-12-17T06:00:00.000Z.

Returns:

  • (String, nil)


146
147
148
# File 'cloud_watch/gauge_widget_props.rb', line 146

def start
  @start
end

#statisticString? (readonly)

Note:

Default: - The statistic for each metric is used

The default statistic to be displayed for each metric.

This default can be overridden within the definition of each individual metric

Returns:

  • (String, nil)


153
154
155
# File 'cloud_watch/gauge_widget_props.rb', line 153

def statistic
  @statistic
end

#titleString? (readonly)

Note:

Default: - None

Title for the graph.

Returns:

  • (String, nil)


81
82
83
# File 'cloud_watch/gauge_widget_props.rb', line 81

def title
  @title
end

#widthNumeric? (readonly)

Note:

Default: 6

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

Returns:

  • (Numeric, nil)


86
87
88
# File 'cloud_watch/gauge_widget_props.rb', line 86

def width
  @width
end

Class Method Details

.jsii_propertiesObject



155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'cloud_watch/gauge_widget_props.rb', line 155

def self.jsii_properties
  {
    :account_id => "accountId",
    :height => "height",
    :region => "region",
    :title => "title",
    :width => "width",
    :annotations => "annotations",
    :_end => "end",
    :left_y_axis => "leftYAxis",
    :legend_position => "legendPosition",
    :live_data => "liveData",
    :metrics => "metrics",
    :period => "period",
    :set_period_to_time_range => "setPeriodToTimeRange",
    :start => "start",
    :statistic => "statistic",
  }
end

Instance Method Details

#to_jsiiObject



175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# File 'cloud_watch/gauge_widget_props.rb', line 175

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "accountId" => @account_id,
    "height" => @height,
    "region" => @region,
    "title" => @title,
    "width" => @width,
    "annotations" => @annotations,
    "end" => @_end,
    "leftYAxis" => @left_y_axis,
    "legendPosition" => @legend_position,
    "liveData" => @live_data,
    "metrics" => @metrics,
    "period" => @period,
    "setPeriodToTimeRange" => @set_period_to_time_range,
    "start" => @start,
    "statistic" => @statistic,
  })
  result.compact
end