Examples#
Auto-generated documentation for EKS type annotations stubs module mypy-boto3-eks.
Client#
Implicit type annotations#
Can be used with boto3-stubs[eks]
package installed.
Write your EKS
code as usual,
type checking and code completion should work out of the box.
# EKSClient usage example
from boto3.session import Session
session = Session()
client = session.client("eks") # (1)
result = client.associate_access_policy() # (2)
- client: EKSClient
- result: AssociateAccessPolicyResponseTypeDef
# DescribeAddonVersionsPaginator usage example
from boto3.session import Session
session = Session()
client = session.client("eks") # (1)
paginator = client.get_paginator("describe_addon_versions") # (2)
for item in paginator.paginate(...):
print(item) # (3)
- client: EKSClient
- paginator: DescribeAddonVersionsPaginator
- item: DescribeAddonVersionsResponseTypeDef
# AddonActiveWaiter usage example
from boto3.session import Session
session = Session()
client = session.client("eks") # (1)
waiter = client.get_waiter("addon_active") # (2)
waiter.wait()
- client: EKSClient
- waiter: AddonActiveWaiter
Explicit type annotations#
With boto3-stubs-lite[eks]
or a standalone mypy_boto3_eks
package, you have to explicitly specify client: EKSClient
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.
# EKSClient usage example with type annotations
from boto3.session import Session
from mypy_boto3_eks.client import EKSClient
from mypy_boto3_eks.type_defs import AssociateAccessPolicyResponseTypeDef
from mypy_boto3_eks.type_defs import AssociateAccessPolicyRequestRequestTypeDef
session = Session()
client: EKSClient = session.client("eks")
kwargs: AssociateAccessPolicyRequestRequestTypeDef = {...}
result: AssociateAccessPolicyResponseTypeDef = client.associate_access_policy(**kwargs)
# DescribeAddonVersionsPaginator usage example with type annotations
from boto3.session import Session
from mypy_boto3_eks.client import EKSClient
from mypy_boto3_eks.paginator import DescribeAddonVersionsPaginator
from mypy_boto3_eks.type_defs import DescribeAddonVersionsResponseTypeDef
session = Session()
client: EKSClient = session.client("eks")
paginator: DescribeAddonVersionsPaginator = client.get_paginator("describe_addon_versions")
for item in paginator.paginate(...):
item: DescribeAddonVersionsResponseTypeDef
print(item)
# AddonActiveWaiter usage example with type annotations
from boto3.session import Session
from mypy_boto3_eks.client import EKSClient
from mypy_boto3_eks.waiter import AddonActiveWaiter
session = Session()
client: EKSClient = session.client("eks")
waiter: AddonActiveWaiter = client.get_waiter("addon_active")
waiter.wait()