Module aws_lambda_powertools.utilities.data_classes.cloud_watch_custom_widget_event
Expand source code
from typing import Any, Dict, Optional
from aws_lambda_powertools.utilities.data_classes.common import DictWrapper
class TimeZone(DictWrapper):
@property
def label(self) -> str:
"""The time range label. Either 'UTC' or 'Local'"""
return self["label"]
@property
def offset_iso(self) -> str:
"""The time range offset in the format +/-00:00"""
return self["offsetISO"]
@property
def offset_in_minutes(self) -> int:
"""The time range offset in minutes"""
return int(self["offsetInMinutes"])
class TimeRange(DictWrapper):
@property
def mode(self) -> str:
"""The time range mode, i.e. 'relative' or 'absolute'"""
return self["mode"]
@property
def start(self) -> int:
"""The start time within the time range"""
return self["start"]
@property
def end(self) -> int:
"""The end time within the time range"""
return self["end"]
@property
def relative_start(self) -> Optional[int]:
"""The relative start time within the time range"""
return self.get("relativeStart")
@property
def zoom_start(self) -> Optional[int]:
"""The start time within the zoomed time range"""
return (self.get("zoom") or {}).get("start")
@property
def zoom_end(self) -> Optional[int]:
"""The end time within the zoomed time range"""
return (self.get("zoom") or {}).get("end")
class CloudWatchWidgetContext(DictWrapper):
@property
def dashboard_name(self) -> str:
"""Get dashboard name, in which the widget is used"""
return self["dashboardName"]
@property
def widget_id(self) -> str:
"""Get widget ID"""
return self["widgetId"]
@property
def domain(self) -> str:
"""AWS domain name"""
return self["domain"]
@property
def account_id(self) -> str:
"""Get AWS Account ID"""
return self["accountId"]
@property
def locale(self) -> str:
"""Get locale language"""
return self["locale"]
@property
def timezone(self) -> TimeZone:
"""Timezone information of the dashboard"""
return TimeZone(self["timezone"])
@property
def period(self) -> int:
"""The period shown on the dashboard"""
return int(self["period"])
@property
def is_auto_period(self) -> bool:
"""Whether auto period is enabled"""
return bool(self["isAutoPeriod"])
@property
def time_range(self) -> TimeRange:
"""The widget time range"""
return TimeRange(self["timeRange"])
@property
def theme(self) -> str:
"""The dashboard theme, i.e. 'light' or 'dark'"""
return self["theme"]
@property
def link_charts(self) -> bool:
"""The widget is linked to other charts"""
return bool(self["linkCharts"])
@property
def title(self) -> str:
"""Get widget title"""
return self["title"]
@property
def params(self) -> Dict[str, Any]:
"""Get widget parameters"""
return self["params"]
@property
def forms(self) -> Dict[str, Any]:
"""Get widget form data"""
return self["forms"]["all"]
@property
def height(self) -> int:
"""Get widget height"""
return int(self["height"])
@property
def width(self) -> int:
"""Get widget width"""
return int(self["width"])
class CloudWatchDashboardCustomWidgetEvent(DictWrapper):
"""CloudWatch dashboard custom widget event
You can use a Lambda function to create a custom widget on a CloudWatch dashboard.
Documentation:
-------------
- https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/add_custom_widget_dashboard_about.html
"""
@property
def describe(self) -> bool:
"""Display widget documentation"""
return bool(self.get("describe", False))
@property
def widget_context(self) -> Optional[CloudWatchWidgetContext]:
"""The widget context"""
if self.get("widgetContext"):
return CloudWatchWidgetContext(self["widgetContext"])
return None
Classes
class CloudWatchDashboardCustomWidgetEvent (data: Dict[str, Any])
-
CloudWatch dashboard custom widget event
You can use a Lambda function to create a custom widget on a CloudWatch dashboard.
Documentation:
Expand source code
class CloudWatchDashboardCustomWidgetEvent(DictWrapper): """CloudWatch dashboard custom widget event You can use a Lambda function to create a custom widget on a CloudWatch dashboard. Documentation: ------------- - https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/add_custom_widget_dashboard_about.html """ @property def describe(self) -> bool: """Display widget documentation""" return bool(self.get("describe", False)) @property def widget_context(self) -> Optional[CloudWatchWidgetContext]: """The widget context""" if self.get("widgetContext"): return CloudWatchWidgetContext(self["widgetContext"]) return None
Ancestors
- DictWrapper
- collections.abc.Mapping
- collections.abc.Collection
- collections.abc.Sized
- collections.abc.Iterable
- collections.abc.Container
Instance variables
var describe : bool
-
Display widget documentation
Expand source code
@property def describe(self) -> bool: """Display widget documentation""" return bool(self.get("describe", False))
var widget_context : Optional[CloudWatchWidgetContext]
-
The widget context
Expand source code
@property def widget_context(self) -> Optional[CloudWatchWidgetContext]: """The widget context""" if self.get("widgetContext"): return CloudWatchWidgetContext(self["widgetContext"]) return None
Inherited members
class CloudWatchWidgetContext (data: Dict[str, Any])
-
Provides a single read only access to a wrapper dict
Expand source code
class CloudWatchWidgetContext(DictWrapper): @property def dashboard_name(self) -> str: """Get dashboard name, in which the widget is used""" return self["dashboardName"] @property def widget_id(self) -> str: """Get widget ID""" return self["widgetId"] @property def domain(self) -> str: """AWS domain name""" return self["domain"] @property def account_id(self) -> str: """Get AWS Account ID""" return self["accountId"] @property def locale(self) -> str: """Get locale language""" return self["locale"] @property def timezone(self) -> TimeZone: """Timezone information of the dashboard""" return TimeZone(self["timezone"]) @property def period(self) -> int: """The period shown on the dashboard""" return int(self["period"]) @property def is_auto_period(self) -> bool: """Whether auto period is enabled""" return bool(self["isAutoPeriod"]) @property def time_range(self) -> TimeRange: """The widget time range""" return TimeRange(self["timeRange"]) @property def theme(self) -> str: """The dashboard theme, i.e. 'light' or 'dark'""" return self["theme"] @property def link_charts(self) -> bool: """The widget is linked to other charts""" return bool(self["linkCharts"]) @property def title(self) -> str: """Get widget title""" return self["title"] @property def params(self) -> Dict[str, Any]: """Get widget parameters""" return self["params"] @property def forms(self) -> Dict[str, Any]: """Get widget form data""" return self["forms"]["all"] @property def height(self) -> int: """Get widget height""" return int(self["height"]) @property def width(self) -> int: """Get widget width""" return int(self["width"])
Ancestors
- DictWrapper
- collections.abc.Mapping
- collections.abc.Collection
- collections.abc.Sized
- collections.abc.Iterable
- collections.abc.Container
Instance variables
var account_id : str
-
Get AWS Account ID
Expand source code
@property def account_id(self) -> str: """Get AWS Account ID""" return self["accountId"]
var dashboard_name : str
-
Get dashboard name, in which the widget is used
Expand source code
@property def dashboard_name(self) -> str: """Get dashboard name, in which the widget is used""" return self["dashboardName"]
var domain : str
-
AWS domain name
Expand source code
@property def domain(self) -> str: """AWS domain name""" return self["domain"]
var forms : Dict[str, Any]
-
Get widget form data
Expand source code
@property def forms(self) -> Dict[str, Any]: """Get widget form data""" return self["forms"]["all"]
var height : int
-
Get widget height
Expand source code
@property def height(self) -> int: """Get widget height""" return int(self["height"])
var is_auto_period : bool
-
Whether auto period is enabled
Expand source code
@property def is_auto_period(self) -> bool: """Whether auto period is enabled""" return bool(self["isAutoPeriod"])
var link_charts : bool
-
The widget is linked to other charts
Expand source code
@property def link_charts(self) -> bool: """The widget is linked to other charts""" return bool(self["linkCharts"])
var locale : str
-
Get locale language
Expand source code
@property def locale(self) -> str: """Get locale language""" return self["locale"]
var params : Dict[str, Any]
-
Get widget parameters
Expand source code
@property def params(self) -> Dict[str, Any]: """Get widget parameters""" return self["params"]
var period : int
-
The period shown on the dashboard
Expand source code
@property def period(self) -> int: """The period shown on the dashboard""" return int(self["period"])
var theme : str
-
The dashboard theme, i.e. 'light' or 'dark'
Expand source code
@property def theme(self) -> str: """The dashboard theme, i.e. 'light' or 'dark'""" return self["theme"]
var time_range : TimeRange
-
The widget time range
Expand source code
@property def time_range(self) -> TimeRange: """The widget time range""" return TimeRange(self["timeRange"])
var timezone : TimeZone
-
Timezone information of the dashboard
Expand source code
@property def timezone(self) -> TimeZone: """Timezone information of the dashboard""" return TimeZone(self["timezone"])
var title : str
-
Get widget title
Expand source code
@property def title(self) -> str: """Get widget title""" return self["title"]
var widget_id : str
-
Get widget ID
Expand source code
@property def widget_id(self) -> str: """Get widget ID""" return self["widgetId"]
var width : int
-
Get widget width
Expand source code
@property def width(self) -> int: """Get widget width""" return int(self["width"])
Inherited members
class TimeRange (data: Dict[str, Any])
-
Provides a single read only access to a wrapper dict
Expand source code
class TimeRange(DictWrapper): @property def mode(self) -> str: """The time range mode, i.e. 'relative' or 'absolute'""" return self["mode"] @property def start(self) -> int: """The start time within the time range""" return self["start"] @property def end(self) -> int: """The end time within the time range""" return self["end"] @property def relative_start(self) -> Optional[int]: """The relative start time within the time range""" return self.get("relativeStart") @property def zoom_start(self) -> Optional[int]: """The start time within the zoomed time range""" return (self.get("zoom") or {}).get("start") @property def zoom_end(self) -> Optional[int]: """The end time within the zoomed time range""" return (self.get("zoom") or {}).get("end")
Ancestors
- DictWrapper
- collections.abc.Mapping
- collections.abc.Collection
- collections.abc.Sized
- collections.abc.Iterable
- collections.abc.Container
Instance variables
var end : int
-
The end time within the time range
Expand source code
@property def end(self) -> int: """The end time within the time range""" return self["end"]
var mode : str
-
The time range mode, i.e. 'relative' or 'absolute'
Expand source code
@property def mode(self) -> str: """The time range mode, i.e. 'relative' or 'absolute'""" return self["mode"]
var relative_start : Optional[int]
-
The relative start time within the time range
Expand source code
@property def relative_start(self) -> Optional[int]: """The relative start time within the time range""" return self.get("relativeStart")
var start : int
-
The start time within the time range
Expand source code
@property def start(self) -> int: """The start time within the time range""" return self["start"]
var zoom_end : Optional[int]
-
The end time within the zoomed time range
Expand source code
@property def zoom_end(self) -> Optional[int]: """The end time within the zoomed time range""" return (self.get("zoom") or {}).get("end")
var zoom_start : Optional[int]
-
The start time within the zoomed time range
Expand source code
@property def zoom_start(self) -> Optional[int]: """The start time within the zoomed time range""" return (self.get("zoom") or {}).get("start")
Inherited members
class TimeZone (data: Dict[str, Any])
-
Provides a single read only access to a wrapper dict
Expand source code
class TimeZone(DictWrapper): @property def label(self) -> str: """The time range label. Either 'UTC' or 'Local'""" return self["label"] @property def offset_iso(self) -> str: """The time range offset in the format +/-00:00""" return self["offsetISO"] @property def offset_in_minutes(self) -> int: """The time range offset in minutes""" return int(self["offsetInMinutes"])
Ancestors
- DictWrapper
- collections.abc.Mapping
- collections.abc.Collection
- collections.abc.Sized
- collections.abc.Iterable
- collections.abc.Container
Instance variables
var label : str
-
The time range label. Either 'UTC' or 'Local'
Expand source code
@property def label(self) -> str: """The time range label. Either 'UTC' or 'Local'""" return self["label"]
var offset_in_minutes : int
-
The time range offset in minutes
Expand source code
@property def offset_in_minutes(self) -> int: """The time range offset in minutes""" return int(self["offsetInMinutes"])
var offset_iso : str
-
The time range offset in the format +/-00:00
Expand source code
@property def offset_iso(self) -> str: """The time range offset in the format +/-00:00""" return self["offsetISO"]
Inherited members