CloudWatchServiceResource#
Index > CloudWatch > CloudWatchServiceResource
Auto-generated documentation for CloudWatch type annotations stubs module mypy-boto3-cloudwatch.
CloudWatchServiceResource#
Type annotations and code completion for boto3.resource("cloudwatch"), included resources and collections.
boto3 documentation
# CloudWatchServiceResource usage example
from mypy_boto3_cloudwatch.service_resource import CloudWatchServiceResource
def get_cloudwatch_resource() -> CloudWatchServiceResource:
return boto3.resource("cloudwatch")
Attributes#
meta:CloudWatchResourceMetaalarms:ServiceResourceAlarmsCollectionmetrics:ServiceResourceMetricsCollection
Collections#
ServiceResourceAlarmsCollection#
Provides access to Alarm resource.
Type annotations and code completion for boto3.resource("cloudwatch").alarms collection.
boto3 documentation
# ServiceResourceAlarmsCollection usage example
from mypy_boto3_cloudwatch.service_resource import ServiceResourceAlarmsCollection
def get_collection() -> ServiceResourceAlarmsCollection:
return boto3.resource("cloudwatch").alarms
ServiceResourceMetricsCollection#
Provides access to Metric resource.
Type annotations and code completion for boto3.resource("cloudwatch").metrics collection.
boto3 documentation
# ServiceResourceMetricsCollection usage example
from mypy_boto3_cloudwatch.service_resource import ServiceResourceMetricsCollection
def get_collection() -> ServiceResourceMetricsCollection:
return boto3.resource("cloudwatch").metrics
Methods#
CloudWatchServiceResource.get_available_subresources method#
Returns a list of all the available sub-resources for this resource.
Type annotations and code completion for boto3.resource("cloudwatch").get_available_subresources method.
boto3 documentation
# get_available_subresources method definition
def get_available_subresources(
self,
) -> Sequence[str]:
...
CloudWatchServiceResource.Alarm method#
Creates a Alarm resource.
Type annotations and code completion for boto3.resource("cloudwatch").Alarm method.
boto3 documentation
# Alarm method definition
def Alarm(
self,
name: str,
) -> _Alarm:
...
CloudWatchServiceResource.Metric method#
Creates a Metric resource.
Type annotations and code completion for boto3.resource("cloudwatch").Metric method.
boto3 documentation
# Metric method definition
def Metric(
self,
namespace: str,
name: str,
) -> _Metric:
...
Alarm#
Type annotations and code completion for boto3.resource("cloudwatch").Alarm class.
boto3 documentation
# Alarm usage example
from mypy_boto3_cloudwatch.service_resource import Alarm
def get_resource() -> Alarm:
return boto3.resource("cloudwatch").Alarm(...)
Alarm attributes#
name:strmetric:Metricalarm_name:stralarm_arn:stralarm_description:stralarm_configuration_updated_timestamp:datetime.datetimeactions_enabled:boolok_actions:list[str]alarm_actions:list[str]insufficient_data_actions:list[str]state_value: StateValueTypestate_reason:strstate_reason_data:strstate_updated_timestamp:datetime.datetimemetric_name:strnamespace:strstatistic: StatisticTypeextended_statistic:strdimensions:list[DimensionTypeDef]period:intunit: StandardUnitTypeevaluation_periods:intdatapoints_to_alarm:intthreshold:floatcomparison_operator: ComparisonOperatorTypetreat_missing_data:strevaluate_low_sample_count_percentile:strmetrics:list[MetricDataQueryAlarmTypeDef]threshold_metric_id:strevaluation_state: EvaluationStateTypestate_transitioned_timestamp:datetime.datetimeevaluation_criteria: EvaluationCriteriaTypeDefevaluation_interval:intmeta:CloudWatchResourceMeta
Alarm methods#
Alarm.get_available_subresources method#
Returns a list of all the available sub-resources for this Alarm.
Type annotations and code completion for boto3.resource("cloudwatch").get_available_subresources method.
boto3 documentation
# get_available_subresources method definition
def get_available_subresources(
self,
) -> Sequence[str]:
...
Alarm.delete method#
Deletes the specified alarms.
Type annotations and code completion for boto3.resource("cloudwatch").delete method.
boto3 documentation
# delete method definition
def delete(
self,
) -> None:
...
Alarm.describe_history method#
Retrieves the history for the specified alarm.
Type annotations and code completion for boto3.resource("cloudwatch").describe_history method.
boto3 documentation
# describe_history method definition
def describe_history(
self,
*,
AlarmContributorId: str = ...,
AlarmTypes: Sequence[AlarmTypeType] = ..., # (1)
HistoryItemType: HistoryItemTypeType = ..., # (2)
StartDate: TimestampTypeDef = ...,
EndDate: TimestampTypeDef = ...,
MaxRecords: int = ...,
NextToken: str = ...,
ScanBy: ScanByType = ..., # (3)
) -> DescribeAlarmHistoryOutputTypeDef: # (4)
...
- See
Sequence[AlarmTypeType] - See HistoryItemTypeType
- See ScanByType
- See DescribeAlarmHistoryOutputTypeDef
# describe_history method usage example with argument unpacking
kwargs: DescribeAlarmHistoryInputAlarmDescribeHistoryTypeDef = { # (1)
"AlarmContributorId": ...,
}
parent.describe_history(**kwargs)
Alarm.disable_actions method#
Disables the actions for the specified alarms.
Type annotations and code completion for boto3.resource("cloudwatch").disable_actions method.
boto3 documentation
# disable_actions method definition
def disable_actions(
self,
) -> None:
...
Alarm.enable_actions method#
Enables the actions for the specified alarms.
Type annotations and code completion for boto3.resource("cloudwatch").enable_actions method.
boto3 documentation
# enable_actions method definition
def enable_actions(
self,
) -> None:
...
Alarm.set_state method#
Temporarily sets the state of an alarm for testing purposes.
Type annotations and code completion for boto3.resource("cloudwatch").set_state method.
boto3 documentation
# set_state method definition
def set_state(
self,
*,
StateValue: StateValueType, # (1)
StateReason: str,
StateReasonData: str = ...,
) -> None:
...
- See StateValueType
# set_state method usage example with argument unpacking
kwargs: SetAlarmStateInputAlarmSetStateTypeDef = { # (1)
"StateValue": ...,
"StateReason": ...,
}
parent.set_state(**kwargs)
Alarm.load method#
Type annotations and code completion for boto3.resource("cloudwatch").load method.
boto3 documentation
# load method definition
def load(
self,
) -> None:
...
Alarm.reload method#
Type annotations and code completion for boto3.resource("cloudwatch").reload method.
boto3 documentation
# reload method definition
def reload(
self,
) -> None:
...
Metric#
Type annotations and code completion for boto3.resource("cloudwatch").Metric class.
boto3 documentation
# Metric usage example
from mypy_boto3_cloudwatch.service_resource import Metric
def get_resource() -> Metric:
return boto3.resource("cloudwatch").Metric(...)
Metric attributes#
namespace:strname:stralarms:MetricAlarmsCollectionmetric_name:strdimensions:list[DimensionTypeDef]meta:CloudWatchResourceMeta
Metric collections#
Metric.alarms#
Provides access to Alarm resource.
Type annotations and code completion for boto3.resource("cloudwatch").Metric(...).alarms collection.
boto3 documentation
# MetricAlarmsCollection usage example
from mypy_boto3_cloudwatch.service_resource import MetricAlarmsCollection
def get_collection() -> MetricAlarmsCollection:
resource = boto3.resource("cloudwatch").Metric(...)
return resource.alarms
Metric methods#
Metric.get_available_subresources method#
Returns a list of all the available sub-resources for this Metric.
Type annotations and code completion for boto3.resource("cloudwatch").get_available_subresources method.
boto3 documentation
# get_available_subresources method definition
def get_available_subresources(
self,
) -> Sequence[str]:
...
Metric.get_statistics method#
Gets statistics for the specified metric.
Type annotations and code completion for boto3.resource("cloudwatch").get_statistics method.
boto3 documentation
# get_statistics method definition
def get_statistics(
self,
*,
StartTime: TimestampTypeDef,
EndTime: TimestampTypeDef,
Period: int,
Dimensions: Sequence[DimensionTypeDef] = ..., # (1)
Statistics: Sequence[StatisticType] = ..., # (2)
ExtendedStatistics: Sequence[str] = ...,
Unit: StandardUnitType = ..., # (3)
) -> GetMetricStatisticsOutputTypeDef: # (4)
...
- See
Sequence[DimensionTypeDef] - See
Sequence[StatisticType] - See StandardUnitType
- See GetMetricStatisticsOutputTypeDef
# get_statistics method usage example with argument unpacking
kwargs: GetMetricStatisticsInputMetricGetStatisticsTypeDef = { # (1)
"StartTime": ...,
"EndTime": ...,
"Period": ...,
}
parent.get_statistics(**kwargs)
Metric.put_alarm method#
Creates or updates an alarm and associates it with the specified metric, metric math expression, anomaly detection model, Metrics Insights query, or PromQL query.
Type annotations and code completion for boto3.resource("cloudwatch").put_alarm method.
boto3 documentation
# put_alarm method definition
def put_alarm(
self,
*,
AlarmName: str,
AlarmDescription: str = ...,
ActionsEnabled: bool = ...,
OKActions: Sequence[str] = ...,
AlarmActions: Sequence[str] = ...,
InsufficientDataActions: Sequence[str] = ...,
Statistic: StatisticType = ..., # (1)
ExtendedStatistic: str = ...,
Dimensions: Sequence[DimensionTypeDef] = ..., # (2)
Period: int = ...,
Unit: StandardUnitType = ..., # (3)
EvaluationPeriods: int = ...,
DatapointsToAlarm: int = ...,
Threshold: float = ...,
ComparisonOperator: ComparisonOperatorType = ..., # (4)
TreatMissingData: str = ...,
EvaluateLowSampleCountPercentile: str = ...,
Metrics: Sequence[MetricDataQueryUnionTypeDef] = ..., # (5)
Tags: Sequence[TagTypeDef] = ..., # (6)
ThresholdMetricId: str = ...,
EvaluationCriteria: EvaluationCriteriaTypeDef = ..., # (7)
EvaluationInterval: int = ...,
) -> _Alarm:
...
- See StatisticType
- See
Sequence[DimensionTypeDef] - See StandardUnitType
- See ComparisonOperatorType
- See
Sequence[MetricDataQueryUnionTypeDef] - See
Sequence[TagTypeDef] - See EvaluationCriteriaTypeDef
# put_alarm method usage example with argument unpacking
kwargs: PutMetricAlarmInputMetricPutAlarmTypeDef = { # (1)
"AlarmName": ...,
}
parent.put_alarm(**kwargs)
Metric.put_data method#
Publishes metric data to Amazon CloudWatch.
Type annotations and code completion for boto3.resource("cloudwatch").put_data method.
boto3 documentation
# put_data method definition
def put_data(
self,
*,
EntityMetricData: Sequence[EntityMetricDataTypeDef] = ..., # (1)
StrictEntityValidation: bool = ...,
) -> None:
...
- See
Sequence[EntityMetricDataTypeDef]
# put_data method usage example with argument unpacking
kwargs: PutMetricDataInputMetricPutDataTypeDef = { # (1)
"EntityMetricData": ...,
}
parent.put_data(**kwargs)
Metric.load method#
Type annotations and code completion for boto3.resource("cloudwatch").load method.
boto3 documentation
# load method definition
def load(
self,
) -> None:
...
Metric.reload method#
Type annotations and code completion for boto3.resource("cloudwatch").reload method.
boto3 documentation
# reload method definition
def reload(
self,
) -> None:
...