async def put_privileges(
        self,
        *,
        privileges: t.Optional[
            t.Mapping[str, t.Mapping[str, t.Mapping[str, t.Any]]]
        ] = None,
        body: t.Optional[t.Mapping[str, t.Mapping[str, t.Mapping[str, t.Any]]]] = None,
        error_trace: t.Optional[bool] = None,
        filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
        human: t.Optional[bool] = None,
        pretty: t.Optional[bool] = None,
        refresh: t.Optional[
            t.Union[bool, str, t.Literal["false", "true", "wait_for"]]
        ] = None,
    ) -> ObjectApiResponse[t.Any]:
        """
        .. raw:: html

          <p>Create or update application privileges.</p>
          <p>To use this API, you must have one of the following privileges:</p>
          <ul>
          <li>The <code>manage_security</code> cluster privilege (or a greater privilege such as <code>all</code>).</li>
          <li>The &quot;Manage Application Privileges&quot; global privilege for the application being referenced in the request.</li>
          </ul>
          <p>Application names are formed from a prefix, with an optional suffix that conform to the following rules:</p>
          <ul>
          <li>The prefix must begin with a lowercase ASCII letter.</li>
          <li>The prefix must contain only ASCII letters or digits.</li>
          <li>The prefix must be at least 3 characters long.</li>
          <li>If the suffix exists, it must begin with either a dash <code>-</code> or <code>_</code>.</li>
          <li>The suffix cannot contain any of the following characters: <code>\\</code>, <code>/</code>, <code>*</code>, <code>?</code>, <code>&quot;</code>, <code>&lt;</code>, <code>&gt;</code>, <code>|</code>, <code>,</code>, <code>*</code>.</li>
          <li>No part of the name can contain whitespace.</li>
          </ul>
          <p>Privilege names must begin with a lowercase ASCII letter and must contain only ASCII letters and digits along with the characters <code>_</code>, <code>-</code>, and <code>.</code>.</p>
          <p>Action names can contain any number of printable ASCII characters and must contain at least one of the following characters: <code>/</code>, <code>*</code>, <code>:</code>.</p>


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

        :param privileges:
        :param refresh: If `true` (the default) then refresh the affected shards to make
            this operation visible to search, if `wait_for` then wait for a refresh to
            make this operation visible to search, if `false` then do nothing with refreshes.
        """
        if privileges is None and body is None:
            raise ValueError(
                "Empty value passed for parameters 'privileges' and 'body', one of them should be set."
            )
        elif privileges is not None and body is not None:
            raise ValueError("Cannot set both 'privileges' and 'body'")
        __path_parts: t.Dict[str, str] = {}
        __path = "/_security/privilege"
        __query: t.Dict[str, t.Any] = {}
        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
        __body = privileges if privileges is not None else body
        __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_privileges",
            path_parts=__path_parts,
        )

        .. raw:: html

          <p>Create or update application privileges.</p>
          <p>To use this API, you must have one of the following privileges:</p>
          <ul>
          <li>The <code>manage_security</code> cluster privilege (or a greater privilege such as <code>all</code>).</li>
          <li>The &quot;Manage Application Privileges&quot; global privilege for the application being referenced in the request.</li>
          </ul>
          <p>Application names are formed from a prefix, with an optional suffix that conform to the following rules:</p>
          <ul>
          <li>The prefix must begin with a lowercase ASCII letter.</li>
          <li>The prefix must contain only ASCII letters or digits.</li>
          <li>The prefix must be at least 3 characters long.</li>
          <li>If the suffix exists, it must begin with either a dash <code>-</code> or <code>_</code>.</li>
          <li>The suffix cannot contain any of the following characters: <code>\</code>, <code>/</code>, <code>*</code>, <code>?</code>, <code>&quot;</code>, <code>&lt;</code>, <code>&gt;</code>, <code>|</code>, <code>,</code>, <code>*</code>.</li>
          <li>No part of the name can contain whitespace.</li>
          </ul>
          <p>Privilege names must begin with a lowercase ASCII letter and must contain only ASCII letters and digits along with the characters <code>_</code>, <code>-</code>, and <code>.</code>.</p>
          <p>Action names can contain any number of printable ASCII characters and must contain at least one of the following characters: <code>/</code>, <code>*</code>, <code>:</code>.</p>


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

        :param privileges:
        :param refresh: If `true` (the default) then refresh the affected shards to make
            this operation visible to search, if `wait_for` then wait for a refresh to
            make this operation visible to search, if `false` then do nothing with refreshes.
        
elasticsearch/_async/client/security.py