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