mypy-boto3-fms Type Annotations for AWS FMS

1.42.3 · active · verified Sat Apr 11

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

Install

Imports

Quickstart

This quickstart demonstrates how to obtain a type-hinted FMS client and perform basic operations using `mypy-boto3-fms` alongside `boto3`. It highlights how `FMSClient` annotations provide type safety for client calls and responses, including paginators.

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}")

view raw JSON →