Skip to content

Examples#

Index > RAM > Examples

Auto-generated documentation for RAM type annotations stubs module mypy-boto3-ram.

Client#

Implicit type annotations#

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

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

# RAMClient usage example

from boto3.session import Session


session = Session()

client = session.client("ram")  # (1)
result = client.accept_resource_share_invitation()  # (2)
  1. client: RAMClient
  2. result: AcceptResourceShareInvitationResponseTypeDef
# GetResourcePoliciesPaginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("get_resource_policies")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: RAMClient
  2. paginator: GetResourcePoliciesPaginator
  3. item: GetResourcePoliciesResponseTypeDef

Explicit type annotations#

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

# RAMClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_ram.client import RAMClient
from mypy_boto3_ram.type_defs import AcceptResourceShareInvitationResponseTypeDef
from mypy_boto3_ram.type_defs import AcceptResourceShareInvitationRequestRequestTypeDef


session = Session()

client: RAMClient = session.client("ram")

kwargs: AcceptResourceShareInvitationRequestRequestTypeDef = {...}
result: AcceptResourceShareInvitationResponseTypeDef = client.accept_resource_share_invitation(**kwargs)
# GetResourcePoliciesPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_ram.client import RAMClient
from mypy_boto3_ram.paginator import GetResourcePoliciesPaginator
from mypy_boto3_ram.type_defs import GetResourcePoliciesResponseTypeDef


session = Session()
client: RAMClient = session.client("ram")

paginator: GetResourcePoliciesPaginator = client.get_paginator("get_resource_policies")
for item in paginator.paginate(...):
    item: GetResourcePoliciesResponseTypeDef
    print(item)