Skip to content

create_group_membership

create_group_membership(
    identity_store_id: IdentityStoreId,
    group_id: ResourceId,
    member_id: MemberId,
    *,
    config_overrides: Optional[identitystoreClientConfig] = None,
) -> CreateGroupMembershipResponse

Creates a relationship between a member and a group. The following identifiers must be specified: GroupId, IdentityStoreId, and MemberId.

Parameters:

  • identity_store_id (IdentityStoreId) –

    The globally unique identifier for the identity store.

    You can specify the identity store by ID or by Amazon Resource Name (ARN). For example, identity store ID d-1234567890 or identity store ARN arn:aws:identitystore::111122223333:identitystore/d-1234567890.

  • group_id (ResourceId) –

    The identifier for a group in the identity store.

    You can specify the group by ID or by Amazon Resource Name (ARN). For example, group ID a1b2c3d4-5678-90ab-cdef-EXAMPLE22222 or group ARN arn:aws:identitystore:::group/a1b2c3d4-5678-90ab-cdef-EXAMPLE22222.

  • member_id (MemberId) –

    An object that contains the identifier of a group member. Setting the UserID field to the specific identifier for a user indicates that the user is a member of the group.

Raises:

  • AccessDeniedException –

    You do not have sufficient access to perform this action.

  • InternalServerException –

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

  • ThrottlingException –

    Indicates that the principal has crossed the throttling limits of the API operations.

  • ConflictException –

    This request cannot be completed for one of the following reasons:

    • Performing the requested operation would violate an existing uniqueness claim in the identity store. Resolve the conflict before retrying this request.

    • The requested resource was being concurrently modified by another request.

  • ResourceNotFoundException –

    Indicates that a requested resource is not found.

  • ServiceQuotaExceededException –

    The request would cause the number of users or groups in the identity store to exceed the maximum allowed.

  • ValidationException –

    The request failed because it contains a syntax error.

  • UnknownServiceError –

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

Source code in docs_src/capo_identitystore/_services/identitystore.py
def create_group_membership(
    self,
    identity_store_id: "capo_identitystore.types.identity_store_id.IdentityStoreId",
    group_id: "capo_identitystore.types.resource_id.ResourceId",
    member_id: "capo_identitystore.types.member_id.MemberId",
    *,
    config_overrides: Optional[identitystoreClientConfig] = None,
) -> "capo_identitystore.types.create_group_membership_response.CreateGroupMembershipResponse":
    """<p>Creates a relationship between a member and a group. The following identifiers must be specified: <code>GroupId</code>, <code>IdentityStoreId</code>, and <code>MemberId</code>.</p>

    Args:
        identity_store_id: <p>The globally unique identifier for the identity store.</p> <p>You can specify the identity store by ID or by Amazon Resource Name (ARN). For example, identity store ID <code>d-1234567890</code> or identity store ARN <code>arn:aws:identitystore::111122223333:identitystore/d-1234567890</code>.</p>
        group_id: <p>The identifier for a group in the identity store.</p> <p>You can specify the group by ID or by Amazon Resource Name (ARN). For example, group ID <code>a1b2c3d4-5678-90ab-cdef-EXAMPLE22222</code> or group ARN <code>arn:aws:identitystore:::group/a1b2c3d4-5678-90ab-cdef-EXAMPLE22222</code>.</p>
        member_id: <p>An object that contains the identifier of a group member. Setting the <code>UserID</code> field to the specific identifier for a user indicates that the user is a member of the group.</p>

    Raises:
        capo_identitystore.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_identitystore.errors.internal_server_exception.InternalServerException: <p>The request processing has failed because of an unknown error, exception or failure with an internal server.</p>
        capo_identitystore.errors.throttling_exception.ThrottlingException: <p>Indicates that the principal has crossed the throttling limits of the API operations.</p>
        capo_identitystore.errors.conflict_exception.ConflictException: <p>This request cannot be completed for one of the following reasons:</p> <ul> <li> <p>Performing the requested operation would violate an existing uniqueness claim in the identity store. Resolve the conflict before retrying this request.</p> </li> <li> <p>The requested resource was being concurrently modified by another request.</p> </li> </ul>
        capo_identitystore.errors.resource_not_found_exception.ResourceNotFoundException: <p>Indicates that a requested resource is not found.</p>
        capo_identitystore.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request would cause the number of users or groups in the identity store to exceed the maximum allowed.</p>
        capo_identitystore.errors.validation_exception.ValidationException: <p>The request failed because it contains a syntax error.</p>
        capo_identitystore.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_identitystore.types.create_group_membership_request.CreateGroupMembershipRequest]",
    ) -> OperationResponse[
        "capo_identitystore.types.create_group_membership_response.CreateGroupMembershipResponse"
    ]:
        import capo_identitystore._operations.aws_identity_store.create_group_membership

        output, http_response = (
            capo_identitystore._operations.aws_identity_store.create_group_membership.create_group_membership(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateGroupMembership")
    )
    input_: capo_identitystore.types.create_group_membership_request.CreateGroupMembershipRequest = {
        "identity_store_id": identity_store_id,
        "group_id": group_id,
        "member_id": member_id,
    }

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