From 0f39a2d56070d2bc4251494525cb8af88583a938 Mon Sep 17 00:00:00 2001 From: Abhay Pratap Date: Fri, 7 Jul 2023 12:02:13 -0700 Subject: [PATCH] S360 Item - Missing Get SubscriptionOperations for 2021-10-01 version. (#24395) * Resolving S320 Item - Missing Get SubscriptionOperations for 2021-10-01 version. * Fix pipeline suggestions. * Minor fix. * Make Get Subscription operations sync in this version. * Added suppress rules for failing lint errors. * Fix suppression Issues. * Minor fix suppression GetOperation200. * Address minor fixes. * Address GetOperation200 changes. * Update readme.md: attempt suppression fix by adding ["202"] to "responses" to path --------- Co-authored-by: Abhay Pratap Co-authored-by: Konrad Jamrozik --- .../examples/getSubscriptionOperation.json | 19 ++++++ .../stable/2021-10-01/subscriptions.json | 61 +++++++++++++++++++ .../subscription/resource-manager/readme.md | 8 +++ 3 files changed, 88 insertions(+) create mode 100644 specification/subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/examples/getSubscriptionOperation.json diff --git a/specification/subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/examples/getSubscriptionOperation.json b/specification/subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/examples/getSubscriptionOperation.json new file mode 100644 index 000000000000..fdbed844fba1 --- /dev/null +++ b/specification/subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/examples/getSubscriptionOperation.json @@ -0,0 +1,19 @@ +{ + "parameters": { + "operationId": "e4b8d068-f574-462a-a76f-6fa0afc613c9", + "api-version": "2021-10-01" + }, + "responses": { + "202": { + "headers": { + "Location": "/providers/Microsoft.Subscription/subscriptionOperations/e4b8d068-f574-462a-a76f-6fa0afc613c9?api-version=2021-10-01", + "Retry-After": 8 + } + }, + "200": { + "body": { + "subscriptionLink": "/subscriptions/4df8d5c2-1b7e-4dd5-bc61-640704bde633" + } + } + } +} diff --git a/specification/subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/subscriptions.json b/specification/subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/subscriptions.json index 6fd06515f344..f9ff4225fe8a 100644 --- a/specification/subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/subscriptions.json +++ b/specification/subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/subscriptions.json @@ -118,6 +118,57 @@ } } }, + "/providers/Microsoft.Subscription/subscriptionOperations/{operationId}": { + "get": { + "description": "Get the status of the pending Microsoft.Subscription API operations.", + "operationId": "SubscriptionOperation_Get", + "x-ms-examples": { + "getPendingSubscriptionOperations": { + "$ref": "./examples/getSubscriptionOperation.json" + } + }, + "responses": { + "200": { + "description": "Successful completion of the asynchronous operation", + "schema": { + "$ref": "#/definitions/SubscriptionCreationResult" + } + }, + "202": { + "description": "Accepted. Subscription update is in progress.", + "headers": { + "Location": { + "description": "The URL where the status of the asynchronous operation can be checked.", + "type": "string" + }, + "Retry-After": { + "description": "The amount of delay to use while the status of the operation is checked. The value is expressed in seconds.", + "type": "integer", + "format": "int64" + } + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "#/definitions/ErrorResponseBody" + } + } + }, + "parameters": [ + { + "name": "operationId", + "in": "path", + "description": "The operation ID, which can be found from the Location field in the generate recommendation response header.", + "required": true, + "type": "string" + }, + { + "$ref": "#/parameters/apiVersionParameter" + } + ] + } + }, "/providers/Microsoft.Subscription/operations": { "get": { "description": "Lists all of the available Microsoft.Subscription API operations.", @@ -573,6 +624,16 @@ } } }, + "SubscriptionCreationResult": { + "description": "The created subscription object.", + "type": "object", + "properties": { + "subscriptionLink": { + "description": "The link to the new subscription. Use this link to check the status of subscription creation operation.", + "type": "string" + } + } + }, "SubscriptionName": { "type": "object", "description": "The new name of the subscription.", diff --git a/specification/subscription/resource-manager/readme.md b/specification/subscription/resource-manager/readme.md index 3e61bbf93aa6..d6fb86b1cd7d 100644 --- a/specification/subscription/resource-manager/readme.md +++ b/specification/subscription/resource-manager/readme.md @@ -23,6 +23,14 @@ To see additional help and options, run: ``` yaml directive: - suppress: R2059 + - suppress: LroExtension + from: subscriptions.json + where: $.paths["/providers/Microsoft.Subscription/subscriptionOperations/{operationId}"].get + reason: Avoid Lro changes on this api to return 202. + - suppress: GetOperation200 + from: subscriptions.json + where: $.paths["/providers/Microsoft.Subscription/subscriptionOperations/{operationId}"].get.responses["202"] + reason: This api will return 200 and 202 response. ```