Skip to content

Examples#

Index > StorageGateway > Examples

Auto-generated documentation for StorageGateway type annotations stubs module types-aiobotocore-storagegateway.

Client#

Implicit type annotations#

Can be used with types-aiobotocore[storagegateway] package installed.

Write your StorageGateway code as usual, type checking and code completion should work out of the box.

# StorageGatewayClient usage example

from aiobotocore.session import get_session


session = get_session()

async with session.create_client("storagegateway") as client:  # (1)
    result = await client.activate_gateway()  # (2)
  1. client: StorageGatewayClient
  2. result: ActivateGatewayOutputTypeDef
# DescribeTapeArchivesPaginator usage example

from aiobotocore.session import get_session


session = get_session()

async with session.create_client("storagegateway") as client:  # (1)
    paginator = client.get_paginator("describe_tape_archives")  # (2)
    async for item in paginator.paginate(...):
        print(item)  # (3)
  1. client: StorageGatewayClient
  2. paginator: DescribeTapeArchivesPaginator
  3. item: DescribeTapeArchivesOutputTypeDef

Explicit type annotations#

With types-aiobotocore-lite[storagegateway] or a standalone types_aiobotocore_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 aiobotocore.session import get_session

from types_aiobotocore_storagegateway.client import StorageGatewayClient
from types_aiobotocore_storagegateway.type_defs import ActivateGatewayOutputTypeDef
from types_aiobotocore_storagegateway.type_defs import ActivateGatewayInputRequestTypeDef


session = get_session()

async with session.create_client("storagegateway") as client:
    client: StorageGatewayClient
    kwargs: ActivateGatewayInputRequestTypeDef = {...}
    result: ActivateGatewayOutputTypeDef = await client.activate_gateway(**kwargs)
# DescribeTapeArchivesPaginator usage example with type annotations

from aiobotocore.session import get_session

from types_aiobotocore_storagegateway.client import StorageGatewayClient
from types_aiobotocore_storagegateway.paginator import DescribeTapeArchivesPaginator
from types_aiobotocore_storagegateway.type_defs import DescribeTapeArchivesOutputTypeDef


session = get_session()

async with session.create_client("storagegateway") as client:
    client: StorageGatewayClient
    paginator: DescribeTapeArchivesPaginator = client.get_paginator("describe_tape_archives")
    async for item in paginator.paginate(...):
        item: DescribeTapeArchivesOutputTypeDef
        print(item)