Skip to content

CloudWatchClient#

Index > CloudWatch > CloudWatchClient

Auto-generated documentation for CloudWatch type annotations stubs module mypy-boto3-cloudwatch.

CloudWatchClient#

Type annotations and code completion for boto3.client("cloudwatch"). boto3 documentation

# CloudWatchClient usage example

from boto3.session import Session
from mypy_boto3_cloudwatch.client import CloudWatchClient

def get_cloudwatch_client() -> CloudWatchClient:
    return Session().client("cloudwatch")

Exceptions#

boto3 client exceptions are generated in runtime. This class provides code completion for boto3.client("cloudwatch").exceptions structure.

# Exceptions.exceptions usage example

client = boto3.client("cloudwatch")

try:
    do_something(client)
except (
    client.exceptions.ClientError,
    client.exceptions.ConcurrentModificationException,
    client.exceptions.DashboardInvalidInputError,
    client.exceptions.DashboardNotFoundError,
    client.exceptions.InternalServiceFault,
    client.exceptions.InvalidFormatFault,
    client.exceptions.InvalidNextToken,
    client.exceptions.InvalidParameterCombinationException,
    client.exceptions.InvalidParameterValueException,
    client.exceptions.LimitExceededException,
    client.exceptions.LimitExceededFault,
    client.exceptions.MissingRequiredParameterException,
    client.exceptions.ResourceNotFound,
    client.exceptions.ResourceNotFoundException,
) as e:
    print(e)
# Exceptions.exceptions type checking example

from mypy_boto3_cloudwatch.client import Exceptions

def handle_error(exc: Exceptions.ClientError) -> None:
    ...

Methods#

can_paginate#

Check if an operation can be paginated.

Type annotations and code completion for boto3.client("cloudwatch").can_paginate method. boto3 documentation

# can_paginate method definition

def can_paginate(
    self,
    operation_name: str,
) -> bool:
    ...

close#

Closes underlying endpoint connections.

Type annotations and code completion for boto3.client("cloudwatch").close method. boto3 documentation

# close method definition

def close(
    self,
) -> None:
    ...

delete_alarms#

Deletes the specified alarms.

Type annotations and code completion for boto3.client("cloudwatch").delete_alarms method. boto3 documentation

# delete_alarms method definition

def delete_alarms(
    self,
    *,
    AlarmNames: Sequence[str],
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
# delete_alarms method usage example with argument unpacking

kwargs: DeleteAlarmsInputRequestTypeDef = {  # (1)
    "AlarmNames": ...,
}

parent.delete_alarms(**kwargs)
  1. See DeleteAlarmsInputRequestTypeDef

delete_anomaly_detector#

Deletes the specified anomaly detection model from your account.

Type annotations and code completion for boto3.client("cloudwatch").delete_anomaly_detector method. boto3 documentation

# delete_anomaly_detector method definition

def delete_anomaly_detector(
    self,
    *,
    Namespace: str = ...,
    MetricName: str = ...,
    Dimensions: Sequence[DimensionTypeDef] = ...,  # (1)
    Stat: str = ...,
    SingleMetricAnomalyDetector: Union[SingleMetricAnomalyDetectorTypeDef, SingleMetricAnomalyDetectorExtraOutputTypeDef] = ...,  # (2)
    MetricMathAnomalyDetector: Union[MetricMathAnomalyDetectorTypeDef, MetricMathAnomalyDetectorExtraOutputTypeDef] = ...,  # (3)
) -> Dict[str, Any]:
    ...
  1. See DimensionTypeDef
  2. See SingleMetricAnomalyDetectorTypeDef SingleMetricAnomalyDetectorExtraOutputTypeDef
  3. See MetricMathAnomalyDetectorTypeDef MetricMathAnomalyDetectorExtraOutputTypeDef
# delete_anomaly_detector method usage example with argument unpacking

kwargs: DeleteAnomalyDetectorInputRequestTypeDef = {  # (1)
    "Namespace": ...,
}

parent.delete_anomaly_detector(**kwargs)
  1. See DeleteAnomalyDetectorInputRequestTypeDef

delete_dashboards#

Deletes all dashboards that you specify.

Type annotations and code completion for boto3.client("cloudwatch").delete_dashboards method. boto3 documentation

# delete_dashboards method definition

def delete_dashboards(
    self,
    *,
    DashboardNames: Sequence[str],
) -> Dict[str, Any]:
    ...
# delete_dashboards method usage example with argument unpacking

kwargs: DeleteDashboardsInputRequestTypeDef = {  # (1)
    "DashboardNames": ...,
}

parent.delete_dashboards(**kwargs)
  1. See DeleteDashboardsInputRequestTypeDef

delete_insight_rules#

Permanently deletes the specified Contributor Insights rules.

Type annotations and code completion for boto3.client("cloudwatch").delete_insight_rules method. boto3 documentation

# delete_insight_rules method definition

def delete_insight_rules(
    self,
    *,
    RuleNames: Sequence[str],
) -> DeleteInsightRulesOutputTypeDef:  # (1)
    ...
  1. See DeleteInsightRulesOutputTypeDef
# delete_insight_rules method usage example with argument unpacking

kwargs: DeleteInsightRulesInputRequestTypeDef = {  # (1)
    "RuleNames": ...,
}

parent.delete_insight_rules(**kwargs)
  1. See DeleteInsightRulesInputRequestTypeDef

delete_metric_stream#

Permanently deletes the metric stream that you specify.

Type annotations and code completion for boto3.client("cloudwatch").delete_metric_stream method. boto3 documentation

# delete_metric_stream method definition

def delete_metric_stream(
    self,
    *,
    Name: str,
) -> Dict[str, Any]:
    ...
# delete_metric_stream method usage example with argument unpacking

kwargs: DeleteMetricStreamInputRequestTypeDef = {  # (1)
    "Name": ...,
}

parent.delete_metric_stream(**kwargs)
  1. See DeleteMetricStreamInputRequestTypeDef

describe_alarm_history#

Retrieves the history for the specified alarm.

Type annotations and code completion for boto3.client("cloudwatch").describe_alarm_history method. boto3 documentation

# describe_alarm_history method definition

def describe_alarm_history(
    self,
    *,
    AlarmName: str = ...,
    AlarmTypes: Sequence[AlarmTypeType] = ...,  # (1)
    HistoryItemType: HistoryItemTypeType = ...,  # (2)
    StartDate: Union[datetime, str] = ...,
    EndDate: Union[datetime, str] = ...,
    MaxRecords: int = ...,
    NextToken: str = ...,
    ScanBy: ScanByType = ...,  # (3)
) -> DescribeAlarmHistoryOutputTypeDef:  # (4)
    ...
  1. See AlarmTypeType
  2. See HistoryItemTypeType
  3. See ScanByType
  4. See DescribeAlarmHistoryOutputTypeDef
# describe_alarm_history method usage example with argument unpacking

kwargs: DescribeAlarmHistoryInputRequestTypeDef = {  # (1)
    "AlarmName": ...,
}

parent.describe_alarm_history(**kwargs)
  1. See DescribeAlarmHistoryInputRequestTypeDef

describe_alarms#

Retrieves the specified alarms.

Type annotations and code completion for boto3.client("cloudwatch").describe_alarms method. boto3 documentation

# describe_alarms method definition

def describe_alarms(
    self,
    *,
    AlarmNames: Sequence[str] = ...,
    AlarmNamePrefix: str = ...,
    AlarmTypes: Sequence[AlarmTypeType] = ...,  # (1)
    ChildrenOfAlarmName: str = ...,
    ParentsOfAlarmName: str = ...,
    StateValue: StateValueType = ...,  # (2)
    ActionPrefix: str = ...,
    MaxRecords: int = ...,
    NextToken: str = ...,
) -> DescribeAlarmsOutputTypeDef:  # (3)
    ...
  1. See AlarmTypeType
  2. See StateValueType
  3. See DescribeAlarmsOutputTypeDef
# describe_alarms method usage example with argument unpacking

kwargs: DescribeAlarmsInputRequestTypeDef = {  # (1)
    "AlarmNames": ...,
}

parent.describe_alarms(**kwargs)
  1. See DescribeAlarmsInputRequestTypeDef

describe_alarms_for_metric#

Retrieves the alarms for the specified metric.

Type annotations and code completion for boto3.client("cloudwatch").describe_alarms_for_metric method. boto3 documentation

# describe_alarms_for_metric method definition

def describe_alarms_for_metric(
    self,
    *,
    MetricName: str,
    Namespace: str,
    Statistic: StatisticType = ...,  # (1)
    ExtendedStatistic: str = ...,
    Dimensions: Sequence[DimensionTypeDef] = ...,  # (2)
    Period: int = ...,
    Unit: StandardUnitType = ...,  # (3)
) -> DescribeAlarmsForMetricOutputTypeDef:  # (4)
    ...
  1. See StatisticType
  2. See DimensionTypeDef
  3. See StandardUnitT