Class: AWSCDK::CloudWatch::SingleValueWidgetProps

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

Overview

Properties for a SingleValueWidget.

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, metrics:, _end: nil, full_precision: nil, period: nil, set_period_to_time_range: nil, sparkline: nil, start: nil) ⇒ SingleValueWidgetProps

Returns a new instance of SingleValueWidgetProps.

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.

  • metrics (Array<AWSCDK::CloudWatch::IMetric>)

    Metrics to display.

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

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

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

    Whether to show as many digits as can fit, before rounding.

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

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

    Whether to show a graph below the value illustrating the value for the whole time range.

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

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



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'cloud_watch/single_value_widget_props.rb', line 19

def initialize(account_id: nil, height: nil, region: nil, title: nil, width: nil, metrics:, _end: nil, full_precision: nil, period: nil, set_period_to_time_range: nil, sparkline: nil, start: 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?
  @metrics = metrics
  Jsii::Type.check_type(@metrics, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jbG91ZHdhdGNoLklNZXRyaWMifSwia2luZCI6ImFycmF5In19")), "metrics")
  @_end = _end
  Jsii::Type.check_type(@_end, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "end") unless @_end.nil?
  @full_precision = full_precision
  Jsii::Type.check_type(@full_precision, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "fullPrecision") unless @full_precision.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?
  @sparkline = sparkline
  Jsii::Type.check_type(@sparkline, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "sparkline") unless @sparkline.nil?
  @start = start
  Jsii::Type.check_type(@start, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "start") unless @start.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)


89
90
91
# File 'cloud_watch/single_value_widget_props.rb', line 89

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)


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

def 
  @account_id
end

#full_precisionBoolean? (readonly)

Note:

Default: false

Whether to show as many digits as can fit, before rounding.

Returns:

  • (Boolean, nil)


94
95
96
# File 'cloud_watch/single_value_widget_props.rb', line 94

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


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

def height
  @height
end

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

Metrics to display.

Returns:



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

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:



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

def period
  @period
end

#regionString? (readonly)

Note:

Default: - Current region

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

Returns:

  • (String, nil)


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

def region
  @region
end

#set_period_to_time_rangeBoolean? (readonly)

Note:

Default: false

Whether to show the value from the entire time range.

Returns:

  • (Boolean, nil)


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

def set_period_to_time_range
  @set_period_to_time_range
end

#sparklineBoolean? (readonly)

Note:

Default: false

Whether to show a graph below the value illustrating the value for the whole time range.

Cannot be used in combination with set_period_to_time_range

Returns:

  • (Boolean, nil)


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

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


125
126
127
# File 'cloud_watch/single_value_widget_props.rb', line 125

def start
  @start
end

#titleString? (readonly)

Note:

Default: - None

Title for the graph.

Returns:

  • (String, nil)


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

def title
  @title
end

#widthNumeric? (readonly)

Note:

Default: 6

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

Returns:

  • (Numeric, nil)


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

def width
  @width
end

Class Method Details

.jsii_propertiesObject



127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'cloud_watch/single_value_widget_props.rb', line 127

def self.jsii_properties
  {
    :account_id => "accountId",
    :height => "height",
    :region => "region",
    :title => "title",
    :width => "width",
    :metrics => "metrics",
    :_end => "end",
    :full_precision => "fullPrecision",
    :period => "period",
    :set_period_to_time_range => "setPeriodToTimeRange",
    :sparkline => "sparkline",
    :start => "start",
  }
end

Instance Method Details

#to_jsiiObject



144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'cloud_watch/single_value_widget_props.rb', line 144

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "accountId" => @account_id,
    "height" => @height,
    "region" => @region,
    "title" => @title,
    "width" => @width,
    "metrics" => @metrics,
    "end" => @_end,
    "fullPrecision" => @full_precision,
    "period" => @period,
    "setPeriodToTimeRange" => @set_period_to_time_range,
    "sparkline" => @sparkline,
    "start" => @start,
  })
  result.compact
end