Skip to content

Extract security.privileges.query in a typealias #1735

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 55 additions & 39 deletions output/schema/schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions output/schema/validation-errors.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions output/typescript/types.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 12 additions & 3 deletions specification/security/_types/Privileges.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,25 @@ export class IndicesPrivileges {
/**
* A search query that defines the documents the owners of the role have read access to. A document within the specified indices must match this query for it to be accessible by the owners of the role.
*/
query?: string[] | QueryContainer | RoleTemplateQueryContainer
query?: IndicesPrivilegesQuery
/**
* Set to `true` if using wildcard or regular expressions for patterns that cover restricted indices. Implicitly, restricted indices have limited privileges that can cause pattern tests to fail. If restricted indices are explicitly included in the `names` list, Elasticsearch checks privileges against these indices regardless of the value set for `allow_restricted_indices`.
* @server_default false
*/
allow_restricted_indices?: boolean
}

/** @variants container */
export class RoleTemplateQueryContainer {
/**
* While creating or updating a role you can provide either a JSON structure or a string to the API.
* However, the response provided by Elasticsearch will only be string with a json-as-text content.
*
* Since this is embedded in `IndicesPrivileges`, the same structure is used for clarity in both contexts.
*
* @codegen_names json_text, query, template
*/
export type IndicesPrivilegesQuery = string | QueryContainer | RoleTemplateQuery

export class RoleTemplateQuery {
/**
* When you create a role, you can specify a query that defines the document level security permissions. You can optionally
* use Mustache templates in the role query to insert the username of the current authenticated user into the role.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ export class Response {
applications: ApplicationPrivileges[]
cluster: string[]
global: GlobalPrivilege[]
/**
* In this context `IndicesPrivileges.query` property can only be a string, see `IndicesPrivileges` documentation for detail.
*/
indices: IndicesPrivileges[]
run_as: string[]
}
Expand Down