Skip to content

create_user

create_user(
    user_name: UserName,
    authentication_mode: AuthenticationMode,
    access_string: AccessString,
    *,
    config_overrides: Optional[MemoryDBClientConfig] = None,
    tags: Optional[TagList] = None,
) -> CreateUserResponse

Creates a MemoryDB user. For more information, see Authenticating users with Access Contol Lists (ACLs).

Parameters:

  • user_name (UserName) –

    The name of the user. This value must be unique as it also serves as the user identifier.

  • authentication_mode (AuthenticationMode) –

    Denotes the user's authentication properties, such as whether it requires a password to authenticate.

  • access_string (AccessString) –

    Access permissions string used for this user.

  • tags (Optional[TagList], default: None ) –

    A list of tags to be added to this resource. A tag is a key-value pair. A tag key must be accompanied by a tag value, although null is accepted.

Raises:

Source code in docs_src/capo_memorydb/_services/memory_db.py
def create_user(
    self,
    user_name: "capo_memorydb.types.user_name.UserName",
    authentication_mode: "capo_memorydb.types.authentication_mode.AuthenticationMode",
    access_string: "capo_memorydb.types.access_string.AccessString",
    *,
    config_overrides: Optional[MemoryDBClientConfig] = None,
    tags: Optional["capo_memorydb.types.tag_list.TagList"] = None,
) -> "capo_memorydb.types.create_user_response.CreateUserResponse":
    """<p>Creates a MemoryDB user. For more information, see <a href="https://docs.aws.amazon.com/MemoryDB/latest/devguide/clusters.acls.html">Authenticating users with Access Contol Lists (ACLs)</a>.</p>

    Args:
        user_name: <p>The name of the user. This value must be unique as it also serves as the user identifier.</p>
        authentication_mode: <p>Denotes the user's authentication properties, such as whether it requires a password to authenticate.</p>
        access_string: <p>Access permissions string used for this user.</p>
        tags: <p>A list of tags to be added to this resource. A tag is a key-value pair. A tag key must be accompanied by a tag value, although null is accepted.</p>

    Raises:
        capo_memorydb.errors.duplicate_user_name_fault.DuplicateUserNameFault: <p>A user with the specified name already exists.</p>
        capo_memorydb.errors.invalid_parameter_combination_exception.InvalidParameterCombinationException: <p>The specified parameter combination is not valid.</p>
        capo_memorydb.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>The specified parameter value is not valid.</p>
        capo_memorydb.errors.tag_quota_per_resource_exceeded.TagQuotaPerResourceExceeded: <p>The request cannot be processed because it would exceed the maximum number of tags allowed per resource.</p>
        capo_memorydb.errors.user_already_exists_fault.UserAlreadyExistsFault: <p>A user with the specified name already exists.</p>
        capo_memorydb.errors.user_quota_exceeded_fault.UserQuotaExceededFault: <p>The request cannot be processed because it would exceed the maximum number of users allowed.</p>
        capo_memorydb.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_memorydb.types.create_user_request.CreateUserRequest]",
    ) -> OperationResponse[
        "capo_memorydb.types.create_user_response.CreateUserResponse"
    ]:
        import capo_memorydb._operations.amazon_memory_db.create_user

        output, http_response = (
            capo_memorydb._operations.amazon_memory_db.create_user.create_user(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateUser")
    )
    input_: capo_memorydb.types.create_user_request.CreateUserRequest = {
        "user_name": user_name,
        "authentication_mode": authentication_mode,
        "access_string": access_string,
    }
    if tags is not None:
        input_["tags"] = tags

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