Skip to content

modify_user

modify_user(
    *,
    config_overrides: Optional[ElastiCacheClientConfig] = None,
    user_id: Optional[UserId] = None,
    access_string: Optional[AccessString] = None,
    append_access_string: Optional[AccessString] = None,
    passwords: Optional[PasswordListInput] = None,
    no_password_required: Optional[BooleanOptional] = None,
    authentication_mode: Optional[AuthenticationMode] = None,
    engine: Optional[EngineType] = None,
) -> User

Changes user password(s) and/or access string.

Parameters:

  • user_id (Optional[UserId], default: None ) –

    The ID of the user.

  • access_string (Optional[AccessString], default: None ) –

    Access permissions string used for this user.

  • append_access_string (Optional[AccessString], default: None ) –

    Adds additional user permissions to the access string.

  • passwords (Optional[PasswordListInput], default: None ) –

    The passwords belonging to the user. You are allowed up to two.

  • no_password_required (Optional[BooleanOptional], default: None ) –

    Indicates no password is required for the user.

  • authentication_mode (Optional[AuthenticationMode], default: None ) –

    Specifies how to authenticate the user.

  • engine (Optional[EngineType], default: None ) –

    Modifies the engine listed for a user. The options are valkey or redis.

Raises:

Source code in docs_src/capo_elasticache/_services/elasti_cache.py
def modify_user(
    self,
    *,
    config_overrides: Optional[ElastiCacheClientConfig] = None,
    user_id: Optional["capo_elasticache.types.user_id.UserId"] = None,
    access_string: Optional[
        "capo_elasticache.types.access_string.AccessString"
    ] = None,
    append_access_string: Optional[
        "capo_elasticache.types.access_string.AccessString"
    ] = None,
    passwords: Optional[
        "capo_elasticache.types.password_list_input.PasswordListInput"
    ] = None,
    no_password_required: Optional[
        "capo_elasticache.types.boolean_optional.BooleanOptional"
    ] = None,
    authentication_mode: Optional[
        "capo_elasticache.types.authentication_mode.AuthenticationMode"
    ] = None,
    engine: Optional["capo_elasticache.types.engine_type.EngineType"] = None,
) -> "capo_elasticache.types.user.User":
    """<p>Changes user password(s) and/or access string.</p>

    Args:
        user_id: <p>The ID of the user.</p>
        access_string: <p>Access permissions string used for this user.</p>
        append_access_string: <p>Adds additional user permissions to the access string.</p>
        passwords: <p>The passwords belonging to the user. You are allowed up to two.</p>
        no_password_required: <p>Indicates no password is required for the user.</p>
        authentication_mode: <p>Specifies how to authenticate the user.</p>
        engine: <p>Modifies the engine listed for a user. The options are valkey or redis.</p>

    Raises:
        capo_elasticache.errors.invalid_parameter_combination_exception.InvalidParameterCombinationException: <p>Two or more incompatible parameters were specified.</p>
        capo_elasticache.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>The value for a parameter is invalid.</p>
        capo_elasticache.errors.invalid_user_state_fault.InvalidUserStateFault: <p>The user is not in active state.</p>
        capo_elasticache.errors.service_linked_role_not_found_fault.ServiceLinkedRoleNotFoundFault: <p>The specified service linked role (SLR) was not found.</p>
        capo_elasticache.errors.user_not_found_fault.UserNotFoundFault: <p>The user does not exist or could not be found.</p>
        capo_elasticache.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_elasticache.types.modify_user_message.ModifyUserMessage]",
    ) -> OperationResponse["capo_elasticache.types.user.User"]:
        import capo_elasticache._operations.amazon_elasti_cache_v9.modify_user

        output, http_response = (
            capo_elasticache._operations.amazon_elasti_cache_v9.modify_user.modify_user(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ModifyUser")
    )
    input_: capo_elasticache.types.modify_user_message.ModifyUserMessage = {}
    if user_id is not None:
        input_["user_id"] = user_id
    if access_string is not None:
        input_["access_string"] = access_string
    if append_access_string is not None:
        input_["append_access_string"] = append_access_string
    if passwords is not None:
        input_["passwords"] = passwords
    if no_password_required is not None:
        input_["no_password_required"] = no_password_required
    if authentication_mode is not None:
        input_["authentication_mode"] = authentication_mode
    if engine is not None:
        input_["engine"] = engine

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