Dashboard
- class aws_cdk.aws_cloudwatch.Dashboard(scope, id, *, dashboard_name=None, default_interval=None, end=None, period_override=None, start=None, variables=None, widgets=None)
Bases:
Resource
A CloudWatch dashboard.
- ExampleMetadata:
infused
Example:
import aws_cdk.aws_cloudwatch as cw dashboard = cw.Dashboard(self, "Dash", default_interval=Duration.days(7), variables=[cw.DashboardVariable( id="region2", type=cw.VariableType.PATTERN, label="RegionPattern", input_type=cw.VariableInputType.INPUT, value="us-east-1", default_value=cw.DefaultValue.value("us-east-1"), visible=True )] )
- Parameters:
scope (
Construct
) –id (
str
) –dashboard_name (
Optional
[str
]) – Name of the dashboard. If set, must only contain alphanumerics, dash (-) and underscore (_) Default: - automatically generated namedefault_interval (
Optional
[Duration
]) – Interval duration for metrics. You can specify defaultInterval with the relative time(eg. cdk.Duration.days(7)). Both propertiesdefaultInterval
andstart
cannot be set at once. Default: When the dashboard loads, the defaultInterval time will be the default time range.end (
Optional
[str
]) – The end of the time range to use for each widget on the dashboard when the dashboard loads. 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. Default: When the dashboard loads, the end date will be the current time.period_override (
Optional
[PeriodOverride
]) – Use this field to specify the period for the graphs when the dashboard loads. SpecifyingAuto
causes the period of all graphs on the dashboard to automatically adapt to the time range of the dashboard. SpecifyingInherit
ensures that the period set for each graph is always obeyed. Default: Autostart (
Optional
[str
]) – The start of the time range to use for each widget on 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. Both propertiesdefaultInterval
andstart
cannot be set at once. Default: When the dashboard loads, the start time will be the default time range.variables (
Optional
[Sequence
[IVariable
]]) – A list of dashboard variables. Default: - No variableswidgets (
Optional
[Sequence
[Sequence
[IWidget
]]]) – Initial set of widgets on the dashboard. One array represents a row of widgets. Default: - No widgets
Methods
- add_variable(variable)
Add a variable to the dashboard.
- Parameters:
variable (
IVariable
) –- See:
https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_dashboard_variables.html
- Return type:
None
- add_widgets(*widgets)
Add a widget to the dashboard.
Widgets given in multiple calls to add() will be laid out stacked on top of each other.
Multiple widgets added in the same call to add() will be laid out next to each other.
- Parameters:
widgets (
IWidget
) –- Return type:
None
- apply_removal_policy(policy)
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.
The resource can be deleted (
RemovalPolicy.DESTROY
), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN
).- Parameters:
policy (
RemovalPolicy
) –- Return type:
None
- to_string()
Returns a string representation of this construct.
- Return type:
str
Attributes
- dashboard_arn
ARN of this dashboard.
- Attribute:
true
- dashboard_name
The name of this dashboard.
- Attribute:
true
- env
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
- node
The tree node.
- stack
The stack in which this resource is defined.
Static Methods
- classmethod is_construct(x)
Checks if
x
is a construct.Use this method instead of
instanceof
to properly detectConstruct
instances, even when the construct library is symlinked.Explanation: in JavaScript, multiple copies of the
constructs
library on disk are seen as independent, completely different libraries. As a consequence, the classConstruct
in each copy of theconstructs
library is seen as a different class, and an instance of one class will not test asinstanceof
the other class.npm install
will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of theconstructs
library can be accidentally installed, andinstanceof
will behave unpredictably. It is safest to avoid usinginstanceof
, and using this type-testing method instead.- Parameters:
x (
Any
) – Any object.- Return type:
bool
- Returns:
true if
x
is an object created from a class which extendsConstruct
.
- classmethod is_owned_resource(construct)
Returns true if the construct was created by CDK, and false otherwise.
- Parameters:
construct (
IConstruct
) –- Return type:
bool
- classmethod is_resource(construct)
Check whether the given construct is a Resource.
- Parameters:
construct (
IConstruct
) –- Return type:
bool