mypy-boto3-fms Type Annotations for AWS FMS
mypy-boto3-fms provides type annotations for the AWS Firewall Manager (FMS) service client, paginators, and waiters, enhancing static analysis with tools like MyPy. It is part of the `mypy-boto3` family of projects, automatically generated by `mypy-boto3-builder`. The current version is 1.42.3, and it receives frequent updates to stay in sync with boto3 releases and `mypy-boto3-builder` improvements.
Warnings
- breaking Python 3.8 support was removed by `mypy-boto3-builder` starting from version 8.12.0. Projects using `mypy-boto3-fms` must now run on Python 3.9 or newer.
- gotcha This package provides type stubs for boto3, not a replacement. You must install `boto3` separately for runtime functionality. `mypy-boto3-fms` alone does not provide the AWS SDK.
- breaking `mypy-boto3-builder` version 8.9.0 introduced breaking changes in TypeDef naming conventions, affecting all generated services. TypeDefs for method arguments now use shorter names (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`).
- breaking `mypy-boto3-builder` 8.12.0 migrated all generated packages to PEP 561 compliant distribution. While generally an improvement for type checker discovery, users with highly customized `MYPYPATH` or build systems might need to adjust their configurations.
Install
-
pip install mypy-boto3-fms -
pip install boto3
Imports
- FMSClient
from mypy_boto3_fms import FMSClient
- FMSClient
from mypy_boto3_fms.client import FMSClient
- ListPoliciesPaginator
from mypy_boto3_fms.paginator import ListPoliciesPaginator
- PolicySummaryTypeDef
from mypy_boto3_fms.type_defs import PolicySummaryTypeDef
Quickstart
import boto3
from mypy_boto3_fms import FMSClient
import os
# Ensure boto3 is installed: pip install boto3
session = boto3.Session(
region_name=os.environ.get('AWS_REGION', 'us-east-1'),
aws_access_key_id=os.environ.get('AWS_ACCESS_KEY_ID', 'DUMMY_KEY'),
aws_secret_access_key=os.environ.get('AWS_SECRET_ACCESS_KEY', 'DUMMY_SECRET')
)
# The client object 'fms_client' will now have full type hints
fms_client: FMSClient = session.client('fms')
try:
# Example operation: List Admin Accounts
response = fms_client.list_admin_accounts()
print(f"FMS Admin Accounts: {response.get('AdminAccounts', [])}")
# Example with paginator
paginator = fms_client.get_paginator('list_policies')
for page in paginator.paginate():
for policy in page.get('PolicyList', []):
print(f"Policy: {policy.get('PolicyName')}")
except Exception as e:
print(f"Error performing FMS operation: {e}")