Adds the specified user to 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 add.
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 add a user to an IAM group
The following command adds an IAM user named Bob to the IAM group named Admins:
>>> client.add_user_to_group(user_name='Bob', group_name='Admins')
Source code in docs_src/capo_iam/_services/iam.py
| def add_user_to_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>Adds the specified user to 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 add.</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 add a user to an IAM group
The following command adds an IAM user named Bob to the IAM group named Admins:
>>> client.add_user_to_group(user_name='Bob', group_name='Admins')
"""
def _handler(
req: "OperationRequest[capo_iam.types.add_user_to_group_request.AddUserToGroupRequest]",
) -> OperationResponse[None]:
import capo_iam._operations.aws_identity_management_v20100508.add_user_to_group
output, http_response = (
capo_iam._operations.aws_identity_management_v20100508.add_user_to_group.add_user_to_group(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("AddUserToGroup")
)
input_: capo_iam.types.add_user_to_group_request.AddUserToGroupRequest = {
"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
|