Skip to content

create_group async

create_group(
    group_name: groupNameType,
    *,
    config_overrides: Optional[AsyncIAMClientConfig] = None,
    path: Optional[pathType] = None,
) -> CreateGroupResponse

Creates a new group.

For information about the number of groups you can create, see IAM and STS quotas in the IAM User Guide.

Parameters:

  • path (Optional[pathType], default: None ) –

    The path to the group. For more information about paths, see IAM identifiers in the IAM User Guide.

    This parameter is optional. If it is not included, it defaults to a slash (/).

    This parameter allows (through its regex pattern) a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes. In addition, it can contain any ASCII character from the ! (\u0021) through the DEL character (\u007F), including most punctuation characters, digits, and upper and lowercased letters.

  • group_name (groupNameType) –

    The name of the group to create. Do not include the path in this value.

    IAM user, group, role, and policy names must be unique within the account. Names are not distinguished by case. For example, you cannot create resources named both "MyResource" and "myresource".

Raises:

  • EntityAlreadyExistsException –

    The request was rejected because it attempted to create a resource that already exists.

  • 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 create an IAM group The following command creates an IAM group named Admins.

>>> await client.create_group(group_name='Admins')
Source code in docs_src/capo_iam/_services/async_iam.py
async def create_group(
    self,
    group_name: "capo_iam.types.group_name_type.groupNameType",
    *,
    config_overrides: Optional[AsyncIAMClientConfig] = None,
    path: Optional["capo_iam.types.path_type.pathType"] = None,
) -> "capo_iam.types.create_group_response.CreateGroupResponse":
    r"""<p>Creates a new group.</p> <p> For information about the number of groups you can create, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-quotas.html">IAM and STS quotas</a> in the <i>IAM User Guide</i>.</p>

    Args:
        path: <p> The path to the group. For more information about paths, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html">IAM identifiers</a> in the <i>IAM User Guide</i>.</p> <p>This parameter is optional. If it is not included, it defaults to a slash (/).</p> <p>This parameter allows (through its <a href="http://wikipedia.org/wiki/regex">regex pattern</a>) a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes. In addition, it can contain any ASCII character from the ! (<code>\u0021</code>) through the DEL character (<code>\u007F</code>), including most punctuation characters, digits, and upper and lowercased letters.</p>
        group_name: <p>The name of the group to create. Do not include the path in this value.</p> <p>IAM user, group, role, and policy names must be unique within the account. Names are not distinguished by case. For example, you cannot create resources named both "MyResource" and "myresource".</p>

    Raises:
        capo_iam.errors.entity_already_exists_exception.EntityAlreadyExistsException: <p>The request was rejected because it attempted to create a resource that already exists.</p>
        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 create an IAM group
        The following command creates an IAM group named Admins.

        >>> await client.create_group(group_name='Admins')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_iam.types.create_group_request.CreateGroupRequest]",
    ) -> AsyncOperationResponse[
        "capo_iam.types.create_group_response.CreateGroupResponse"
    ]:
        import capo_iam._operations.aws_identity_management_v20100508.create_group

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateGroup")
    )
    input_: capo_iam.types.create_group_request.CreateGroupRequest = {
        "group_name": group_name
    }
    if path is not None:
        input_["path"] = path

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