Type annotations for boto3 IoTSecureTunneling
mypy-boto3-iotsecuretunneling provides type annotations (type stubs) for the `boto3` client for AWS IoTSecureTunneling service. It enhances static analysis for `boto3` usage, allowing tools like MyPy to catch type-related errors before runtime. The current version is 1.42.3, generated by `mypy-boto3-builder` and generally follows the release cadence of new `boto3` features or builder updates.
Warnings
- breaking Support for Python 3.8 was officially removed with `mypy-boto3-builder` version 8.12.0 (and subsequent `mypy-boto3-*` package releases). If you are using Python 3.8, you must upgrade to Python 3.9 or newer to receive the latest type stubs.
- gotcha Type stubs are version-locked to the `boto3` library. Mismatched versions between `mypy-boto3-iotsecuretunneling` and `boto3` can lead to incorrect type hints or unresolved attributes, as the AWS API might have changed. Always ensure your `boto3` version broadly aligns with your `mypy-boto3-*` stub version.
- gotcha `mypy-boto3-iotsecuretunneling` is a *type stub* package, not a runtime dependency. It should be installed as a development dependency or for type checking environments only. Installing it directly in your production runtime environment unnecessarily increases the package count and has no runtime effect.
Install
-
pip install mypy-boto3-iotsecuretunneling
Imports
- IoTSecureTunnelingClient
from mypy_boto3_iotsecuretunneling.client import IoTSecureTunnelingClient
- IoTSecureTunnelingServiceResource
from mypy_boto3_iotsecuretunneling.service_resource import IoTSecureTunnelingServiceResource
- IoTSecureTunnelingClientTypeDef
from mypy_boto3_iotsecuretunneling.type_defs import IoTSecureTunnelingClientTypeDef
Quickstart
import boto3
from mypy_boto3_iotsecuretunneling.client import IoTSecureTunnelingClient
from typing import TYPE_CHECKING
# In a real application, you'd configure AWS credentials
# e.g., via environment variables, ~/.aws/credentials, etc.
# Using TYPE_CHECKING to ensure the type hint is only active during static analysis
if TYPE_CHECKING:
# This line ensures 'client' gets the correct type for static analysis
client: IoTSecureTunnelingClient = boto3.client("iotsecuretunneling")
else:
# This line runs at runtime, creating the actual boto3 client
client = boto3.client("iotsecuretunneling")
# Now, 'client' will have methods and attributes type-hinted by mypy-boto3-iotsecuretunneling
# For example, calling open_tunnel:
try:
response = client.open_tunnel(
Description="MyTestTunnel",
Tags=[
{"key": "Project", "value": "MyApplication"},
{"key": "Environment", "value": "Development"}
]
)
print(f"Successfully opened tunnel. ARN: {response['tunnelArn']}")
print(f"Source Access Token: {response['sourceAccessToken']}")
print(f"Destination Access Token: {response['destinationAccessToken']}")
# Example of a type-hinted response structure
# if TYPE_CHECKING:
# tunnel_arn: str = response['tunnelArn']
except client.exceptions.ResourceNotFoundException as e:
print(f"Error: {e}")
except Exception as e:
print(f"An unexpected error occurred: {e}")