From c1ff4faebd872a05b9277c53f27b1cf7fed15541 Mon Sep 17 00:00:00 2001 From: Florian Bernd Date: Mon, 14 Oct 2024 16:30:16 +0200 Subject: [PATCH 1/2] Change `Indices` -> `IndexName[]` (#3016) (cherry picked from commit 17b22c4c33323c135181d3d71f6e4bbc2a211528) --- output/openapi/elasticsearch-openapi.json | 59 +++------ .../elasticsearch-serverless-openapi.json | 19 ++- output/schema/schema-serverless.json | 41 ++++--- output/schema/schema.json | 114 ++++++------------ output/typescript/types.ts | 12 +- specification/security/_types/Privileges.ts | 6 +- .../SecurityGetBuiltinPrivilegesResponse.ts | 12 +- 7 files changed, 99 insertions(+), 164 deletions(-) diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index bb5f50f9a1..2fe1dd32d9 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -29992,23 +29992,19 @@ "cluster": { "type": "array", "items": { - "$ref": "#/components/schemas/security._types:ClusterPrivilege" + "type": "string" } }, "index": { - "$ref": "#/components/schemas/_types:Indices" - }, - "remote_cluster": { "type": "array", "items": { - "$ref": "#/components/schemas/security._types:RemoteClusterPrivilege" + "$ref": "#/components/schemas/_types:IndexName" } } }, "required": [ "cluster", - "index", - "remote_cluster" + "index" ] } } @@ -83847,17 +83843,10 @@ }, "names": { "description": "A list of indices (or index name patterns) to which the permissions in this entry apply.", - "oneOf": [ - { - "$ref": "#/components/schemas/_types:IndexName" - }, - { - "type": "array", - "items": { - "$ref": "#/components/schemas/_types:IndexName" - } - } - ] + "type": "array", + "items": { + "$ref": "#/components/schemas/_types:IndexName" + } }, "privileges": { "description": "The index level privileges that owners of the role have on the specified indices.", @@ -83994,17 +83983,10 @@ }, "names": { "description": "A list of indices (or index name patterns) to which the permissions in this entry apply.", - "oneOf": [ - { - "$ref": "#/components/schemas/_types:IndexName" - }, - { - "type": "array", - "items": { - "$ref": "#/components/schemas/_types:IndexName" - } - } - ] + "type": "array", + "items": { + "$ref": "#/components/schemas/_types:IndexName" + } }, "privileges": { "description": "The index level privileges that owners of the role have on the specified indices.", @@ -84814,17 +84796,10 @@ }, "names": { "description": "A list of indices (or index name patterns) to which the permissions in this entry apply.", - "oneOf": [ - { - "$ref": "#/components/schemas/_types:IndexName" - }, - { - "type": "array", - "items": { - "$ref": "#/components/schemas/_types:IndexName" - } - } - ] + "type": "array", + "items": { + "$ref": "#/components/schemas/_types:IndexName" + } }, "privileges": { "description": "The index level privileges that owners of the role have on the specified indices.", @@ -104446,6 +104421,10 @@ }, "runtime_mappings": { "$ref": "#/components/schemas/_types.mapping:RuntimeFields" + }, + "max_samples_per_key": { + "description": "By default, the response of a sample query contains up to `10` samples, with one sample per unique set of join keys. Use the `size`\nparameter to get a smaller or larger set of samples. To retrieve more than one sample per set of join keys, use the\n`max_samples_per_key` parameter. Pipes are not supported for sample queries.", + "type": "number" } }, "required": [ diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index e32eef594f..b619907319 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -54385,17 +54385,10 @@ }, "names": { "description": "A list of indices (or index name patterns) to which the permissions in this entry apply.", - "oneOf": [ - { - "$ref": "#/components/schemas/_types:IndexName" - }, - { - "type": "array", - "items": { - "$ref": "#/components/schemas/_types:IndexName" - } - } - ] + "type": "array", + "items": { + "$ref": "#/components/schemas/_types:IndexName" + } }, "privileges": { "description": "The index level privileges that owners of the role have on the specified indices.", @@ -62983,6 +62976,10 @@ }, "runtime_mappings": { "$ref": "#/components/schemas/_types.mapping:RuntimeFields" + }, + "max_samples_per_key": { + "description": "By default, the response of a sample query contains up to `10` samples, with one sample per unique set of join keys. Use the `size`\nparameter to get a smaller or larger set of samples. To retrieve more than one sample per set of join keys, use the\n`max_samples_per_key` parameter. Pipes are not supported for sample queries.", + "type": "number" } }, "required": [ diff --git a/output/schema/schema-serverless.json b/output/schema/schema-serverless.json index 6bcf0a584b..e2a1a36425 100644 --- a/output/schema/schema-serverless.json +++ b/output/schema/schema-serverless.json @@ -17628,6 +17628,19 @@ "namespace": "_types.mapping" } } + }, + { + "description": "By default, the response of a sample query contains up to `10` samples, with one sample per unique set of join keys. Use the `size`\nparameter to get a smaller or larger set of samples. To retrieve more than one sample per set of join keys, use the\n`max_samples_per_key` parameter. Pipes are not supported for sample queries.", + "name": "max_samples_per_key", + "required": false, + "serverDefault": 1, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } } ] }, @@ -17760,7 +17773,7 @@ } } ], - "specLocation": "eql/search/EqlSearchRequest.ts#L28-L135" + "specLocation": "eql/search/EqlSearchRequest.ts#L28-L142" }, { "body": { @@ -141273,26 +141286,14 @@ "name": "names", "required": true, "type": { - "items": [ - { - "kind": "instance_of", - "type": { - "name": "IndexName", - "namespace": "_types" - } - }, - { - "kind": "array_of", - "value": { - "kind": "instance_of", - "type": { - "name": "IndexName", - "namespace": "_types" - } - } + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "IndexName", + "namespace": "_types" } - ], - "kind": "union_of" + } } }, { diff --git a/output/schema/schema.json b/output/schema/schema.json index 36e3216168..612cac79a6 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -119067,6 +119067,19 @@ "namespace": "_types.mapping" } } + }, + { + "description": "By default, the response of a sample query contains up to `10` samples, with one sample per unique set of join keys. Use the `size`\nparameter to get a smaller or larger set of samples. To retrieve more than one sample per set of join keys, use the\n`max_samples_per_key` parameter. Pipes are not supported for sample queries.", + "name": "max_samples_per_key", + "required": false, + "serverDefault": 1, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } } ] }, @@ -119198,7 +119211,7 @@ } } ], - "specLocation": "eql/search/EqlSearchRequest.ts#L28-L135" + "specLocation": "eql/search/EqlSearchRequest.ts#L28-L142" }, { "kind": "response", @@ -190781,26 +190794,14 @@ "name": "names", "required": true, "type": { - "kind": "union_of", - "items": [ - { - "kind": "instance_of", - "type": { - "name": "IndexName", - "namespace": "_types" - } - }, - { - "kind": "array_of", - "value": { - "kind": "instance_of", - "type": { - "name": "IndexName", - "namespace": "_types" - } - } + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "IndexName", + "namespace": "_types" } - ] + } } }, { @@ -191048,26 +191049,14 @@ "name": "names", "required": true, "type": { - "kind": "union_of", - "items": [ - { - "kind": "instance_of", - "type": { - "name": "IndexName", - "namespace": "_types" - } - }, - { - "kind": "array_of", - "value": { - "kind": "instance_of", - "type": { - "name": "IndexName", - "namespace": "_types" - } - } + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "IndexName", + "namespace": "_types" } - ] + } } }, { @@ -192169,26 +192158,14 @@ "name": "names", "required": true, "type": { - "kind": "union_of", - "items": [ - { - "kind": "instance_of", - "type": { - "name": "IndexName", - "namespace": "_types" - } - }, - { - "kind": "array_of", - "value": { - "kind": "instance_of", - "type": { - "name": "IndexName", - "namespace": "_types" - } - } + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "IndexName", + "namespace": "_types" } - ] + } } }, { @@ -195261,8 +195238,8 @@ "value": { "kind": "instance_of", "type": { - "name": "ClusterPrivilege", - "namespace": "security._types" + "name": "string", + "namespace": "_builtins" } } } @@ -195270,24 +195247,13 @@ { "name": "index", "required": true, - "type": { - "kind": "instance_of", - "type": { - "name": "Indices", - "namespace": "_types" - } - } - }, - { - "name": "remote_cluster", - "required": true, "type": { "kind": "array_of", "value": { "kind": "instance_of", "type": { - "name": "RemoteClusterPrivilege", - "namespace": "security._types" + "name": "IndexName", + "namespace": "_types" } } } @@ -195298,7 +195264,7 @@ "name": "Response", "namespace": "security.get_builtin_privileges" }, - "specLocation": "security/get_builtin_privileges/SecurityGetBuiltinPrivilegesResponse.ts#L26-L32" + "specLocation": "security/get_builtin_privileges/SecurityGetBuiltinPrivilegesResponse.ts#L22-L24" }, { "kind": "request", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 2b7aceff98..abf670fee9 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -10434,6 +10434,7 @@ export interface EqlSearchRequest extends RequestBase { fields?: QueryDslFieldAndFormat | Field | (QueryDslFieldAndFormat | Field)[] result_position?: EqlSearchResultPosition runtime_mappings?: MappingRuntimeFields + max_samples_per_key?: integer } } @@ -17904,7 +17905,7 @@ export type SecurityIndexPrivilege = 'all' | 'auto_configure' | 'create' | 'crea export interface SecurityIndicesPrivileges { field_security?: SecurityFieldSecurity - names: IndexName | IndexName[] + names: IndexName[] privileges: SecurityIndexPrivilege[] query?: SecurityIndicesPrivilegesQuery allow_restricted_indices?: boolean @@ -17931,7 +17932,7 @@ export interface SecurityRemoteClusterPrivileges { export interface SecurityRemoteIndicesPrivileges { clusters: Names field_security?: SecurityFieldSecurity - names: IndexName | IndexName[] + names: IndexName[] privileges: SecurityIndexPrivilege[] query?: SecurityIndicesPrivilegesQuery allow_restricted_indices?: boolean @@ -18033,7 +18034,7 @@ export interface SecurityUser { export interface SecurityUserIndicesPrivileges { field_security?: SecurityFieldSecurity[] - names: IndexName | IndexName[] + names: IndexName[] privileges: SecurityIndexPrivilege[] query?: SecurityIndicesPrivilegesQuery[] allow_restricted_indices: boolean @@ -18374,9 +18375,8 @@ export interface SecurityGetBuiltinPrivilegesRequest extends RequestBase { } export interface SecurityGetBuiltinPrivilegesResponse { - cluster: SecurityClusterPrivilege[] - index: Indices - remote_cluster: SecurityRemoteClusterPrivilege[] + cluster: string[] + index: IndexName[] } export interface SecurityGetPrivilegesRequest extends RequestBase { diff --git a/specification/security/_types/Privileges.ts b/specification/security/_types/Privileges.ts index 6836f8494e..3ab445cf12 100644 --- a/specification/security/_types/Privileges.ts +++ b/specification/security/_types/Privileges.ts @@ -225,7 +225,7 @@ export class IndicesPrivileges { /** * A list of indices (or index name patterns) to which the permissions in this entry apply. */ - names: IndexName | IndexName[] + names: IndexName[] /** * The index level privileges that owners of the role have on the specified indices. */ @@ -259,7 +259,7 @@ export class RemoteIndicesPrivileges { /** * A list of indices (or index name patterns) to which the permissions in this entry apply. */ - names: IndexName | IndexName[] + names: IndexName[] /** * The index level privileges that owners of the role have on the specified indices. */ @@ -299,7 +299,7 @@ export class UserIndicesPrivileges { /** * A list of indices (or index name patterns) to which the permissions in this entry apply. */ - names: IndexName | IndexName[] + names: IndexName[] /** * The index level privileges that owners of the role have on the specified indices. */ diff --git a/specification/security/get_builtin_privileges/SecurityGetBuiltinPrivilegesResponse.ts b/specification/security/get_builtin_privileges/SecurityGetBuiltinPrivilegesResponse.ts index 125f035940..eaf9009d13 100644 --- a/specification/security/get_builtin_privileges/SecurityGetBuiltinPrivilegesResponse.ts +++ b/specification/security/get_builtin_privileges/SecurityGetBuiltinPrivilegesResponse.ts @@ -17,16 +17,8 @@ * under the License. */ -import { - ClusterPrivilege, - RemoteClusterPrivilege -} from '@security/_types/Privileges' -import { Indices } from '@_types/common' +import { IndexName } from '@_types/common' export class Response { - body: { - cluster: ClusterPrivilege[] - index: Indices - remote_cluster: RemoteClusterPrivilege[] - } + body: { cluster: string[]; index: IndexName[] } } From 3a9f5c0a88372ec01629150a8de59bac538abed0 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Thu, 2 Jan 2025 18:07:40 +0400 Subject: [PATCH 2/2] Fix get_builtin_privileges:wq --- output/openapi/elasticsearch-openapi.json | 11 ++++++++-- output/schema/schema.json | 20 ++++++++++++++++--- output/typescript/types.ts | 3 ++- .../SecurityGetBuiltinPrivilegesResponse.ts | 10 +++++++++- 4 files changed, 37 insertions(+), 7 deletions(-) diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 2fe1dd32d9..95c092ee66 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -29992,7 +29992,7 @@ "cluster": { "type": "array", "items": { - "type": "string" + "$ref": "#/components/schemas/security._types:ClusterPrivilege" } }, "index": { @@ -30000,11 +30000,18 @@ "items": { "$ref": "#/components/schemas/_types:IndexName" } + }, + "remote_cluster": { + "type": "array", + "items": { + "$ref": "#/components/schemas/security._types:RemoteClusterPrivilege" + } } }, "required": [ "cluster", - "index" + "index", + "remote_cluster" ] } } diff --git a/output/schema/schema.json b/output/schema/schema.json index 612cac79a6..fff1f5a5e2 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -195238,8 +195238,8 @@ "value": { "kind": "instance_of", "type": { - "name": "string", - "namespace": "_builtins" + "name": "ClusterPrivilege", + "namespace": "security._types" } } } @@ -195257,6 +195257,20 @@ } } } + }, + { + "name": "remote_cluster", + "required": true, + "type": { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "RemoteClusterPrivilege", + "namespace": "security._types" + } + } + } } ] }, @@ -195264,7 +195278,7 @@ "name": "Response", "namespace": "security.get_builtin_privileges" }, - "specLocation": "security/get_builtin_privileges/SecurityGetBuiltinPrivilegesResponse.ts#L22-L24" + "specLocation": "security/get_builtin_privileges/SecurityGetBuiltinPrivilegesResponse.ts#L26-L32" }, { "kind": "request", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index abf670fee9..7bbee9cd1c 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -18375,8 +18375,9 @@ export interface SecurityGetBuiltinPrivilegesRequest extends RequestBase { } export interface SecurityGetBuiltinPrivilegesResponse { - cluster: string[] + cluster: SecurityClusterPrivilege[] index: IndexName[] + remote_cluster: SecurityRemoteClusterPrivilege[] } export interface SecurityGetPrivilegesRequest extends RequestBase { diff --git a/specification/security/get_builtin_privileges/SecurityGetBuiltinPrivilegesResponse.ts b/specification/security/get_builtin_privileges/SecurityGetBuiltinPrivilegesResponse.ts index eaf9009d13..a1f81e913e 100644 --- a/specification/security/get_builtin_privileges/SecurityGetBuiltinPrivilegesResponse.ts +++ b/specification/security/get_builtin_privileges/SecurityGetBuiltinPrivilegesResponse.ts @@ -17,8 +17,16 @@ * under the License. */ +import { + ClusterPrivilege, + RemoteClusterPrivilege +} from '@security/_types/Privileges' import { IndexName } from '@_types/common' export class Response { - body: { cluster: string[]; index: IndexName[] } + body: { + cluster: ClusterPrivilege[] + index: IndexName[] + remote_cluster: RemoteClusterPrivilege[] + } }