Skip to content

Examples#

Index > RedshiftServerless > Examples

Auto-generated documentation for RedshiftServerless type annotations stubs module types-boto3-redshift-serverless.

Client#

Implicit type annotations#

Can be used with types-boto3[redshift-serverless] package installed.

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

Client method usage example#

# RedshiftServerlessClient usage example

from boto3.session import Session


session = Session()

client = session.client("redshift-serverless")  # (1)
result = client.convert_recovery_point_to_snapshot()  # (2)
  1. client: RedshiftServerlessClient
  2. result: ConvertRecoveryPointToSnapshotResponseTypeDef

Paginator usage example#

# ListCustomDomainAssociationsPaginator usage example

from boto3.session import Session


session = Session()
client = session.client("redshift-serverless")  # (1)

paginator = client.get_paginator("list_custom_domain_associations")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: RedshiftServerlessClient
  2. paginator: ListCustomDomainAssociationsPaginator
  3. item: ListCustomDomainAssociationsResponseTypeDef

Explicit type annotations#

With types-boto3-lite[redshift-serverless] or a standalone types_boto3_redshift_serverless package, you have to explicitly specify client: RedshiftServerlessClient 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.

Client method usage example#

# RedshiftServerlessClient usage example with type annotations

from boto3.session import Session

from types_boto3_redshift_serverless.client import RedshiftServerlessClient
from types_boto3_redshift_serverless.type_defs import ConvertRecoveryPointToSnapshotResponseTypeDef
from types_boto3_redshift_serverless.type_defs import ConvertRecoveryPointToSnapshotRequestTypeDef


session = Session()

client: RedshiftServerlessClient = session.client("redshift-serverless")

kwargs: ConvertRecoveryPointToSnapshotRequestTypeDef = {...}
result: ConvertRecoveryPointToSnapshotResponseTypeDef = client.convert_recovery_point_to_snapshot(**kwargs)

Paginator usage example#

# ListCustomDomainAssociationsPaginator usage example with type annotations

from boto3.session import Session

from types_boto3_redshift_serverless.client import RedshiftServerlessClient
from types_boto3_redshift_serverless.paginator import ListCustomDomainAssociationsPaginator
from types_boto3_redshift_serverless.type_defs import ListCustomDomainAssociationsResponseTypeDef


session = Session()
client: RedshiftServerlessClient = session.client("redshift-serverless")

paginator: ListCustomDomainAssociationsPaginator = client.get_paginator("list_custom_domain_associations")
for item in paginator.paginate(...):
    item: ListCustomDomainAssociationsResponseTypeDef
    print(item)