Skip to content

remove_user_from_group

remove_user_from_group(
    group_name: groupNameType,
    user_name: existingUserNameType,
    *,
    config_overrides: Optional[IAMClientConfig] = None,
) -> None

Removes the specified user from the specified group.

Parameters:

  • group_name (groupNameType) –

    The name of the group to update.

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

  • user_name (existingUserNameType) –

    The name of the user to remove.

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

Raises:

  • LimitExceededException –

    The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.

  • 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 user from an IAM group The following command removes the user named Bob from the IAM group named Admins.

>>> client.remove_user_from_group(user_name='Bob', group_name='Admins')
Source code in docs_src/capo_iam/_services/iam.py
def remove_user_from_group(
    self,
    group_name: "capo_iam.types.group_name_type.groupNameType",
    user_name: "capo_iam.types.existing_user_name_type.existingUserNameType",
    *,
    config_overrides: Optional[IAMClientConfig] = None,
) -> None:
    """<p>Removes the specified user from the specified group.</p>

    Args:
        group_name: <p>The name of the group to update.</p> <p>This parameter allows (through its <a href="http://wikipedia.org/wiki/regex">regex pattern</a>) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-</p>
        user_name: <p>The name of the user to remove.</p> <p>This parameter allows (through its <a href="http://wikipedia.org/wiki/regex">regex pattern</a>) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-</p>

    Raises:
        capo_iam.errors.limit_exceeded_exception.LimitExceededException: <p>The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.</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 user from an IAM group
        The following command removes the user named Bob from the IAM group named Admins.

        >>> client.remove_user_from_group(user_name='Bob', group_name='Admins')
    """

    def _handler(
        req: "OperationRequest[capo_iam.types.remove_user_from_group_request.RemoveUserFromGroupRequest]",
    ) -> OperationResponse[None]:
        import capo_iam._operations.aws_identity_management_v20100508.remove_user_from_group

        output, http_response = (
            capo_iam._operations.aws_identity_management_v20100508.remove_user_from_group.remove_user_from_group(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("RemoveUserFromGroup")
    )
    input_: capo_iam.types.remove_user_from_group_request.RemoveUserFromGroupRequest = {
        "group_name": group_name,
        "user_name": user_name,
    }

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output