Class: AWSCDK::CloudWatch::GraphWidgetProps

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

Overview

Properties for a GraphWidget.

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, display_labels_on_chart: nil, _end: nil, left: nil, left_annotations: nil, left_y_axis: nil, legend_position: nil, live_data: nil, period: nil, right: nil, right_annotations: nil, right_y_axis: nil, set_period_to_time_range: nil, stacked: nil, start: nil, statistic: nil, vertical_annotations: nil, view: nil) ⇒ GraphWidgetProps

Returns a new instance of GraphWidgetProps.

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.

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

    Whether the graph should show labels on the chart.

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

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

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

    Metrics to display on left Y axis.

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

    Annotations for the left Y axis.

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

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

    The default period for all metrics in this widget.

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

    Metrics to display on right Y axis.

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

    Annotations for the right Y axis.

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

    Right Y axis.

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

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

    Whether the graph should be shown as stacked lines.

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

  • vertical_annotations (Array<AWSCDK::CloudWatch::VerticalAnnotation>, nil) (defaults to: nil)

    Annotations for the X axis.

  • view (AWSCDK::CloudWatch::GraphWidgetView, nil) (defaults to: nil)

    Display this metric.



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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'cloud_watch/graph_widget_props.rb', line 29

def initialize(account_id: nil, height: nil, region: nil, title: nil, width: nil, display_labels_on_chart: nil, _end: nil, left: nil, left_annotations: nil, left_y_axis: nil, legend_position: nil, live_data: nil, period: nil, right: nil, right_annotations: nil, right_y_axis: nil, set_period_to_time_range: nil, stacked: nil, start: nil, statistic: nil, vertical_annotations: nil, view: 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?
  @display_labels_on_chart = display_labels_on_chart
  Jsii::Type.check_type(@display_labels_on_chart, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "displayLabelsOnChart") unless @display_labels_on_chart.nil?
  @_end = _end
  Jsii::Type.check_type(@_end, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "end") unless @_end.nil?
  @left = left
  Jsii::Type.check_type(@left, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jbG91ZHdhdGNoLklNZXRyaWMifSwia2luZCI6ImFycmF5In19")), "left") unless @left.nil?
  @left_annotations = left_annotations.is_a?(Array) ? left_annotations.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::CloudWatch::HorizontalAnnotation.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : left_annotations
  Jsii::Type.check_type(@left_annotations, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jbG91ZHdhdGNoLkhvcml6b250YWxBbm5vdGF0aW9uIn0sImtpbmQiOiJhcnJheSJ9fQ==")), "leftAnnotations") unless @left_annotations.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?
  @period = period
  Jsii::Type.check_type(@period, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "period") unless @period.nil?
  @right = right
  Jsii::Type.check_type(@right, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jbG91ZHdhdGNoLklNZXRyaWMifSwia2luZCI6ImFycmF5In19")), "right") unless @right.nil?
  @right_annotations = right_annotations.is_a?(Array) ? right_annotations.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::CloudWatch::HorizontalAnnotation.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : right_annotations
  Jsii::Type.check_type(@right_annotations, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jbG91ZHdhdGNoLkhvcml6b250YWxBbm5vdGF0aW9uIn0sImtpbmQiOiJhcnJheSJ9fQ==")), "rightAnnotations") unless @right_annotations.nil?
  @right_y_axis = right_y_axis.is_a?(Hash) ? ::AWSCDK::CloudWatch::YAxisProps.new(**right_y_axis.transform_keys(&:to_sym)) : right_y_axis
  Jsii::Type.check_type(@right_y_axis, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5ZQXhpc1Byb3BzIn0=")), "rightYAxis") unless @right_y_axis.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?
  @stacked = stacked
  Jsii::Type.check_type(@stacked, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "stacked") unless @stacked.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?
  @vertical_annotations = vertical_annotations.is_a?(Array) ? vertical_annotations.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::CloudWatch::VerticalAnnotation.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : vertical_annotations
  Jsii::Type.check_type(@vertical_annotations, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jbG91ZHdhdGNoLlZlcnRpY2FsQW5ub3RhdGlvbiJ9LCJraW5kIjoiYXJyYXkifX0=")), "verticalAnnotations") unless @vertical_annotations.nil?
  @view = view
  Jsii::Type.check_type(@view, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5HcmFwaFdpZGdldFZpZXcifQ==")), "view") unless @view.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)


122
123
124
# File 'cloud_watch/graph_widget_props.rb', line 122

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)


87
88
89
# File 'cloud_watch/graph_widget_props.rb', line 87

def 
  @account_id
end

#display_labels_on_chartBoolean? (readonly)

Note:

Default: false

Whether the graph should show labels on the chart.

Currently only applicable for Pie charts.

Returns:

  • (Boolean, nil)


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

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


92
93
94
# File 'cloud_watch/graph_widget_props.rb', line 92

def height
  @height
end

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

Note:

Default: - No metrics

Metrics to display on left Y axis.

Returns:



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

def left
  @left
end

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

Note:

Default: - No annotations

Annotations for the left Y axis.



132
133
134
# File 'cloud_watch/graph_widget_props.rb', line 132

def left_annotations
  @left_annotations
end

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

Note:

Default: - None

Left Y axis.



137
138
139
# File 'cloud_watch/graph_widget_props.rb', line 137

def left_y_axis
  @left_y_axis
end

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

Note:

Default: - bottom

Position of the legend.



142
143
144
# File 'cloud_watch/graph_widget_props.rb', line 142

def legend_position
  @legend_position
end

#live_dataBoolean? (readonly)

Note:

Default: false

Whether the graph should show live data.

Returns:

  • (Boolean, nil)


147
148
149
# File 'cloud_watch/graph_widget_props.rb', line 147

def live_data
  @live_data
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:



155
156
157
# File 'cloud_watch/graph_widget_props.rb', line 155

def period
  @period
end

#regionString? (readonly)

Note:

Default: - Current region

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

Returns:

  • (String, nil)


97
98
99
# File 'cloud_watch/graph_widget_props.rb', line 97

def region
  @region
end

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

Note:

Default: - No metrics

Metrics to display on right Y axis.

Returns:



160
161
162
# File 'cloud_watch/graph_widget_props.rb', line 160

def right
  @right
end

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

Note:

Default: - No annotations

Annotations for the right Y axis.



165
166
167
# File 'cloud_watch/graph_widget_props.rb', line 165

def right_annotations
  @right_annotations
end

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

Note:

Default: - None

Right Y axis.



170
171
172
# File 'cloud_watch/graph_widget_props.rb', line 170

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


178
179
180
# File 'cloud_watch/graph_widget_props.rb', line 178

def set_period_to_time_range
  @set_period_to_time_range
end

#stackedBoolean? (readonly)

Note:

Default: false

Whether the graph should be shown as stacked lines.

Returns:

  • (Boolean, nil)


183
184
185
# File 'cloud_watch/graph_widget_props.rb', line 183

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


194
195
196
# File 'cloud_watch/graph_widget_props.rb', line 194

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)


201
202
203
# File 'cloud_watch/graph_widget_props.rb', line 201

def statistic
  @statistic
end

#titleString? (readonly)

Note:

Default: - None

Title for the graph.

Returns:

  • (String, nil)


102
103
104
# File 'cloud_watch/graph_widget_props.rb', line 102

def title
  @title
end

#vertical_annotationsArray<AWSCDK::CloudWatch::VerticalAnnotation>? (readonly)

Note:

Default: - No annotations

Annotations for the X axis.



206
207
208
# File 'cloud_watch/graph_widget_props.rb', line 206

def vertical_annotations
  @vertical_annotations
end

#viewAWSCDK::CloudWatch::GraphWidgetView? (readonly)

Note:

Default: TimeSeries

Display this metric.



211
212
213
# File 'cloud_watch/graph_widget_props.rb', line 211

def view
  @view
end

#widthNumeric? (readonly)

Note:

Default: 6

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

Returns:

  • (Numeric, nil)


107
108
109
# File 'cloud_watch/graph_widget_props.rb', line 107

def width
  @width
end

Class Method Details

.jsii_propertiesObject



213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
# File 'cloud_watch/graph_widget_props.rb', line 213

def self.jsii_properties
  {
    :account_id => "accountId",
    :height => "height",
    :region => "region",
    :title => "title",
    :width => "width",
    :display_labels_on_chart => "displayLabelsOnChart",
    :_end => "end",
    :left => "left",
    :left_annotations => "leftAnnotations",
    :left_y_axis => "leftYAxis",
    :legend_position => "legendPosition",
    :live_data => "liveData",
    :period => "period",
    :right => "right",
    :right_annotations => "rightAnnotations",
    :right_y_axis => "rightYAxis",
    :set_period_to_time_range => "setPeriodToTimeRange",
    :stacked => "stacked",
    :start => "start",
    :statistic => "statistic",
    :vertical_annotations => "verticalAnnotations",
    :view => "view",
  }
end

Instance Method Details

#to_jsiiObject



240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
# File 'cloud_watch/graph_widget_props.rb', line 240

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "accountId" => @account_id,
    "height" => @height,
    "region" => @region,
    "title" => @title,
    "width" => @width,
    "displayLabelsOnChart" => @display_labels_on_chart,
    "end" => @_end,
    "left" => @left,
    "leftAnnotations" => @left_annotations,
    "leftYAxis" => @left_y_axis,
    "legendPosition" => @legend_position,
    "liveData" => @live_data,
    "period" => @period,
    "right" => @right,
    "rightAnnotations" => @right_annotations,
    "rightYAxis" => @right_y_axis,
    "setPeriodToTimeRange" => @set_period_to_time_range,
    "stacked" => @stacked,
    "start" => @start,
    "statistic" => @statistic,
    "verticalAnnotations" => @vertical_annotations,
    "view" => @view,
  })
  result.compact
end