// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.mjs` to generate the docs examples

[source, js]
----
const response = await client.security.putRoleMapping({
  name: "mapping8",
  roles: ["superuser"],
  enabled: true,
  rules: {
    all: [
      {
        any: [
          {
            field: {
              dn: "*,ou=admin,dc=example,dc=com",
            },
          },
          {
            field: {
              username: ["es-admin", "es-system"],
            },
          },
        ],
      },
      {
        field: {
          groups: "cn=people,dc=example,dc=com",
        },
      },
      {
        except: {
          field: {
            "metadata.terminated_date": null,
          },
        },
      },
    ],
  },
});
console.log(response);
----
