From ae905458c1dd7335cfcd441b566180b4ce8a2f8c Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Mon, 9 Dec 2024 14:26:29 +0400 Subject: [PATCH] Fix xpack.usage ILM actions They're list of strings, not full actions. --- output/openapi/elasticsearch-openapi.json | 49 +++- output/schema/schema.json | 288 ++++++++++++++-------- output/typescript/types.ts | 17 +- specification/ilm/_types/Phase.ts | 5 +- specification/xpack/usage/types.ts | 14 +- 5 files changed, 261 insertions(+), 112 deletions(-) diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 90ab9893f6..dc8857313b 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -66879,14 +66879,7 @@ "$ref": "#/components/schemas/ilm._types:Actions" }, "min_age": { - "oneOf": [ - { - "$ref": "#/components/schemas/_types:Duration" - }, - { - "type": "number" - } - ] + "$ref": "#/components/schemas/_types:Duration" } } }, @@ -88362,7 +88355,7 @@ "type": "number" }, "phases": { - "$ref": "#/components/schemas/ilm._types:Phases" + "$ref": "#/components/schemas/xpack.usage:Phases" } }, "required": [ @@ -88370,6 +88363,44 @@ "phases" ] }, + "xpack.usage:Phases": { + "type": "object", + "properties": { + "cold": { + "$ref": "#/components/schemas/xpack.usage:Phase" + }, + "delete": { + "$ref": "#/components/schemas/xpack.usage:Phase" + }, + "frozen": { + "$ref": "#/components/schemas/xpack.usage:Phase" + }, + "hot": { + "$ref": "#/components/schemas/xpack.usage:Phase" + }, + "warm": { + "$ref": "#/components/schemas/xpack.usage:Phase" + } + } + }, + "xpack.usage:Phase": { + "type": "object", + "properties": { + "actions": { + "type": "array", + "items": { + "type": "string" + } + }, + "min_age": { + "$ref": "#/components/schemas/_types:DurationValueUnitMillis" + } + }, + "required": [ + "actions", + "min_age" + ] + }, "xpack.usage:MachineLearning": { "allOf": [ { diff --git a/output/schema/schema.json b/output/schema/schema.json index c9e74c01de..44015adc36 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -121073,7 +121073,7 @@ } } ], - "specLocation": "ilm/_types/Phase.ts#L42-L96" + "specLocation": "ilm/_types/Phase.ts#L39-L93" }, { "kind": "interface", @@ -121171,7 +121171,7 @@ } } ], - "specLocation": "ilm/_types/Phase.ts#L136-L142" + "specLocation": "ilm/_types/Phase.ts#L133-L139" }, { "kind": "interface", @@ -121192,7 +121192,7 @@ } } ], - "specLocation": "ilm/_types/Phase.ts#L152-L154" + "specLocation": "ilm/_types/Phase.ts#L149-L151" }, { "kind": "interface", @@ -121224,7 +121224,7 @@ } } ], - "specLocation": "ilm/_types/Phase.ts#L115-L118" + "specLocation": "ilm/_types/Phase.ts#L112-L115" }, { "kind": "interface", @@ -121256,7 +121256,7 @@ } } ], - "specLocation": "ilm/_types/Phase.ts#L126-L129" + "specLocation": "ilm/_types/Phase.ts#L123-L126" }, { "kind": "interface", @@ -121277,7 +121277,7 @@ } } ], - "specLocation": "ilm/_types/Phase.ts#L144-L146" + "specLocation": "ilm/_types/Phase.ts#L141-L143" }, { "kind": "interface", @@ -121298,31 +121298,18 @@ } }, { - "esQuirk": "output as a millis number in XPack usage stats, which cannot roundtrip with a Duration as it requires a unit.", "name": "min_age", "required": false, "type": { - "kind": "union_of", - "items": [ - { - "kind": "instance_of", - "type": { - "name": "Duration", - "namespace": "_types" - } - }, - { - "kind": "instance_of", - "type": { - "name": "long", - "namespace": "_types" - } - } - ] + "kind": "instance_of", + "type": { + "name": "Duration", + "namespace": "_types" + } } } ], - "specLocation": "ilm/_types/Phase.ts#L26-L32" + "specLocation": "ilm/_types/Phase.ts#L26-L29" }, { "kind": "interface", @@ -121387,7 +121374,7 @@ } } ], - "specLocation": "ilm/_types/Phase.ts#L34-L40" + "specLocation": "ilm/_types/Phase.ts#L31-L37" }, { "kind": "interface", @@ -121539,7 +121526,7 @@ } } ], - "specLocation": "ilm/_types/Phase.ts#L102-L113" + "specLocation": "ilm/_types/Phase.ts#L99-L110" }, { "kind": "interface", @@ -121571,7 +121558,7 @@ } } ], - "specLocation": "ilm/_types/Phase.ts#L131-L134" + "specLocation": "ilm/_types/Phase.ts#L128-L131" }, { "kind": "interface", @@ -121592,7 +121579,7 @@ } } ], - "specLocation": "ilm/_types/Phase.ts#L98-L100" + "specLocation": "ilm/_types/Phase.ts#L95-L97" }, { "kind": "interface", @@ -121635,7 +121622,7 @@ } } ], - "specLocation": "ilm/_types/Phase.ts#L120-L124" + "specLocation": "ilm/_types/Phase.ts#L117-L121" }, { "kind": "interface", @@ -121656,7 +121643,7 @@ } } ], - "specLocation": "ilm/_types/Phase.ts#L148-L150" + "specLocation": "ilm/_types/Phase.ts#L145-L147" }, { "kind": "request", @@ -217189,7 +217176,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L328-L330" + "specLocation": "xpack/usage/types.ts#L340-L342" }, { "kind": "interface", @@ -217298,7 +217285,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L59-L69" + "specLocation": "xpack/usage/types.ts#L58-L68" }, { "kind": "interface", @@ -217325,7 +217312,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L46-L48" + "specLocation": "xpack/usage/types.ts#L45-L47" }, { "kind": "interface", @@ -217355,7 +217342,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L71-L73" + "specLocation": "xpack/usage/types.ts#L70-L72" }, { "kind": "interface", @@ -217387,7 +217374,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L28-L31" + "specLocation": "xpack/usage/types.ts#L27-L30" }, { "kind": "interface", @@ -217425,7 +217412,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L332-L335" + "specLocation": "xpack/usage/types.ts#L344-L347" }, { "kind": "interface", @@ -217457,7 +217444,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L33-L36" + "specLocation": "xpack/usage/types.ts#L32-L35" }, { "kind": "interface", @@ -217495,7 +217482,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L79-L82" + "specLocation": "xpack/usage/types.ts#L78-L81" }, { "kind": "interface", @@ -217615,7 +217602,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L84-L95" + "specLocation": "xpack/usage/types.ts#L83-L94" }, { "kind": "interface", @@ -217692,7 +217679,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L337-L347" + "specLocation": "xpack/usage/types.ts#L349-L359" }, { "kind": "interface", @@ -217713,7 +217700,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L75-L77" + "specLocation": "xpack/usage/types.ts#L74-L76" }, { "kind": "interface", @@ -217762,7 +217749,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L349-L352" + "specLocation": "xpack/usage/types.ts#L361-L364" }, { "kind": "interface", @@ -217849,7 +217836,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L97-L105" + "specLocation": "xpack/usage/types.ts#L96-L104" }, { "kind": "interface", @@ -217914,7 +217901,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L107-L113" + "specLocation": "xpack/usage/types.ts#L106-L112" }, { "kind": "interface", @@ -217979,7 +217966,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L115-L121" + "specLocation": "xpack/usage/types.ts#L114-L120" }, { "kind": "interface", @@ -218011,7 +217998,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L123-L126" + "specLocation": "xpack/usage/types.ts#L122-L125" }, { "kind": "interface", @@ -218087,7 +218074,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L128-L135" + "specLocation": "xpack/usage/types.ts#L127-L134" }, { "kind": "interface", @@ -218108,7 +218095,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L38-L40" + "specLocation": "xpack/usage/types.ts#L37-L39" }, { "kind": "interface", @@ -218135,7 +218122,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L354-L356" + "specLocation": "xpack/usage/types.ts#L366-L368" }, { "kind": "interface", @@ -218162,7 +218149,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L358-L360" + "specLocation": "xpack/usage/types.ts#L370-L372" }, { "kind": "interface", @@ -218189,7 +218176,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L151-L153" + "specLocation": "xpack/usage/types.ts#L150-L152" }, { "kind": "interface", @@ -218224,7 +218211,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L160-L163" + "specLocation": "xpack/usage/types.ts#L172-L175" }, { "kind": "interface", @@ -218251,12 +218238,12 @@ "kind": "instance_of", "type": { "name": "Phases", - "namespace": "ilm._types" + "namespace": "xpack.usage" } } } ], - "specLocation": "xpack/usage/types.ts#L155-L158" + "specLocation": "xpack/usage/types.ts#L167-L170" }, { "kind": "interface", @@ -218277,7 +218264,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L42-L44" + "specLocation": "xpack/usage/types.ts#L41-L43" }, { "kind": "interface", @@ -218309,7 +218296,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L165-L168" + "specLocation": "xpack/usage/types.ts#L177-L180" }, { "kind": "interface", @@ -218385,7 +218372,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L362-L368" + "specLocation": "xpack/usage/types.ts#L374-L380" }, { "kind": "interface", @@ -218479,7 +218466,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L370-L377" + "specLocation": "xpack/usage/types.ts#L382-L389" }, { "kind": "interface", @@ -218500,7 +218487,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L253-L255" + "specLocation": "xpack/usage/types.ts#L265-L267" }, { "kind": "interface", @@ -218554,7 +218541,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L175-L180" + "specLocation": "xpack/usage/types.ts#L187-L192" }, { "kind": "interface", @@ -218597,7 +218584,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L182-L186" + "specLocation": "xpack/usage/types.ts#L194-L198" }, { "kind": "interface", @@ -218618,7 +218605,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L192-L194" + "specLocation": "xpack/usage/types.ts#L204-L206" }, { "kind": "interface", @@ -218639,7 +218626,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L188-L190" + "specLocation": "xpack/usage/types.ts#L200-L202" }, { "kind": "interface", @@ -218699,7 +218686,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L196-L204" + "specLocation": "xpack/usage/types.ts#L208-L216" }, { "kind": "interface", @@ -218753,7 +218740,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L225-L230" + "specLocation": "xpack/usage/types.ts#L237-L242" }, { "kind": "interface", @@ -218774,7 +218761,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L232-L234" + "specLocation": "xpack/usage/types.ts#L244-L246" }, { "kind": "interface", @@ -218828,7 +218815,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L206-L211" + "specLocation": "xpack/usage/types.ts#L218-L223" }, { "kind": "interface", @@ -218871,7 +218858,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L236-L240" + "specLocation": "xpack/usage/types.ts#L248-L252" }, { "kind": "interface", @@ -218942,7 +218929,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L213-L223" + "specLocation": "xpack/usage/types.ts#L225-L235" }, { "kind": "interface", @@ -219040,7 +219027,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L242-L251" + "specLocation": "xpack/usage/types.ts#L254-L263" }, { "kind": "interface", @@ -219072,7 +219059,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L170-L173" + "specLocation": "xpack/usage/types.ts#L182-L185" }, { "kind": "interface", @@ -219121,7 +219108,116 @@ } } ], - "specLocation": "xpack/usage/types.ts#L379-L382" + "specLocation": "xpack/usage/types.ts#L391-L394" + }, + { + "kind": "interface", + "name": { + "name": "Phase", + "namespace": "xpack.usage" + }, + "properties": [ + { + "name": "actions", + "required": true, + "type": { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + }, + { + "name": "min_age", + "required": true, + "type": { + "kind": "instance_of", + "generics": [ + { + "kind": "instance_of", + "type": { + "name": "UnitMillis", + "namespace": "_types" + } + } + ], + "type": { + "name": "DurationValue", + "namespace": "_types" + } + } + } + ], + "specLocation": "xpack/usage/types.ts#L154-L157" + }, + { + "kind": "interface", + "name": { + "name": "Phases", + "namespace": "xpack.usage" + }, + "properties": [ + { + "name": "cold", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "Phase", + "namespace": "xpack.usage" + } + } + }, + { + "name": "delete", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "Phase", + "namespace": "xpack.usage" + } + } + }, + { + "name": "frozen", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "Phase", + "namespace": "xpack.usage" + } + } + }, + { + "name": "hot", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "Phase", + "namespace": "xpack.usage" + } + } + }, + { + "name": "warm", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "Phase", + "namespace": "xpack.usage" + } + } + } + ], + "specLocation": "xpack/usage/types.ts#L159-L165" }, { "kind": "interface", @@ -219175,7 +219271,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L257-L262" + "specLocation": "xpack/usage/types.ts#L269-L274" }, { "kind": "interface", @@ -219303,7 +219399,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L415-L424" + "specLocation": "xpack/usage/types.ts#L427-L436" }, { "kind": "interface", @@ -219324,7 +219420,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L264-L266" + "specLocation": "xpack/usage/types.ts#L276-L278" }, { "kind": "request", @@ -219731,7 +219827,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L268-L271" + "specLocation": "xpack/usage/types.ts#L280-L283" }, { "kind": "interface", @@ -219761,7 +219857,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L273-L275" + "specLocation": "xpack/usage/types.ts#L285-L287" }, { "kind": "interface", @@ -219928,7 +220024,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L277-L292" + "specLocation": "xpack/usage/types.ts#L289-L304" }, { "kind": "interface", @@ -219977,7 +220073,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L426-L430" + "specLocation": "xpack/usage/types.ts#L438-L442" }, { "kind": "interface", @@ -220147,7 +220243,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L432-L445" + "specLocation": "xpack/usage/types.ts#L444-L457" }, { "kind": "interface", @@ -220190,7 +220286,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L294-L298" + "specLocation": "xpack/usage/types.ts#L306-L310" }, { "kind": "interface", @@ -220211,7 +220307,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L306-L308" + "specLocation": "xpack/usage/types.ts#L318-L320" }, { "kind": "interface", @@ -220254,7 +220350,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L310-L314" + "specLocation": "xpack/usage/types.ts#L322-L326" }, { "kind": "interface", @@ -220297,7 +220393,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L316-L320" + "specLocation": "xpack/usage/types.ts#L328-L332" }, { "kind": "interface", @@ -220340,7 +220436,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L300-L304" + "specLocation": "xpack/usage/types.ts#L312-L316" }, { "kind": "interface", @@ -220378,7 +220474,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L447-L450" + "specLocation": "xpack/usage/types.ts#L459-L462" }, { "kind": "interface", @@ -220438,7 +220534,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L384-L387" + "specLocation": "xpack/usage/types.ts#L396-L399" }, { "kind": "interface", @@ -220470,7 +220566,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L389-L392" + "specLocation": "xpack/usage/types.ts#L401-L404" }, { "kind": "interface", @@ -220519,7 +220615,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L452-L456" + "specLocation": "xpack/usage/types.ts#L464-L468" }, { "kind": "interface", @@ -220568,7 +220664,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L458-L462" + "specLocation": "xpack/usage/types.ts#L470-L474" }, { "kind": "interface", @@ -220609,7 +220705,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L410-L413" + "specLocation": "xpack/usage/types.ts#L422-L425" }, { "kind": "interface", @@ -220641,7 +220737,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L394-L396" + "specLocation": "xpack/usage/types.ts#L406-L408" }, { "kind": "interface", @@ -220728,7 +220824,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L398-L403" + "specLocation": "xpack/usage/types.ts#L410-L415" }, { "kind": "interface", @@ -220760,7 +220856,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L405-L408" + "specLocation": "xpack/usage/types.ts#L417-L420" }, { "kind": "interface", @@ -220798,7 +220894,7 @@ } } ], - "specLocation": "xpack/usage/types.ts#L464-L467" + "specLocation": "xpack/usage/types.ts#L476-L479" }, { "kind": "interface", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 9e8f1e2ee3..6d40ee434f 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -10673,7 +10673,7 @@ export interface IlmMigrateAction { export interface IlmPhase { actions?: IlmActions - min_age?: Duration | long + min_age?: Duration } export interface IlmPhases { @@ -20893,7 +20893,7 @@ export interface XpackUsageIlm { export interface XpackUsageIlmPolicyStatistics { indices_managed: integer - phases: IlmPhases + phases: XpackUsagePhases } export interface XpackUsageInvocations { @@ -21005,6 +21005,19 @@ export interface XpackUsageMonitoring extends XpackUsageBase { enabled_exporters: Record } +export interface XpackUsagePhase { + actions: string[] + min_age: DurationValue +} + +export interface XpackUsagePhases { + cold?: XpackUsagePhase + delete?: XpackUsagePhase + frozen?: XpackUsagePhase + hot?: XpackUsagePhase + warm?: XpackUsagePhase +} + export interface XpackUsageQuery { count?: integer failed?: integer diff --git a/specification/ilm/_types/Phase.ts b/specification/ilm/_types/Phase.ts index 397a64d24d..2b8a36e016 100644 --- a/specification/ilm/_types/Phase.ts +++ b/specification/ilm/_types/Phase.ts @@ -25,10 +25,7 @@ import { Duration, DurationLarge } from '@_types/Time' export class Phase { actions?: Actions - /** - * @es_quirk output as a millis number in XPack usage stats, which cannot roundtrip with a Duration as it requires a unit. - */ - min_age?: Duration | long + min_age?: Duration } export class Phases { diff --git a/specification/xpack/usage/types.ts b/specification/xpack/usage/types.ts index 2e95bf7993..b7c1589268 100644 --- a/specification/xpack/usage/types.ts +++ b/specification/xpack/usage/types.ts @@ -17,7 +17,6 @@ * under the License. */ -import { Phases } from '@ilm/_types/Phase' import { JobStatistics } from '@ml/_types/Job' import { Statistics } from '@slm/_types/SnapshotLifecycle' import { Dictionary } from '@spec_utils/Dictionary' @@ -152,6 +151,19 @@ export class HealthStatistics extends Base { invocations: Invocations } +export class Phase { + actions: string[] + min_age: DurationValue +} + +export class Phases { + cold?: Phase + delete?: Phase + frozen?: Phase + hot?: Phase + warm?: Phase +} + export class IlmPolicyStatistics { indices_managed: integer phases: Phases