Skip to content

untag_role async

untag_role(
    role_name: roleNameType,
    tag_keys: tagKeyListType,
    *,
    config_overrides: Optional[AsyncIAMClientConfig] = None,
) -> None

Removes the specified tags from the role. For more information about tagging, see Tagging IAM resources in the IAM User Guide.

Parameters:

  • role_name (roleNameType) –

    The name of the IAM role from which you want to remove tags.

    This parameter accepts (through its regex pattern) a string of characters that consist of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-

  • tag_keys (tagKeyListType) –

    A list of key names as a simple array of strings. The tags with matching keys are removed from the specified role.

Raises:

  • ConcurrentModificationException –

    The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.

  • NoSuchEntityException –

    The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.

  • ServiceFailureException –

    The request processing has failed because of an unknown error, exception or failure.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

To remove a tag from an IAM role The following example shows how to remove a tag with the key 'Dept' from a role named 'taggedrole'.

>>> await client.untag_role(role_name='taggedrole', tag_keys=['Dept'])
Source code in docs_src/capo_iam/_services/async_iam.py
async def untag_role(
    self,
    role_name: "capo_iam.types.role_name_type.roleNameType",
    tag_keys: "capo_iam.types.tag_key_list_type.tagKeyListType",
    *,
    config_overrides: Optional[AsyncIAMClientConfig] = None,
) -> None:
    """<p>Removes the specified tags from the role. For more information about tagging, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html">Tagging IAM resources</a> in the <i>IAM User Guide</i>.</p>

    Args:
        role_name: <p>The name of the IAM role from which you want to remove tags.</p> <p>This parameter accepts (through its <a href="http://wikipedia.org/wiki/regex">regex pattern</a>) a string of characters that consist of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-</p>
        tag_keys: <p>A list of key names as a simple array of strings. The tags with matching keys are removed from the specified role.</p>

    Raises:
        capo_iam.errors.concurrent_modification_exception.ConcurrentModificationException: <p>The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.</p>
        capo_iam.errors.no_such_entity_exception.NoSuchEntityException: <p>The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.</p>
        capo_iam.errors.service_failure_exception.ServiceFailureException: <p>The request processing has failed because of an unknown error, exception or failure.</p>
        capo_iam.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To remove a tag from an IAM role
        The following example shows how to remove a tag with the key 'Dept' from a role named 'taggedrole'.

        >>> await client.untag_role(role_name='taggedrole', tag_keys=['Dept'])
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_iam.types.untag_role_request.UntagRoleRequest]",
    ) -> AsyncOperationResponse[None]:
        import capo_iam._operations.aws_identity_management_v20100508.untag_role

        (
            output,
            http_response,
        ) = await capo_iam._operations.aws_identity_management_v20100508.untag_role.async_untag_role(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UntagRole")
    )
    input_: capo_iam.types.untag_role_request.UntagRoleRequest = {
        "role_name": role_name,
        "tag_keys": tag_keys,
    }

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output