Skip to content

CostExplorerClient#

Index > CostExplorer > CostExplorerClient

Auto-generated documentation for CostExplorer type annotations stubs module mypy-boto3-ce.

CostExplorerClient#

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

# CostExplorerClient usage example

from boto3.session import Session
from mypy_boto3_ce.client import CostExplorerClient

def get_ce_client() -> CostExplorerClient:
    return Session().client("ce")

Exceptions#

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

# Exceptions.exceptions usage example

client = boto3.client("ce")

try:
    do_something(client)
except (
    client.exceptions.BackfillLimitExceededException,
    client.exceptions.BillExpirationException,
    client.exceptions.ClientError,
    client.exceptions.DataUnavailableException,
    client.exceptions.GenerationExistsException,
    client.exceptions.InvalidNextTokenException,
    client.exceptions.LimitExceededException,
    client.exceptions.RequestChangedException,
    client.exceptions.ResourceNotFoundException,
    client.exceptions.ServiceQuotaExceededException,
    client.exceptions.TooManyTagsException,
    client.exceptions.UnknownMonitorException,
    client.exceptions.UnknownSubscriptionException,
    client.exceptions.UnresolvableUsageUnitException,
) as e:
    print(e)
# Exceptions.exceptions type checking example

from mypy_boto3_ce.client import Exceptions

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

Methods#

can_paginate#

Check if an operation can be paginated.

Type annotations and code completion for boto3.client("ce").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("ce").close method. boto3 documentation

# close method definition

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

create_anomaly_monitor#

Creates a new cost anomaly detection monitor with the requested type and monitor specification.

Type annotations and code completion for boto3.client("ce").create_anomaly_monitor method. boto3 documentation

# create_anomaly_monitor method definition

def create_anomaly_monitor(
    self,
    *,
    AnomalyMonitor: AnomalyMonitorTypeDef,  # (1)
    ResourceTags: Sequence[ResourceTagTypeDef] = ...,  # (2)
) -> CreateAnomalyMonitorResponseTypeDef:  # (3)
    ...
  1. See AnomalyMonitorTypeDef
  2. See ResourceTagTypeDef
  3. See CreateAnomalyMonitorResponseTypeDef
# create_anomaly_monitor method usage example with argument unpacking

kwargs: CreateAnomalyMonitorRequestRequestTypeDef = {  # (1)
    "AnomalyMonitor": ...,
}

parent.create_anomaly_monitor(**kwargs)
  1. See CreateAnomalyMonitorRequestRequestTypeDef

create_anomaly_subscription#

Adds an alert subscription to a cost anomaly detection monitor.

Type annotations and code completion for boto3.client("ce").create_anomaly_subscription method. boto3 documentation

# create_anomaly_subscription method definition

def create_anomaly_subscription(
    self,
    *,
    AnomalySubscription: Union[AnomalySubscriptionTypeDef, AnomalySubscriptionOutputTypeDef],  # (1)
    ResourceTags: Sequence[ResourceTagTypeDef] = ...,  # (2)
) -> CreateAnomalySubscriptionResponseTypeDef:  # (3)
    ...
  1. See AnomalySubscriptionTypeDef AnomalySubscriptionOutputTypeDef
  2. See ResourceTagTypeDef
  3. See CreateAnomalySubscriptionResponseTypeDef
# create_anomaly_subscription method usage example with argument unpacking

kwargs: CreateAnomalySubscriptionRequestRequestTypeDef = {  # (1)
    "AnomalySubscription": ...,
}

parent.create_anomaly_subscription(**kwargs)
  1. See CreateAnomalySubscriptionRequestRequestTypeDef

create_cost_category_definition#

Creates a new Cost Category with the requested name and rules.

Type annotations and code completion for boto3.client("ce").create_cost_category_definition method. boto3 documentation

# create_cost_category_definition method definition

def create_cost_category_definition(
    self,
    *,
    Name: str,
    RuleVersion: CostCategoryRuleVersionType,  # (1)
    Rules: Sequence[CostCategoryRuleTypeDef],  # (2)
    EffectiveStart: str = ...,
    DefaultValue: str = ...,
    SplitChargeRules: Sequence[Union[CostCategorySplitChargeRuleTypeDef, CostCategorySplitChargeRuleOutputTypeDef]] = ...,  # (3)
    ResourceTags: Sequence[ResourceTagTypeDef] = ...,  # (4)
) -> CreateCostCategoryDefinitionResponseTypeDef:  # (5)
    ...
  1. See CostCategoryRuleVersionType
  2. See CostCategoryRuleTypeDef
  3. See CostCategorySplitChargeRuleTypeDef CostCategorySplitChargeRuleOutputTypeDef
  4. See ResourceTagTypeDef
  5. See CreateCostCategoryDefinitionResponseTypeDef
# create_cost_category_definition method usage example with argument unpacking

kwargs: CreateCostCategoryDefinitionRequestRequestTypeDef = {  # (1)
    "Name": ...,
    "RuleVersion": ...,
    "Rules": ...,
}

parent.create_cost_category_definition(**kwargs)
  1. See CreateCostCategoryDefinitionRequestRequestTypeDef

delete_anomaly_monitor#

Deletes a cost anomaly monitor.

Type annotations and code completion for boto3.client("ce").delete_anomaly_monitor method. boto3 documentation

# delete_anomaly_monitor method definition

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

kwargs: DeleteAnomalyMonitorRequestRequestTypeDef = {  # (1)
    "MonitorArn": ...,
}

parent.delete_anomaly_monitor(**kwargs)
  1. See DeleteAnomalyMonitorRequestRequestTypeDef

delete_anomaly_subscription#

Deletes a cost anomaly subscription.

Type annotations and code completion for boto3.client("ce").delete_anomaly_subscription method. boto3 documentation

# delete_anomaly_subscription method definition

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

kwargs: DeleteAnomalySubscriptionRequestRequestTypeDef = {  # (1)
    "SubscriptionArn": ...,
}

parent.delete_anomaly_subscription(**kwargs)
  1. See DeleteAnomalySubscriptionRequestRequestTypeDef

delete_cost_category_definition#

Deletes a Cost Category.

Type annotations and code completion for boto3.client("ce").delete_cost_category_definition method. boto3 documentation

# delete_cost_category_definition method definition

def delete_cost_category_definition(
    self,
    *,
    CostCategoryArn: str,
) -> DeleteCostCategoryDefinitionResponseTypeDef:  # (1)
    ...
  1. See DeleteCostCategoryDefinitionResponseTypeDef
# delete_cost_category_definition method usage example with argument unpacking

kwargs: DeleteCostCategoryDefinitionRequestRequestTypeDef = {  # (1)
    "CostCategoryArn": ...,
}

parent.delete_cost_category_definition(**kwargs)
  1. See DeleteCostCategoryDefinitionRequestRequestTypeDef

describe_cost_category_definition#

Returns the name, Amazon Resource Name (ARN), rules, definition, and effective dates of a Cost Category that's defined in the account.

Type annotations and code completion for boto3.client("ce").describe_cost_category_definition method. boto3 documentation

# describe_cost_category_definition method definition

def describe_cost_category_definition(
    self,
    *,
    CostCategoryArn: str,
    EffectiveOn: str = ...,
) -> DescribeCostCategoryDefinitionResponseTypeDef:  # (1)
    ...
  1. See DescribeCostCategoryDefinitionResponseTypeDef
# describe_cost_category_definition method usage example with argument unpacking

kwargs: DescribeCostCategoryDefinitionRequestRequestTypeDef = {  # (1)
    "CostCategoryArn": ...,
}

parent.describe_cost_category_definition(**kwargs)
  1. See DescribeCostCategoryDefinitionRequestRequestTypeDef

generate_presigned_url#

Generate a presigned url given a client, its method, and arguments.

Type annotations and code completion for boto3.client("ce").generate_presigned_url method. boto3 documentation

# generate_presigned_url method definition

def generate_presigned_url(
    self,
    ClientMethod: str,
    Params: Mapping[str, Any] = ...,
    ExpiresIn: int = 3600,
    HttpMethod: str = ...,
) -> str:
    ...

get_anomalies#

Retrieves all of the cost anomalies detected on your account during the time period that's specified by the DateInterval object.

Type annotations and code completion for boto3.client("ce").get_anomalies method.