Skip to content

Examples#

Index > BackupGateway > Examples

Auto-generated documentation for BackupGateway type annotations stubs module types-boto3-backup-gateway.

Client#

Implicit type annotations#

Can be used with types-boto3[backup-gateway] package installed.

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

# BackupGatewayClient usage example

from boto3.session import Session


session = Session()

client = session.client("backup-gateway")  # (1)
result = client.associate_gateway_to_server()  # (2)
  1. client: BackupGatewayClient
  2. result: AssociateGatewayToServerOutputTypeDef
# ListGatewaysPaginator usage example

from boto3.session import Session


session = Session()
client = session.client("backup-gateway")  # (1)

paginator = client.get_paginator("list_gateways")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: BackupGatewayClient
  2. paginator: ListGatewaysPaginator
  3. item: ListGatewaysOutputTypeDef

Explicit type annotations#

With types-boto3-lite[backup-gateway] or a standalone types_boto3_backup_gateway package, you have to explicitly specify client: BackupGatewayClient 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.

# BackupGatewayClient usage example with type annotations

from boto3.session import Session

from types_boto3_backup_gateway.client import BackupGatewayClient
from types_boto3_backup_gateway.type_defs import AssociateGatewayToServerOutputTypeDef
from types_boto3_backup_gateway.type_defs import AssociateGatewayToServerInputRequestTypeDef


session = Session()

client: BackupGatewayClient = session.client("backup-gateway")

kwargs: AssociateGatewayToServerInputRequestTypeDef = {...}
result: AssociateGatewayToServerOutputTypeDef = client.associate_gateway_to_server(**kwargs)
# ListGatewaysPaginator usage example with type annotations

from boto3.session import Session

from types_boto3_backup_gateway.client import BackupGatewayClient
from types_boto3_backup_gateway.paginator import ListGatewaysPaginator
from types_boto3_backup_gateway.type_defs import ListGatewaysOutputTypeDef


session = Session()
client: BackupGatewayClient = session.client("backup-gateway")

paginator: ListGatewaysPaginator = client.get_paginator("list_gateways")
for item in paginator.paginate(...):
    item: ListGatewaysOutputTypeDef
    print(item)