Skip to main content

Type annotations for boto3.IAM 1.14.8 service, generated by mypy-boto3-buider 2.2.0

Project description

mypy-boto3-iam

PyPI - mypy-boto3-iam PyPI - Python Version Docs

Type annotations for boto3.IAM 1.14.8 service compatible with mypy, VSCode, PyCharm and other tools.

Generated by mypy-boto3-buider 2.2.0.

More information can be found on boto3-stubs page.

How to install

Make sure you have mypy installed and activated in your IDE.

Install boto3-stubs for IAM service.

python -m pip install boto3-stubs[iam]

How to use

Client annotations

IAMClient provides annotations for boto3.client("iam").

import boto3

from mypy_boto3_iam import IAMClient, IAMServiceResource
from mypy_boto3_iam.paginator import (
    GetAccountAuthorizationDetailsPaginator,
    GetGroupPaginator,
    ListAccessKeysPaginator,
    ListAccountAliasesPaginator,
    ListAttachedGroupPoliciesPaginator,
    ListAttachedRolePoliciesPaginator,
    ListAttachedUserPoliciesPaginator,
    ListEntitiesForPolicyPaginator,
    ListGroupPoliciesPaginator,
    ListGroupsForUserPaginator,
    ListGroupsPaginator,
    ListInstanceProfilesForRolePaginator,
    ListInstanceProfilesPaginator,
    ListMFADevicesPaginator,
    ListPoliciesPaginator,
    ListPolicyVersionsPaginator,
    ListRolePoliciesPaginator,
    ListRolesPaginator,
    ListServerCertificatesPaginator,
    ListSigningCertificatesPaginator,
    ListSSHPublicKeysPaginator,
    ListUserPoliciesPaginator,
    ListUsersPaginator,
    ListVirtualMFADevicesPaginator,
    SimulateCustomPolicyPaginator,
    SimulatePrincipalPolicyPaginator,
)
from mypy_boto3_iam.service_resource import (
    AccessKey,
    AccessKeyPair,
    AccountPasswordPolicy,
    AccountSummary,
    AssumeRolePolicy,
    CurrentUser,
    Group,
    GroupPolicy,
    InstanceProfile,
    LoginProfile,
    MfaDevice,
    Policy,
    PolicyVersion,
    Role,
    RolePolicy,
    SamlProvider,
    ServerCertificate,
    ServiceResourceGroupsCollection,
    ServiceResourceInstanceProfilesCollection,
    ServiceResourcePoliciesCollection,
    ServiceResourceRolesCollection,
    ServiceResourceSamlProvidersCollection,
    ServiceResourceServerCertificatesCollection,
    ServiceResourceUsersCollection,
    ServiceResourceVirtualMfaDevicesCollection,
    SigningCertificate,
    User,
    UserPolicy,
    VirtualMfaDevice,
)
from mypy_boto3_iam.type_defs import AccessDetailTypeDef, ...
from mypy_boto3_iam.waiter import (
    InstanceProfileExistsWaiter,
    PolicyExistsWaiter,
    RoleExistsWaiter,
    UserExistsWaiter,
)

client: IAMClient = boto3.client("iam")

# now client usage is checked by mypy and IDE should provide code auto-complete

# works for session as well
session = boto3.session.Session(region="us-west-1")
session_client: IAMClient = session.client("iam")

Paginators annotations

mypy_boto3_iam.paginator module contains type annotations for all paginators.

client: IAMClient = boto3.client("iam")

# Explicit type annotations are optional here
# Type should be correctly discovered by mypy and IDEs
# VSCode requires explicit type annotations
get_account_authorization_details_paginator: GetAccountAuthorizationDetailsPaginator = client.get_paginator("get_account_authorization_details")
get_group_paginator: GetGroupPaginator = client.get_paginator("get_group")
list_access_keys_paginator: ListAccessKeysPaginator = client.get_paginator("list_access_keys")
list_account_aliases_paginator: ListAccountAliasesPaginator = client.get_paginator("list_account_aliases")
list_attached_group_policies_paginator: ListAttachedGroupPoliciesPaginator = client.get_paginator("list_attached_group_policies")
list_attached_role_policies_paginator: ListAttachedRolePoliciesPaginator = client.get_paginator("list_attached_role_policies")
list_attached_user_policies_paginator: ListAttachedUserPoliciesPaginator = client.get_paginator("list_attached_user_policies")
list_entities_for_policy_paginator: ListEntitiesForPolicyPaginator = client.get_paginator("list_entities_for_policy")
list_group_policies_paginator: ListGroupPoliciesPaginator = client.get_paginator("list_group_policies")
list_groups_paginator: ListGroupsPaginator = client.get_paginator("list_groups")
list_groups_for_user_paginator: ListGroupsForUserPaginator = client.get_paginator("list_groups_for_user")
list_instance_profiles_paginator: ListInstanceProfilesPaginator = client.get_paginator("list_instance_profiles")
list_instance_profiles_for_role_paginator: ListInstanceProfilesForRolePaginator = client.get_paginator("list_instance_profiles_for_role")
list_mfa_devices_paginator: ListMFADevicesPaginator = client.get_paginator("list_mfa_devices")
list_policies_paginator: ListPoliciesPaginator = client.get_paginator("list_policies")
list_policy_versions_paginator: ListPolicyVersionsPaginator = client.get_paginator("list_policy_versions")
list_role_policies_paginator: ListRolePoliciesPaginator = client.get_paginator("list_role_policies")
list_roles_paginator: ListRolesPaginator = client.get_paginator("list_roles")
list_ssh_public_keys_paginator: ListSSHPublicKeysPaginator = client.get_paginator("list_ssh_public_keys")
list_server_certificates_paginator: ListServerCertificatesPaginator = client.get_paginator("list_server_certificates")
list_signing_certificates_paginator: ListSigningCertificatesPaginator = client.get_paginator("list_signing_certificates")
list_user_policies_paginator: ListUserPoliciesPaginator = client.get_paginator("list_user_policies")
list_users_paginator: ListUsersPaginator = client.get_paginator("list_users")
list_virtual_mfa_devices_paginator: ListVirtualMFADevicesPaginator = client.get_paginator("list_virtual_mfa_devices")
simulate_custom_policy_paginator: SimulateCustomPolicyPaginator = client.get_paginator("simulate_custom_policy")
simulate_principal_policy_paginator: SimulatePrincipalPolicyPaginator = client.get_paginator("simulate_principal_policy")

Waiters annotations

mypy_boto3_iam.waiter module contains type annotations for all waiters.

client: IAMClient = boto3.client("iam")

# Explicit type annotations are optional here
# Type should be correctly discovered by mypy and IDEs
# VSCode requires explicit type annotations
instance_profile_exists_waiter: InstanceProfileExistsWaiter = client.get_waiter("instance_profile_exists")
policy_exists_waiter: PolicyExistsWaiter = client.get_waiter("policy_exists")
role_exists_waiter: RoleExistsWaiter = client.get_waiter("role_exists")
user_exists_waiter: UserExistsWaiter = client.get_waiter("user_exists")

Service Resource annotations

IAMServiceResource provides annotations for boto3.resource("iam").

resource: IAMServiceResource = boto3.resource("iam")

# now resource usage is checked by mypy and IDE should provide code auto-complete

# works for session as well
session = boto3.session.Session(region="us-west-1")
session_resource: IAMServiceResource = session.resource("iam")

Other resources annotations

mypy_boto3_iam.service_resource module contains type annotations for all resources.

resource: IAMServiceResource = boto3.resource("iam")

# Explicit type annotations are optional here
# Type should be correctly discovered by mypy and IDEs
my_access_key: AccessKey = resource.AccessKey(...)
my_access_key_pair: AccessKeyPair = resource.AccessKeyPair(...)
my_account_password_policy: AccountPasswordPolicy = resource.AccountPasswordPolicy(...)
my_account_summary: AccountSummary = resource.AccountSummary(...)
my_assume_role_policy: AssumeRolePolicy = resource.AssumeRolePolicy(...)
my_current_user: CurrentUser = resource.CurrentUser(...)
my_group: Group = resource.Group(...)
my_group_policy: GroupPolicy = resource.GroupPolicy(...)
my_instance_profile: InstanceProfile = resource.InstanceProfile(...)
my_login_profile: LoginProfile = resource.LoginProfile(...)
my_mfa_device: MfaDevice = resource.MfaDevice(...)
my_policy: Policy = resource.Policy(...)
my_policy_version: PolicyVersion = resource.PolicyVersion(...)
my_role: Role = resource.Role(...)
my_role_policy: RolePolicy = resource.RolePolicy(...)
my_saml_provider: SamlProvider = resource.SamlProvider(...)
my_server_certificate: ServerCertificate = resource.ServerCertificate(...)
my_signing_certificate: SigningCertificate = resource.SigningCertificate(...)
my_user: User = resource.User(...)
my_user_policy: UserPolicy = resource.UserPolicy(...)
my_virtual_mfa_device: VirtualMfaDevice = resource.VirtualMfaDevice(...)

Collections annotations

mypy_boto3_iam.service_resource module contains type annotations for all IAMServiceResource collections.

resource: IAMServiceResource = boto3.resource("iam")

# Explicit type annotations are optional here
# Type should be correctly discovered by mypy and IDEs
groups: iam_resources.ServiceResourceGroupsCollection = resource.groups
instance_profiles: iam_resources.ServiceResourceInstanceProfilesCollection = resource.instance_profiles
policies: iam_resources.ServiceResourcePoliciesCollection = resource.policies
roles: iam_resources.ServiceResourceRolesCollection = resource.roles
saml_providers: iam_resources.ServiceResourceSamlProvidersCollection = resource.saml_providers
server_certificates: iam_resources.ServiceResourceServerCertificatesCollection = resource.server_certificates
users: iam_resources.ServiceResourceUsersCollection = resource.users
virtual_mfa_devices: iam_resources.ServiceResourceVirtualMfaDevicesCollection = resource.virtual_mfa_devices

Typed dictionations

mypy_boto3_iam.type_defs module contains structures and shapes assembled to typed dictionaries for additional type checking.

def get_structure() -> AccessDetailTypeDef:
    return {
      ...
    }

Dynamic type annotations

mypy_boto3 command generates boto3.client/resource type annotations for mypy_boto3_iam and other installed services.

# Run this command after you add or remove service packages
python -m mypy_boto3

Generated type annotations provide overloads for boto3.client and boto3.resource, boto3.Session.client and boto3.Session.resource functions, so explicit type annotations are not needed.

  • mypy supports function overloads as expected
  • PyCharm also supports function overloads, but consumes a lot of RAM, use carefully if you have many services installed
  • VSCode does not currently support function overloads, use explicit type annotations
# Type is discovered correctly by mypy and PyCharm
# VSCode still needs explicit type annotations
client = boto3.client("iam")
resource = boto3.resource("iam")

session_client = boto3.Session().client("iam")
session_resource = boto3.Session().resource("iam")

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mypy-boto3-iam-1.14.8.0.tar.gz (28.4 kB view hashes)

Uploaded Source

Built Distribution

mypy_boto3_iam-1.14.8.0-py3-none-any.whl (27.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page