Examples#
Index > StorageGateway > Examples
Auto-generated documentation for StorageGateway type annotations stubs module mypy-boto3-storagegateway.
Client#
Implicit type annotations#
Can be used with boto3-stubs[storagegateway]
package installed.
Write your StorageGateway
code as usual,
type checking and code completion should work out of the box.
# StorageGatewayClient usage example
from boto3.session import Session
session = Session()
client = session.client("storagegateway") # (1)
result = client.activate_gateway() # (2)
- client: StorageGatewayClient
- result: ActivateGatewayOutputTypeDef
# DescribeTapeArchivesPaginator usage example
from boto3.session import Session
session = Session()
client = session.client("storagegateway") # (1)
paginator = client.get_paginator("describe_tape_archives") # (2)
for item in paginator.paginate(...):
print(item) # (3)
- client: StorageGatewayClient
- paginator: DescribeTapeArchivesPaginator
- item: DescribeTapeArchivesOutputTypeDef
Explicit type annotations#
With boto3-stubs-lite[storagegateway]
or a standalone mypy_boto3_storagegateway
package, you have to explicitly specify client: StorageGatewayClient
type annotation.
All other type annotations are optional, as types should be discovered automatically. However, these type annotations can be helpful in your functions and methods.
# StorageGatewayClient usage example with type annotations
from boto3.session import Session
from mypy_boto3_storagegateway.client import StorageGatewayClient
from mypy_boto3_storagegateway.type_defs import ActivateGatewayOutputTypeDef
from mypy_boto3_storagegateway.type_defs import ActivateGatewayInputRequestTypeDef
session = Session()
client: StorageGatewayClient = session.client("storagegateway")
kwargs: ActivateGatewayInputRequestTypeDef = {...}
result: ActivateGatewayOutputTypeDef = client.activate_gateway(**kwargs)
# DescribeTapeArchivesPaginator usage example with type annotations
from boto3.session import Session
from mypy_boto3_storagegateway.client import StorageGatewayClient
from mypy_boto3_storagegateway.paginator import DescribeTapeArchivesPaginator
from mypy_boto3_storagegateway.type_defs import DescribeTapeArchivesOutputTypeDef
session = Session()
client: StorageGatewayClient = session.client("storagegateway")
paginator: DescribeTapeArchivesPaginator = client.get_paginator("describe_tape_archives")
for item in paginator.paginate(...):
item: DescribeTapeArchivesOutputTypeDef
print(item)