Examples#
Index > OpsWorksCM > Examples
Auto-generated documentation for OpsWorksCM type annotations stubs module mypy-boto3-opsworkscm.
Client#
Implicit type annotations#
Can be used with boto3-stubs[opsworkscm]
package installed.
Write your OpsWorksCM
code as usual,
type checking and code completion should work out of the box.
Client method usage example#
# OpsWorksCMClient usage example
from boto3.session import Session
session = Session()
client = session.client("opsworkscm") # (1)
result = client.associate_node() # (2)
- client: OpsWorksCMClient
- result: AssociateNodeResponseTypeDef
Paginator usage example#
# DescribeBackupsPaginator usage example
from boto3.session import Session
session = Session()
client = session.client("opsworkscm") # (1)
paginator = client.get_paginator("describe_backups") # (2)
for item in paginator.paginate(...):
print(item) # (3)
- client: OpsWorksCMClient
- paginator: DescribeBackupsPaginator
- item: DescribeBackupsResponseTypeDef
Waiter usage example#
# NodeAssociatedWaiter usage example
from boto3.session import Session
session = Session()
client = session.client("opsworkscm") # (1)
waiter = client.get_waiter("node_associated") # (2)
waiter.wait(...)
- client: OpsWorksCMClient
- waiter: NodeAssociatedWaiter
Explicit type annotations#
With boto3-stubs-lite[opsworkscm]
or a standalone mypy_boto3_opsworkscm
package, you have to explicitly specify client: OpsWorksCMClient
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#
# OpsWorksCMClient usage example with type annotations
from boto3.session import Session
from mypy_boto3_opsworkscm.client import OpsWorksCMClient
from mypy_boto3_opsworkscm.type_defs import AssociateNodeResponseTypeDef
from mypy_boto3_opsworkscm.type_defs import AssociateNodeRequestTypeDef
session = Session()
client: OpsWorksCMClient = session.client("opsworkscm")
kwargs: AssociateNodeRequestTypeDef = {...}
result: AssociateNodeResponseTypeDef = client.associate_node(**kwargs)
Paginator usage example#
# DescribeBackupsPaginator usage example with type annotations
from boto3.session import Session
from mypy_boto3_opsworkscm.client import OpsWorksCMClient
from mypy_boto3_opsworkscm.paginator import DescribeBackupsPaginator
from mypy_boto3_opsworkscm.type_defs import DescribeBackupsResponseTypeDef
session = Session()
client: OpsWorksCMClient = session.client("opsworkscm")
paginator: DescribeBackupsPaginator = client.get_paginator("describe_backups")
for item in paginator.paginate(...):
item: DescribeBackupsResponseTypeDef
print(item)
Waiter usage example#
# NodeAssociatedWaiter usage example with type annotations
from boto3.session import Session
from mypy_boto3_opsworkscm.client import OpsWorksCMClient
from mypy_boto3_opsworkscm.waiter import NodeAssociatedWaiter
session = Session()
client: OpsWorksCMClient = session.client("opsworkscm")
waiter: NodeAssociatedWaiter = client.get_waiter("node_associated")
waiter.wait(...)