Skip to content

Examples#

Index > DataSync > Examples

Auto-generated documentation for DataSync type annotations stubs module types-aiobotocore-datasync.

Client#

Implicit type annotations#

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

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

# DataSyncClient usage example

from aiobotocore.session import get_session


session = get_session()

async with session.create_client("datasync") as client:  # (1)
    result = await client.add_storage_system()  # (2)
  1. client: DataSyncClient
  2. result: AddStorageSystemResponseTypeDef
# DescribeStorageSystemResourceMetricsPaginator usage example

from aiobotocore.session import get_session


session = get_session()

async with session.create_client("datasync") as client:  # (1)
    paginator = client.get_paginator("describe_storage_system_resource_metrics")  # (2)
    async for item in paginator.paginate(...):
        print(item)  # (3)
  1. client: DataSyncClient
  2. paginator: DescribeStorageSystemResourceMetricsPaginator
  3. item: DescribeStorageSystemResourceMetricsResponseTypeDef

Explicit type annotations#

With types-aiobotocore-lite[datasync] or a standalone types_aiobotocore_datasync package, you have to explicitly specify client: DataSyncClient 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.

# DataSyncClient usage example with type annotations

from aiobotocore.session import get_session

from types_aiobotocore_datasync.client import DataSyncClient
from types_aiobotocore_datasync.type_defs import AddStorageSystemResponseTypeDef
from types_aiobotocore_datasync.type_defs import AddStorageSystemRequestRequestTypeDef


session = get_session()

async with session.create_client("datasync") as client:
    client: DataSyncClient
    kwargs: AddStorageSystemRequestRequestTypeDef = {...}
    result: AddStorageSystemResponseTypeDef = await client.add_storage_system(**kwargs)
# DescribeStorageSystemResourceMetricsPaginator usage example with type annotations

from aiobotocore.session import get_session

from types_aiobotocore_datasync.client import DataSyncClient
from types_aiobotocore_datasync.paginator import DescribeStorageSystemResourceMetricsPaginator
from types_aiobotocore_datasync.type_defs import DescribeStorageSystemResourceMetricsResponseTypeDef


session = get_session()

async with session.create_client("datasync") as client:
    client: DataSyncClient
    paginator: DescribeStorageSystemResourceMetricsPaginator = client.get_paginator("describe_storage_system_resource_metrics")
    async for item in paginator.paginate(...):
        item: DescribeStorageSystemResourceMetricsResponseTypeDef
        print(item)