Skip to content

Examples#

Index > RAM > Examples

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

Client#

Implicit type annotations#

Can be used with types-boto3[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 types-boto3-lite[ram] or a standalone types_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 types_boto3_ram.client import RAMClient
from types_boto3_ram.type_defs import AcceptResourceShareInvitationResponseTypeDef
from types_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 types_boto3_ram.client import RAMClient
from types_boto3_ram.paginator import GetResourcePoliciesPaginator
from types_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)