Skip to content

IAMClient#

Index > IAM > IAMClient

Auto-generated documentation for IAM type annotations stubs module mypy-boto3-iam.

IAMClient#

Type annotations and code completion for boto3.client("iam"). boto3 documentation

# IAMClient usage example

from boto3.session import Session
from mypy_boto3_iam.client import IAMClient

def get_iam_client() -> IAMClient:
    return Session().client("iam")

Exceptions#

boto3 client exceptions are generated in runtime. This class provides code completion for boto3.client("iam").exceptions structure.

# Exceptions.exceptions usage example

client = boto3.client("iam")

try:
    do_something(client)
except (
    client.exceptions.ClientError,
    client.exceptions.ConcurrentModificationException,
    client.exceptions.CredentialReportExpiredException,
    client.exceptions.CredentialReportNotPresentException,
    client.exceptions.CredentialReportNotReadyException,
    client.exceptions.DeleteConflictException,
    client.exceptions.DuplicateCertificateException,
    client.exceptions.DuplicateSSHPublicKeyException,
    client.exceptions.EntityAlreadyExistsException,
    client.exceptions.EntityTemporarilyUnmodifiableException,
    client.exceptions.InvalidAuthenticationCodeException,
    client.exceptions.InvalidCertificateException,
    client.exceptions.InvalidInputException,
    client.exceptions.InvalidPublicKeyException,
    client.exceptions.InvalidUserTypeException,
    client.exceptions.KeyPairMismatchException,
    client.exceptions.LimitExceededException,
    client.exceptions.MalformedCertificateException,
    client.exceptions.MalformedPolicyDocumentException,
    client.exceptions.NoSuchEntityException,
    client.exceptions.PasswordPolicyViolationException,
    client.exceptions.PolicyEvaluationException,
    client.exceptions.PolicyNotAttachableException,
    client.exceptions.ReportGenerationLimitExceededException,
    client.exceptions.ServiceFailureException,
    client.exceptions.ServiceNotSupportedException,
    client.exceptions.UnmodifiableEntityException,
    client.exceptions.UnrecognizedPublicKeyEncodingException,
) as e:
    print(e)
# Exceptions.exceptions type checking example

from mypy_boto3_iam.client import Exceptions

def handle_error(exc: Exceptions.ClientError) -> None:
    ...

Methods#

add_client_id_to_open_id_connect_provider#

Adds a new client ID (also known as audience) to the list of client IDs already registered for the specified IAM OpenID Connect (OIDC) provider resource.

Type annotations and code completion for boto3.client("iam").add_client_id_to_open_id_connect_provider method. boto3 documentation

# add_client_id_to_open_id_connect_provider method definition

def add_client_id_to_open_id_connect_provider(
    self,
    *,
    OpenIDConnectProviderArn: str,
    ClientID: str,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
# add_client_id_to_open_id_connect_provider method usage example with argument unpacking

kwargs: AddClientIDToOpenIDConnectProviderRequestRequestTypeDef = {  # (1)
    "OpenIDConnectProviderArn": ...,
    "ClientID": ...,
}

parent.add_client_id_to_open_id_connect_provider(**kwargs)
  1. See AddClientIDToOpenIDConnectProviderRequestRequestTypeDef

add_role_to_instance_profile#

Adds the specified IAM role to the specified instance profile.

Type annotations and code completion for boto3.client("iam").add_role_to_instance_profile method. boto3 documentation

# add_role_to_instance_profile method definition

def add_role_to_instance_profile(
    self,
    *,
    InstanceProfileName: str,
    RoleName: str,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
# add_role_to_instance_profile method usage example with argument unpacking

kwargs: AddRoleToInstanceProfileRequestRequestTypeDef = {  # (1)
    "InstanceProfileName": ...,
    "RoleName": ...,
}

parent.add_role_to_instance_profile(**kwargs)
  1. See AddRoleToInstanceProfileRequestRequestTypeDef

add_user_to_group#

Adds the specified user to the specified group.

Type annotations and code completion for boto3.client("iam").add_user_to_group method. boto3 documentation

# add_user_to_group method definition

def add_user_to_group(
    self,
    *,
    GroupName: str,
    UserName: str,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
# add_user_to_group method usage example with argument unpacking

kwargs: AddUserToGroupRequestRequestTypeDef = {  # (1)
    "GroupName": ...,
    "UserName": ...,
}

parent.add_user_to_group(**kwargs)
  1. See AddUserToGroupRequestRequestTypeDef

attach_group_policy#

Attaches the specified managed policy to the specified IAM group.

Type annotations and code completion for boto3.client("iam").attach_group_policy method. boto3 documentation

# attach_group_policy method definition

def attach_group_policy(
    self,
    *,
    GroupName: str,
    PolicyArn: str,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
# attach_group_policy method usage example with argument unpacking

kwargs: AttachGroupPolicyRequestRequestTypeDef = {  # (1)
    "GroupName": ...,
    "PolicyArn": ...,
}

parent.attach_group_policy(**kwargs)
  1. See AttachGroupPolicyRequestRequestTypeDef

attach_role_policy#

Attaches the specified managed policy to the specified IAM role.

Type annotations and code completion for boto3.client("iam").attach_role_policy method. boto3 documentation

# attach_role_policy method definition

def attach_role_policy(
    self,
    *,
    RoleName: str,
    PolicyArn: str,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
# attach_role_policy method usage example with argument unpacking

kwargs: AttachRolePolicyRequestRequestTypeDef = {  # (1)
    "RoleName": ...,
    "PolicyArn": ...,
}

parent.attach_role_policy(**kwargs)
  1. See AttachRolePolicyRequestRequestTypeDef

attach_user_policy#

Attaches the specified managed policy to the specified user.

Type annotations and code completion for boto3.client("iam").attach_user_policy method. boto3 documentation

# attach_user_policy method definition

def attach_user_policy(
    self,
    *,
    UserName: str,
    PolicyArn: str,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
# attach_user_policy method usage example with argument unpacking

kwargs: AttachUserPolicyRequestRequestTypeDef = {  # (1)
    "UserName": ...,
    "PolicyArn": ...,
}

parent.attach_user_policy(**kwargs)
  1. See AttachUserPolicyRequestRequestTypeDef

can_paginate#

Check if an operation can be paginated.

Type annotations and code completion for boto3.client("iam").can_paginate method. boto3 documentation

# can_paginate method definition

def can_paginate(
    self,
    operation_name: str,
) -> bool:
    ...

change_password#

Changes the password of the IAM user who is calling this operation.

Type annotations and code completion for boto3.client("iam").change_password method.