async def put_user(
        self,
        *,
        username: str,
        email: t.Optional[t.Union[None, str]] = None,
        enabled: t.Optional[bool] = None,
        error_trace: t.Optional[bool] = None,
        filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
        full_name: t.Optional[t.Union[None, str]] = None,
        human: t.Optional[bool] = None,
        metadata: t.Optional[t.Mapping[str, t.Any]] = None,
        password: t.Optional[str] = None,
        password_hash: t.Optional[str] = None,
        pretty: t.Optional[bool] = None,
        refresh: t.Optional[
            t.Union[bool, str, t.Literal["false", "true", "wait_for"]]
        ] = None,
        roles: t.Optional[t.Sequence[str]] = None,
        body: t.Optional[t.Dict[str, t.Any]] = None,
    ) -> ObjectApiResponse[t.Any]:
        """
        .. raw:: html

          <p>Create or update users.</p>
          <p>Add and update users in the native realm.
          A password is required for adding a new user but is optional when updating an existing user.
          To change a user's password without updating any other fields, use the change password API.</p>


        `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-security-put-user>`_

        :param username: An identifier for the user. NOTE: Usernames must be at least
            1 and no more than 507 characters. They can contain alphanumeric characters
            (a-z, A-Z, 0-9), spaces, punctuation, and printable symbols in the Basic
            Latin (ASCII) block. Leading or trailing whitespace is not allowed.
        :param email: The email of the user.
        :param enabled: Specifies whether the user is enabled.
        :param full_name: The full name of the user.
        :param metadata: Arbitrary metadata that you want to associate with the user.
        :param password: The user's password. Passwords must be at least 6 characters
            long. When adding a user, one of `password` or `password_hash` is required.
            When updating an existing user, the password is optional, so that other fields
            on the user (such as their roles) may be updated without modifying the user's
            password
        :param password_hash: A hash of the user's password. This must be produced using
            the same hashing algorithm as has been configured for password storage. For
            more details, see the explanation of the `xpack.security.authc.password_hashing.algorithm`
            setting in the user cache and password hash algorithm documentation. Using
            this parameter allows the client to pre-hash the password for performance
            and/or confidentiality reasons. The `password` parameter and the `password_hash`
            parameter cannot be used in the same request.
        :param refresh: Valid values are `true`, `false`, and `wait_for`. These values
            have the same meaning as in the index API, but the default value for this
            API is true.
        :param roles: A set of roles the user has. The roles determine the user's access
            permissions. To create a user without any roles, specify an empty list (`[]`).
        """
        if username in SKIP_IN_PATH:
            raise ValueError("Empty value passed for parameter 'username'")
        __path_parts: t.Dict[str, str] = {"username": _quote(username)}
        __path = f'/_security/user/{__path_parts["username"]}'
        __query: t.Dict[str, t.Any] = {}
        __body: t.Dict[str, t.Any] = body if body is not None else {}
        if error_trace is not None:
            __query["error_trace"] = error_trace
        if filter_path is not None:
            __query["filter_path"] = filter_path
        if human is not None:
            __query["human"] = human
        if pretty is not None:
            __query["pretty"] = pretty
        if refresh is not None:
            __query["refresh"] = refresh
        if not __body:
            if email is not None:
                __body["email"] = email
            if enabled is not None:
                __body["enabled"] = enabled
            if full_name is not None:
                __body["full_name"] = full_name
            if metadata is not None:
                __body["metadata"] = metadata
            if password is not None:
                __body["password"] = password
            if password_hash is not None:
                __body["password_hash"] = password_hash
            if roles is not None:
                __body["roles"] = roles
        __headers = {"accept": "application/json", "content-type": "application/json"}
        return await self.perform_request(  # type: ignore[return-value]
            "PUT",
            __path,
            params=__query,
            headers=__headers,
            body=__body,
            endpoint_id="security.put_user",
            path_parts=__path_parts,
        )

        .. raw:: html

          <p>Create or update users.</p>
          <p>Add and update users in the native realm.
          A password is required for adding a new user but is optional when updating an existing user.
          To change a user's password without updating any other fields, use the change password API.</p>


        `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-security-put-user>`_

        :param username: An identifier for the user. NOTE: Usernames must be at least
            1 and no more than 507 characters. They can contain alphanumeric characters
            (a-z, A-Z, 0-9), spaces, punctuation, and printable symbols in the Basic
            Latin (ASCII) block. Leading or trailing whitespace is not allowed.
        :param email: The email of the user.
        :param enabled: Specifies whether the user is enabled.
        :param full_name: The full name of the user.
        :param metadata: Arbitrary metadata that you want to associate with the user.
        :param password: The user's password. Passwords must be at least 6 characters
            long. When adding a user, one of `password` or `password_hash` is required.
            When updating an existing user, the password is optional, so that other fields
            on the user (such as their roles) may be updated without modifying the user's
            password
        :param password_hash: A hash of the user's password. This must be produced using
            the same hashing algorithm as has been configured for password storage. For
            more details, see the explanation of the `xpack.security.authc.password_hashing.algorithm`
            setting in the user cache and password hash algorithm documentation. Using
            this parameter allows the client to pre-hash the password for performance
            and/or confidentiality reasons. The `password` parameter and the `password_hash`
            parameter cannot be used in the same request.
        :param refresh: Valid values are `true`, `false`, and `wait_for`. These values
            have the same meaning as in the index API, but the default value for this
            API is true.
        :param roles: A set of roles the user has. The roles determine the user's access
            permissions. To create a user without any roles, specify an empty list (`[]`).
        
elasticsearch/_async/client/security.py