// This file is autogenerated, DO NOT EDIT
// security/authorization/run-as-privilege.asciidoc:143

[source, python]
----
resp = client.security.put_role(
    name="my_analyst_role",
    refresh=True,
    cluster=[
        "monitor"
    ],
    indices=[
        {
            "names": [
                "index1",
                "index2"
            ],
            "privileges": [
                "manage"
            ]
        }
    ],
    applications=[
        {
            "application": "myapp",
            "privileges": [
                "read"
            ],
            "resources": [
                "*"
            ]
        }
    ],
    metadata={
        "version": 1
    },
)
print(resp)
----
