DashboardVariableOptions

class aws_cdk.aws_cloudwatch.DashboardVariableOptions(*, id, input_type, type, value, default_value=None, label=None, values=None, visible=None)

Bases: object

Options for {@link DashboardVariable}.

Parameters:
  • id (str) – Unique id.

  • input_type (VariableInputType) – The way the variable value is selected.

  • type (VariableType) – Type of the variable.

  • value (str) – Pattern or property value to replace.

  • default_value (Optional[DefaultValue]) – Optional default value. Default: - no default value is set

  • label (Optional[str]) – Optional label in the toolbar. Default: - the variable’s value

  • values (Optional[Values]) – Optional values (required for {@link VariableInputType.RADIO} and {@link VariableInputType.SELECT} dashboard variables). Default: - no values

  • visible (Optional[bool]) – Whether the variable is visible. Default: - true

ExampleMetadata:

infused

Example:

import aws_cdk.aws_cloudwatch as cw


dashboard = cw.Dashboard(self, "Dash",
    default_interval=Duration.days(7),
    variables=[cw.DashboardVariable(
        id="functionName",
        type=cw.VariableType.PATTERN,
        label="Function",
        input_type=cw.VariableInputType.RADIO,
        value="originalFuncNameInDashboard",
        # equivalent to cw.Values.fromSearch('{AWS/Lambda,FunctionName} MetricName="Duration"', 'FunctionName')
        values=cw.Values.from_search_components(
            namespace="AWS/Lambda",
            dimensions=["FunctionName"],
            metric_name="Duration",
            populate_from="FunctionName"
        ),
        default_value=cw.DefaultValue.FIRST,
        visible=True
    )]
)

Attributes

default_value

Optional default value.

Default:
  • no default value is set

id

Unique id.

input_type

The way the variable value is selected.

label

Optional label in the toolbar.

Default:
  • the variable’s value

type

Type of the variable.

value

Pattern or property value to replace.

values

Optional values (required for {@link VariableInputType.RADIO} and {@link VariableInputType.SELECT} dashboard variables).

Default:
  • no values

visible

Whether the variable is visible.

Default:
  • true