Type Annotations for AWS Billing and Cost Management Recommended Actions (Boto3)
This library provides comprehensive type annotations (stubs) for the `boto3` client of the AWS Billing and Cost Management Recommended Actions service, enabling static type checking with tools like MyPy. It is part of the `mypy-boto3` project, which generates stubs for all AWS services. The current version is `1.42.9`, and the project has a frequent release cadence, often aligning with `boto3` updates and new AWS service features.
Warnings
- breaking Python 3.8 is no longer supported starting with `mypy-boto3-builder` version 8.12.0. All generated stub packages (including this one) now require Python 3.9 or newer.
- breaking TypeDef naming conventions changed in builder version 8.9.0. TypeDefs for packed method arguments use shorter names (e.g., `CreateDistributionRequestRequestTypeDef` -> `CreateDistributionRequestTypeDef`). Conflicting TypeDef `Extra` postfixes were also moved.
- gotcha This package provides *only* type annotations. You must have `boto3` installed alongside `mypy-boto3-bcm-recommended-actions` for your code to run.
- gotcha To ensure correct type checking, the version of `mypy-boto3-bcm-recommended-actions` should ideally match or be very close to your installed `boto3` version. Significant mismatches can lead to incorrect type hints or missing attributes.
- gotcha The service name used in `boto3.client('SERVICE_NAME')` might differ slightly from the package name. For this service, use `billing-cost-management-recommended-actions` for the client initialization.
Install
-
pip install boto3 mypy-boto3-bcm-recommended-actions
Imports
- BillingAndCostManagementRecommendedActionsClient
from mypy_boto3_bcm_recommended_actions.client import BillingAndCostManagementRecommendedActionsClient
- Client
from mypy_boto3_bcm_recommended_actions.client import BillingAndCostManagementRecommendedActionsClient
- ServiceResource
from mypy_boto3_bcm_recommended_actions.service_resource import BillingAndCostManagementRecommendedActionsServiceResource
Quickstart
import boto3
from mypy_boto3_bcm_recommended_actions.client import BillingAndCostManagementRecommendedActionsClient
# For demonstration, typically use AWS credentials configured externally
# via environment variables, ~/.aws/credentials, etc.
# This example assumes you have valid AWS credentials configured.
try:
session = boto3.Session(region_name="us-east-1")
client: BillingAndCostManagementRecommendedActionsClient = session.client(
"billing-cost-management-recommended-actions"
)
# Example: List resource budgeting recommendations (actual API call might vary)
# Note: This service's API details might not have common public list operations
# The example is illustrative for type checking.
# Consult AWS BCM Recommended Actions documentation for actual operations.
print("Attempting a dummy client call for type checking demonstration...")
# The BCM Recommended Actions service typically works with specific actions/recommendations.
# A simple call might not exist for generic 'list'.
# Let's simulate a call that would be type-checked if it existed.
# For real use, replace with an actual API method like 'get_recommendations'.
# response = client.get_recommendations(RecommendationType='SOME_TYPE') # Example
# print(response)
print("Client successfully initialized with type hints.")
print(f"Client type: {type(client)}")
except Exception as e:
print(f"An error occurred: {e}")
print("Please ensure 'boto3' is installed and AWS credentials are configured.")