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.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.BillExpirationException) -> 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: AnomalySubscriptionTypeDef,  # (1)
    ResourceTags: Sequence[ResourceTagTypeDef] = ...,  # (2)
) -> CreateAnomalySubscriptionResponseTypeDef:  # (3)
    ...
  1. See AnomalySubscriptionTypeDef
  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[CostCategorySplitChargeRuleTypeDef] = ...,  # (3)
    ResourceTags: Sequence[ResourceTagTypeDef] = ...,  # (4)
) -> CreateCostCategoryDefinitionResponseTypeDef:  # (5)
    ...
  1. See CostCategoryRuleVersionType
  2. See CostCategoryRuleTypeDef
  3. See CostCategorySplitChargeRuleTypeDef
  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. boto3 documentation

# get_anomalies method definition

def get_anomalies(
    self,
    *,
    DateInterval: AnomalyDateIntervalTypeDef,  # (1)
    MonitorArn: str = ...,
    Feedback: AnomalyFeedbackTypeType = ...,  # (2)
    TotalImpact: TotalImpactFilterTypeDef = ...,  # (3)
    NextPageToken: str = ...,
    MaxResults: int = ...,
) -> GetAnomaliesResponseTypeDef:  # (4)
    ...
  1. See AnomalyDateIntervalTypeDef
  2. See AnomalyFeedbackTypeType
  3. See TotalImpactFilterTypeDef
  4. See GetAnomaliesResponseTypeDef
# get_anomalies method usage example with argument unpacking

kwargs: GetAnomaliesRequestRequestTypeDef = {  # (1)
    "DateInterval": ...,
}

parent.get_anomalies(**kwargs)
  1. See GetAnomaliesRequestRequestTypeDef

get_anomaly_monitors#

Retrieves the cost anomaly monitor definitions for your account.

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

# get_anomaly_monitors method definition

def get_anomaly_monitors(
    self,
    *,
    MonitorArnList: Sequence[str] = ...,
    NextPageToken: str = ...,
    MaxResults: int = ...,
) -> GetAnomalyMonitorsResponseTypeDef:  # (1)
    ...
  1. See GetAnomalyMonitorsResponseTypeDef
# get_anomaly_monitors method usage example with argument unpacking

kwargs: GetAnomalyMonitorsRequestRequestTypeDef = {  # (1)
    "MonitorArnList": ...,
}

parent.get_anomaly_monitors(**kwargs)
  1. See GetAnomalyMonitorsRequestRequestTypeDef

get_anomaly_subscriptions#

Retrieves the cost anomaly subscription objects for your account.

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

# get_anomaly_subscriptions method definition

def get_anomaly_subscriptions(
    self,
    *,
    SubscriptionArnList: Sequence[str] = ...,
    MonitorArn: str = ...,
    NextPageToken: str = ...,
    MaxResults: int = ...,
) -> GetAnomalySubscriptionsResponseTypeDef:  # (1)
    ...
  1. See GetAnomalySubscriptionsResponseTypeDef
# get_anomaly_subscriptions method usage example with argument unpacking

kwargs: GetAnomalySubscriptionsRequestRequestTypeDef = {  # (1)
    "SubscriptionArnList": ...,
}

parent.get_anomaly_subscriptions(**kwargs)
  1. See GetAnomalySubscriptionsRequestRequestTypeDef

get_cost_and_usage#

Retrieves cost and usage metrics for your account.

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

# get_cost_and_usage method definition

def get_cost_and_usage(
    self,
    *,
    TimePeriod: DateIntervalTypeDef,  # (1)
    Granularity: GranularityType,  # (2)
    Metrics: Sequence[str],
    Filter: ExpressionTypeDef = ...,  # (3)
    GroupBy: Sequence[GroupDefinitionTypeDef] = ...,  # (4)
    NextPageToken: str = ...,
) -> GetCostAndUsageResponseTypeDef:  # (5)
    ...
  1. See DateIntervalTypeDef
  2. See GranularityType
  3. See ExpressionTypeDef
  4. See GroupDefinitionTypeDef
  5. See GetCostAndUsageResponseTypeDef
# get_cost_and_usage method usage example with argument unpacking

kwargs: GetCostAndUsageRequestRequestTypeDef = {  # (1)
    "TimePeriod": ...,
    "Granularity": ...,
    "Metrics": ...,
}

parent.get_cost_and_usage(**kwargs)
  1. See GetCostAndUsageRequestRequestTypeDef

get_cost_and_usage_with_resources#

Retrieves cost and usage metrics with resources for your account.

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

# get_cost_and_usage_with_resources method definition

def get_cost_and_usage_with_resources(
    self,
    *,
    TimePeriod: DateIntervalTypeDef,  # (1)
    Granularity: GranularityType,  # (2)
    Filter: ExpressionTypeDef,  # (3)
    Metrics: Sequence[str] = ...,
    GroupBy: Sequence[GroupDefinitionTypeDef] = ...,  # (4)
    NextPageToken: str = ...,
) -> GetCostAndUsageWithResourcesResponseTypeDef:  # (5)
    ...
  1. See DateIntervalTypeDef
  2. See GranularityType
  3. See