From 6e51d8438b4b4d1b4722aecb94e537fad15a3a2b Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Thu, 7 Dec 2023 14:59:10 +0400 Subject: [PATCH] [7.17] Add role_templates in SecurityPutRoleMappingRequest (#2357) (#2360) (cherry picked from commit 4f9a95d4358707339d8d33c85deb4ccd6a226a79) --- output/schema/schema.json | 116 ++++++++++-------- output/typescript/types.ts | 19 +-- specification/security/_types/RoleMapping.ts | 2 +- specification/security/_types/RoleTemplate.ts | 31 +++++ specification/security/get_role/types.ts | 13 +- .../SecurityPutRoleMappingRequest.ts | 2 + 6 files changed, 110 insertions(+), 73 deletions(-) create mode 100644 specification/security/_types/RoleTemplate.ts diff --git a/output/schema/schema.json b/output/schema/schema.json index 59bb69f964..12f3df95cd 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -144650,7 +144650,7 @@ "kind": "instance_of", "type": { "name": "RoleTemplate", - "namespace": "security.get_role" + "namespace": "security._types" } } } @@ -144721,6 +144721,38 @@ "kind": "container" } }, + { + "kind": "interface", + "name": { + "name": "RoleTemplate", + "namespace": "security._types" + }, + "properties": [ + { + "name": "format", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "TemplateFormat", + "namespace": "security._types" + } + } + }, + { + "name": "template", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "Script", + "namespace": "_types" + } + } + } + ], + "specLocation": "security/_types/RoleTemplate.ts#L28-L31" + }, { "codegenNames": [ "query_string", @@ -144867,6 +144899,22 @@ "kind": "union_of" } }, + { + "kind": "enum", + "members": [ + { + "name": "string" + }, + { + "name": "json" + } + ], + "name": { + "name": "TemplateFormat", + "namespace": "security._types" + }, + "specLocation": "security/_types/RoleTemplate.ts#L22-L25" + }, { "kind": "interface", "name": { @@ -147404,7 +147452,7 @@ "kind": "instance_of", "type": { "name": "RoleTemplate", - "namespace": "security.get_role" + "namespace": "security._types" } } } @@ -147412,54 +147460,6 @@ ], "specLocation": "security/get_role/types.ts#L27-L35" }, - { - "kind": "interface", - "name": { - "name": "RoleTemplate", - "namespace": "security.get_role" - }, - "properties": [ - { - "name": "format", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "TemplateFormat", - "namespace": "security.get_role" - } - } - }, - { - "name": "template", - "required": true, - "type": { - "kind": "instance_of", - "type": { - "name": "Script", - "namespace": "_types" - } - } - } - ], - "specLocation": "security/get_role/types.ts#L47-L50" - }, - { - "kind": "enum", - "members": [ - { - "name": "string" - }, - { - "name": "json" - } - ], - "name": { - "name": "TemplateFormat", - "namespace": "security.get_role" - }, - "specLocation": "security/get_role/types.ts#L41-L44" - }, { "kind": "interface", "name": { @@ -149664,6 +149664,20 @@ } } }, + { + "name": "role_templates", + "required": false, + "type": { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "RoleTemplate", + "namespace": "security._types" + } + } + } + }, { "name": "rules", "required": false, @@ -149731,7 +149745,7 @@ } } ], - "specLocation": "security/put_role_mapping/SecurityPutRoleMappingRequest.ts#L24-L43" + "specLocation": "security/put_role_mapping/SecurityPutRoleMappingRequest.ts#L25-L45" }, { "body": { diff --git a/output/typescript/types.ts b/output/typescript/types.ts index c352776067..db3747f311 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -14469,7 +14469,7 @@ export interface SecurityRoleMapping { metadata: Metadata roles: string[] rules: SecurityRoleMappingRule - role_templates?: SecurityGetRoleRoleTemplate[] + role_templates?: SecurityRoleTemplate[] } export interface SecurityRoleMappingRule { @@ -14479,6 +14479,11 @@ export interface SecurityRoleMappingRule { except?: SecurityRoleMappingRule } +export interface SecurityRoleTemplate { + format?: SecurityTemplateFormat + template: Script +} + export type SecurityRoleTemplateInlineQuery = string | QueryDslQueryContainer export interface SecurityRoleTemplateInlineScript extends ScriptBase { @@ -14493,6 +14498,8 @@ export interface SecurityRoleTemplateQuery { export type SecurityRoleTemplateScript = SecurityRoleTemplateInlineScript | SecurityRoleTemplateInlineQuery | StoredScriptId +export type SecurityTemplateFormat = 'string' | 'json' + export interface SecurityTransientMetadataConfig { enabled: boolean } @@ -14771,16 +14778,9 @@ export interface SecurityGetRoleRole { run_as: string[] transient_metadata: SecurityGetRoleTransientMetadata applications: SecurityApplicationPrivileges[] - role_templates?: SecurityGetRoleRoleTemplate[] + role_templates?: SecurityRoleTemplate[] } -export interface SecurityGetRoleRoleTemplate { - format?: SecurityGetRoleTemplateFormat - template: Script -} - -export type SecurityGetRoleTemplateFormat = 'string' | 'json' - export interface SecurityGetRoleTransientMetadata { enabled: boolean } @@ -15021,6 +15021,7 @@ export interface SecurityPutRoleMappingRequest extends RequestBase { enabled?: boolean metadata?: Metadata roles?: string[] + role_templates?: SecurityRoleTemplate[] rules?: SecurityRoleMappingRule run_as?: string[] } diff --git a/specification/security/_types/RoleMapping.ts b/specification/security/_types/RoleMapping.ts index 494a1bfe74..9f505418a9 100644 --- a/specification/security/_types/RoleMapping.ts +++ b/specification/security/_types/RoleMapping.ts @@ -17,9 +17,9 @@ * under the License. */ -import { RoleTemplate } from '@security/get_role/types' import { Metadata } from '@_types/common' import { RoleMappingRule } from './RoleMappingRule' +import { RoleTemplate } from './RoleTemplate' // ES: ExpressionRoleMapping export class RoleMapping { diff --git a/specification/security/_types/RoleTemplate.ts b/specification/security/_types/RoleTemplate.ts new file mode 100644 index 0000000000..2065b84377 --- /dev/null +++ b/specification/security/_types/RoleTemplate.ts @@ -0,0 +1,31 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { Script } from '@_types/Scripting' + +export enum TemplateFormat { + string = 0, + json = 1 +} + +// ES: TemplateRoleName +export class RoleTemplate { + format?: TemplateFormat + template: Script +} diff --git a/specification/security/get_role/types.ts b/specification/security/get_role/types.ts index b40a9dcc84..8239b94f5a 100644 --- a/specification/security/get_role/types.ts +++ b/specification/security/get_role/types.ts @@ -22,7 +22,7 @@ import { ApplicationPrivileges } from '@security/_types/Privileges' import { Metadata } from '@_types/common' -import { Script } from '@_types/Scripting' +import { RoleTemplate } from '@security/_types/RoleTemplate' export class Role { cluster: string[] @@ -37,14 +37,3 @@ export class Role { export class TransientMetadata { enabled: boolean } - -export enum TemplateFormat { - string = 0, - json = 1 -} - -// ES: TemplateRoleName -export class RoleTemplate { - format?: TemplateFormat - template: Script -} diff --git a/specification/security/put_role_mapping/SecurityPutRoleMappingRequest.ts b/specification/security/put_role_mapping/SecurityPutRoleMappingRequest.ts index 02e714b0f2..d0121ac8d7 100644 --- a/specification/security/put_role_mapping/SecurityPutRoleMappingRequest.ts +++ b/specification/security/put_role_mapping/SecurityPutRoleMappingRequest.ts @@ -20,6 +20,7 @@ import { RoleMappingRule } from '@security/_types/RoleMappingRule' import { RequestBase } from '@_types/Base' import { Metadata, Name, Refresh } from '@_types/common' +import { RoleTemplate } from '@security/_types/RoleTemplate' /** * @rest_spec_name security.put_role_mapping @@ -37,6 +38,7 @@ export interface Request extends RequestBase { enabled?: boolean metadata?: Metadata roles?: string[] + role_templates?: RoleTemplate[] rules?: RoleMappingRule run_as?: string[] }