Skip to content

Examples#

Index > SSOAdmin > Examples

Auto-generated documentation for SSOAdmin type annotations stubs module mypy-boto3-sso-admin.

Client#

Implicit type annotations#

Can be used with boto3-stubs[sso-admin] package installed.

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

# SSOAdminClient usage example

from boto3.session import Session


session = Session()

client = session.client("sso-admin")  # (1)
result = client.create_account_assignment()  # (2)
  1. client: SSOAdminClient
  2. result: CreateAccountAssignmentResponseTypeDef
# ListAccountAssignmentCreationStatusPaginator usage example

from boto3.session import Session


session = Session()
client = session.client("sso-admin")  # (1)

paginator = client.get_paginator("list_account_assignment_creation_status")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: SSOAdminClient
  2. paginator: ListAccountAssignmentCreationStatusPaginator
  3. item: ListAccountAssignmentCreationStatusResponseTypeDef

Explicit type annotations#

With boto3-stubs-lite[sso-admin] or a standalone mypy_boto3_sso_admin package, you have to explicitly specify client: SSOAdminClient 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.

# SSOAdminClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_sso_admin.client import SSOAdminClient
from mypy_boto3_sso_admin.type_defs import CreateAccountAssignmentResponseTypeDef
from mypy_boto3_sso_admin.type_defs import CreateAccountAssignmentRequestRequestTypeDef


session = Session()

client: SSOAdminClient = session.client("sso-admin")

kwargs: CreateAccountAssignmentRequestRequestTypeDef = {...}
result: CreateAccountAssignmentResponseTypeDef = client.create_account_assignment(**kwargs)
# ListAccountAssignmentCreationStatusPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_sso_admin.client import SSOAdminClient
from mypy_boto3_sso_admin.paginator import ListAccountAssignmentCreationStatusPaginator
from mypy_boto3_sso_admin.type_defs import ListAccountAssignmentCreationStatusResponseTypeDef


session = Session()
client: SSOAdminClient = session.client("sso-admin")

paginator: ListAccountAssignmentCreationStatusPaginator = client.get_paginator("list_account_assignment_creation_status")
for item in paginator.paginate(...):
    item: ListAccountAssignmentCreationStatusResponseTypeDef
    print(item)