Skip to content

Examples#

Index > SecurityLake > Examples

Auto-generated documentation for SecurityLake type annotations stubs module mypy-boto3-securitylake.

Client#

Implicit type annotations#

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

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

# SecurityLakeClient usage example

from boto3.session import Session


session = Session()

client = session.client("securitylake")  # (1)
result = client.create_aws_log_source()  # (2)
  1. client: SecurityLakeClient
  2. result: CreateAwsLogSourceResponseTypeDef
# GetDataLakeSourcesPaginator usage example

from boto3.session import Session


session = Session()
client = session.client("securitylake")  # (1)

paginator = client.get_paginator("get_data_lake_sources")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: SecurityLakeClient
  2. paginator: GetDataLakeSourcesPaginator
  3. item: GetDataLakeSourcesResponseTypeDef

Explicit type annotations#

With boto3-stubs-lite[securitylake] or a standalone mypy_boto3_securitylake package, you have to explicitly specify client: SecurityLakeClient 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.

# SecurityLakeClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_securitylake.client import SecurityLakeClient
from mypy_boto3_securitylake.type_defs import CreateAwsLogSourceResponseTypeDef
from mypy_boto3_securitylake.type_defs import CreateAwsLogSourceRequestRequestTypeDef


session = Session()

client: SecurityLakeClient = session.client("securitylake")

kwargs: CreateAwsLogSourceRequestRequestTypeDef = {...}
result: CreateAwsLogSourceResponseTypeDef = client.create_aws_log_source(**kwargs)
# GetDataLakeSourcesPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_securitylake.client import SecurityLakeClient
from mypy_boto3_securitylake.paginator import GetDataLakeSourcesPaginator
from mypy_boto3_securitylake.type_defs import GetDataLakeSourcesResponseTypeDef


session = Session()
client: SecurityLakeClient = session.client("securitylake")

paginator: GetDataLakeSourcesPaginator = client.get_paginator("get_data_lake_sources")
for item in paginator.paginate(...):
    item: GetDataLakeSourcesResponseTypeDef
    print(item)