Examples#
Index > DirectoryServiceData > Examples
Auto-generated documentation for DirectoryServiceData type annotations stubs module types-boto3-ds-data.
Client#
Implicit type annotations#
Can be used with types-boto3[ds-data]
package installed.
Write your DirectoryServiceData
code as usual,
type checking and code completion should work out of the box.
Client method usage example#
# DirectoryServiceDataClient usage example
from boto3.session import Session
session = Session()
client = session.client("ds-data") # (1)
result = client.create_group() # (2)
- client: DirectoryServiceDataClient
- result: CreateGroupResultTypeDef
Paginator usage example#
# ListGroupMembersPaginator usage example
from boto3.session import Session
session = Session()
client = session.client("ds-data") # (1)
paginator = client.get_paginator("list_group_members") # (2)
for item in paginator.paginate(...):
print(item) # (3)
- client: DirectoryServiceDataClient
- paginator: ListGroupMembersPaginator
- item: ListGroupMembersResultTypeDef
Explicit type annotations#
With types-boto3-lite[ds-data]
or a standalone types_boto3_ds_data
package, you have to explicitly specify client: DirectoryServiceDataClient
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#
# DirectoryServiceDataClient usage example with type annotations
from boto3.session import Session
from types_boto3_ds_data.client import DirectoryServiceDataClient
from types_boto3_ds_data.type_defs import CreateGroupResultTypeDef
from types_boto3_ds_data.type_defs import CreateGroupRequestTypeDef
session = Session()
client: DirectoryServiceDataClient = session.client("ds-data")
kwargs: CreateGroupRequestTypeDef = {...}
result: CreateGroupResultTypeDef = client.create_group(**kwargs)
Paginator usage example#
# ListGroupMembersPaginator usage example with type annotations
from boto3.session import Session
from types_boto3_ds_data.client import DirectoryServiceDataClient
from types_boto3_ds_data.paginator import ListGroupMembersPaginator
from types_boto3_ds_data.type_defs import ListGroupMembersResultTypeDef
session = Session()
client: DirectoryServiceDataClient = session.client("ds-data")
paginator: ListGroupMembersPaginator = client.get_paginator("list_group_members")
for item in paginator.paginate(...):
item: ListGroupMembersResultTypeDef
print(item)