From 8f79089cfa41f8a19828057160178b0b2c8cce84 Mon Sep 17 00:00:00 2001 From: Kai Ru Date: Mon, 14 Dec 2020 18:00:55 +0800 Subject: [PATCH 1/5] add polymorphism --- .../stable/2020-05-15/timeseriesinsights.json | 6 ---- .../resource-manager/readme.az.md | 35 +++++++++++++++++++ .../resource-manager/readme.cli.md | 9 +++++ 3 files changed, 44 insertions(+), 6 deletions(-) create mode 100644 specification/timeseriesinsights/resource-manager/readme.az.md create mode 100644 specification/timeseriesinsights/resource-manager/readme.cli.md diff --git a/specification/timeseriesinsights/resource-manager/Microsoft.TimeSeriesInsights/stable/2020-05-15/timeseriesinsights.json b/specification/timeseriesinsights/resource-manager/Microsoft.TimeSeriesInsights/stable/2020-05-15/timeseriesinsights.json index 190ce3b7cb64..0c064deabbb5 100644 --- a/specification/timeseriesinsights/resource-manager/Microsoft.TimeSeriesInsights/stable/2020-05-15/timeseriesinsights.json +++ b/specification/timeseriesinsights/resource-manager/Microsoft.TimeSeriesInsights/stable/2020-05-15/timeseriesinsights.json @@ -1618,9 +1618,6 @@ }, { "$ref": "#/definitions/EnvironmentResourceProperties" - }, - { - "$ref": "#/definitions/ResourceProperties" } ], "required": [ @@ -1654,9 +1651,6 @@ "allOf": [ { "$ref": "#/definitions/EnvironmentResourceProperties" - }, - { - "$ref": "#/definitions/ResourceProperties" } ], "description": "Properties of the Gen2 environment." diff --git a/specification/timeseriesinsights/resource-manager/readme.az.md b/specification/timeseriesinsights/resource-manager/readme.az.md new file mode 100644 index 000000000000..4d5d649283f0 --- /dev/null +++ b/specification/timeseriesinsights/resource-manager/readme.az.md @@ -0,0 +1,35 @@ +## AZ +These settings apply only when `--az` is specified on the command line. +``` yaml $(az) +az: + extensions: timeseriesinsights + namespace: azure.mgmt.timeseriesinsights + package-name: azure-mgmt-timeseriesinsights +az-output-folder: $(azure-cli-extension-folder)/src/timeseriesinsights +python-sdk-output-folder: "$(az-output-folder)/azext_timeseriesinsights/vendored_sdks/timeseriesinsights" +# add additinal configuration here specific for Azure CLI +# refer to the faq.md for more details +``` + +# Az.TimeSeriesInsights +This directory contains the Cli common model for the TimeSeriesInsights service. + +> Metadata +``` yaml +# Migrated from Powershell's readme + +extension-mode: experimental + +cli: + cli-directive: + - where: + group: 'Environments' + op: 'CreateOrUpdate' + param: 'parameters' + poly-resource: true + - where: + group: 'EventSources' + op: 'CreateOrUpdate' + param: 'parameters' + poly-resource: true +``` \ No newline at end of file diff --git a/specification/timeseriesinsights/resource-manager/readme.cli.md b/specification/timeseriesinsights/resource-manager/readme.cli.md new file mode 100644 index 000000000000..3e807cb80070 --- /dev/null +++ b/specification/timeseriesinsights/resource-manager/readme.cli.md @@ -0,0 +1,9 @@ + +# Az.TimeSeriesInsights +This directory contains the Cli common model for the Billing service. + +> Metadata +``` yaml +# Migrated from Powershell's readme + +``` From bc38e13b184e8b6e0528d2c00c336ba9ade3e4f0 Mon Sep 17 00:00:00 2001 From: Kai Ru Date: Mon, 21 Dec 2020 17:57:14 +0800 Subject: [PATCH 2/5] fix polymorphy issues for enviroment update and event-source update --- .../stable/2020-05-15/timeseriesinsights.json | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/specification/timeseriesinsights/resource-manager/Microsoft.TimeSeriesInsights/stable/2020-05-15/timeseriesinsights.json b/specification/timeseriesinsights/resource-manager/Microsoft.TimeSeriesInsights/stable/2020-05-15/timeseriesinsights.json index 0c064deabbb5..4bd8ce2a695c 100644 --- a/specification/timeseriesinsights/resource-manager/Microsoft.TimeSeriesInsights/stable/2020-05-15/timeseriesinsights.json +++ b/specification/timeseriesinsights/resource-manager/Microsoft.TimeSeriesInsights/stable/2020-05-15/timeseriesinsights.json @@ -1406,7 +1406,21 @@ }, "EnvironmentUpdateParameters": { "type": "object", + "discriminator": "kind", "properties": { + "kind": { + "type": "string", + "readOnly": true, + "description": "The kind of the environment.", + "enum": [ + "Gen1", + "Gen2" + ], + "x-ms-enum": { + "name": "EnvironmentKind", + "modelAsString": true + } + }, "tags": { "type": "object", "additionalProperties": { @@ -1419,6 +1433,7 @@ }, "Gen1EnvironmentUpdateParameters": { "type": "object", + "x-ms-discriminator-value": "Gen1", "properties": { "sku": { "$ref": "#/definitions/Sku", @@ -1439,6 +1454,7 @@ }, "Gen2EnvironmentUpdateParameters": { "type": "object", + "x-ms-discriminator-value": "Gen2", "properties": { "properties": { "x-ms-client-flatten": true, @@ -1894,8 +1910,22 @@ "description": "Parameters supplied to the Create or Update Event Source operation for an IoTHub event source." }, "EventSourceUpdateParameters": { + "discriminator": "kind", "type": "object", "properties": { + "kind": { + "type": "string", + "readOnly": true, + "description": "The kind of the event source.", + "enum": [ + "Microsoft.EventHub", + "Microsoft.IoTHub" + ], + "x-ms-enum": { + "name": "EventSourceKind", + "modelAsString": true + } + }, "tags": { "type": "object", "additionalProperties": { From d5633eb65c38e8ba0d898c09e0fa8cd2a79ada0c Mon Sep 17 00:00:00 2001 From: Kai Ru Date: Tue, 22 Dec 2020 15:38:12 +0800 Subject: [PATCH 3/5] remove readme.az.md --- .../resource-manager/readme.az.md | 35 ------------------- 1 file changed, 35 deletions(-) delete mode 100644 specification/timeseriesinsights/resource-manager/readme.az.md diff --git a/specification/timeseriesinsights/resource-manager/readme.az.md b/specification/timeseriesinsights/resource-manager/readme.az.md deleted file mode 100644 index 4d5d649283f0..000000000000 --- a/specification/timeseriesinsights/resource-manager/readme.az.md +++ /dev/null @@ -1,35 +0,0 @@ -## AZ -These settings apply only when `--az` is specified on the command line. -``` yaml $(az) -az: - extensions: timeseriesinsights - namespace: azure.mgmt.timeseriesinsights - package-name: azure-mgmt-timeseriesinsights -az-output-folder: $(azure-cli-extension-folder)/src/timeseriesinsights -python-sdk-output-folder: "$(az-output-folder)/azext_timeseriesinsights/vendored_sdks/timeseriesinsights" -# add additinal configuration here specific for Azure CLI -# refer to the faq.md for more details -``` - -# Az.TimeSeriesInsights -This directory contains the Cli common model for the TimeSeriesInsights service. - -> Metadata -``` yaml -# Migrated from Powershell's readme - -extension-mode: experimental - -cli: - cli-directive: - - where: - group: 'Environments' - op: 'CreateOrUpdate' - param: 'parameters' - poly-resource: true - - where: - group: 'EventSources' - op: 'CreateOrUpdate' - param: 'parameters' - poly-resource: true -``` \ No newline at end of file From 321c76f8253cfcdaa79c2045eb0a82abbda7c88a Mon Sep 17 00:00:00 2001 From: Kai Ru Date: Tue, 22 Dec 2020 15:40:03 +0800 Subject: [PATCH 4/5] remove readme.cli.md --- .../timeseriesinsights/resource-manager/readme.cli.md | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 specification/timeseriesinsights/resource-manager/readme.cli.md diff --git a/specification/timeseriesinsights/resource-manager/readme.cli.md b/specification/timeseriesinsights/resource-manager/readme.cli.md deleted file mode 100644 index 3e807cb80070..000000000000 --- a/specification/timeseriesinsights/resource-manager/readme.cli.md +++ /dev/null @@ -1,9 +0,0 @@ - -# Az.TimeSeriesInsights -This directory contains the Cli common model for the Billing service. - -> Metadata -``` yaml -# Migrated from Powershell's readme - -``` From 16f6833a6a939fb2c3795899b1ad2cca69f01041 Mon Sep 17 00:00:00 2001 From: Kai Ru Date: Tue, 9 Feb 2021 14:46:52 +0800 Subject: [PATCH 5/5] add suppress for kind property in timeseriesinsights.json --- .../timeseriesinsights/resource-manager/readme.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/specification/timeseriesinsights/resource-manager/readme.md b/specification/timeseriesinsights/resource-manager/readme.md index 6e5d24befcad..ab4686fed747 100644 --- a/specification/timeseriesinsights/resource-manager/readme.md +++ b/specification/timeseriesinsights/resource-manager/readme.md @@ -68,6 +68,15 @@ input-file: ``` yaml directive: + - suppress: READONLY_PROPERTY_NOT_ALLOWED_IN_REQUEST + where: + - $.definitions.EnvironmentUpdateParameters.properties.kind + - $.definitions.EventSourceUpdateParameters.properties.kind + from: timeseriesinsights.json + reason: This property is the discriminator for polymorph, but it can not be in request body. + - suppress: OAV131 # DISCRIMINATOR_NOT_REQUIRED + from: timeseriesinsights.json + reason: kind is a non-settable property from the client in patch method. - suppress: R3025 # Tracked resource 'XXX' must have a get operation where: - $.definitions.StandardEnvironmentResource