From dcf9fbef154d7c3c2321f7bbc65b15d1a137f5fe Mon Sep 17 00:00:00 2001 From: Aman Chandna Date: Wed, 12 Dec 2018 16:26:12 +0530 Subject: [PATCH 1/6] Added swagger for CheckNameAvailability API --- .../CheckNameAvailability_Available.json | 18 +++ .../CheckNameAvailability_NotAvailable.json | 20 ++++ .../stable/2016-06-01/vaults.json | 104 +++++++++++++++++- .../resource-manager/readme.md | 10 ++ 4 files changed, 148 insertions(+), 4 deletions(-) create mode 100644 specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/examples/CheckNameAvailability_Available.json create mode 100644 specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/examples/CheckNameAvailability_NotAvailable.json diff --git a/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/examples/CheckNameAvailability_Available.json b/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/examples/CheckNameAvailability_Available.json new file mode 100644 index 000000000000..daf6de2f773e --- /dev/null +++ b/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/examples/CheckNameAvailability_Available.json @@ -0,0 +1,18 @@ +{ + "parameters":{ + "subscriptionId":"77777777-b0c6-47a2-b37c-d8e65a629c18", + "api-version": "2016-06-01", + "location":"westus", + "input":{ + "name":"swaggerExample", + "type": "Microsoft.RecoveryServices/Vaults" + } + }, + "responses":{ + "200":{ + "body":{ + "nameAvailable": true + } + } + } +} \ No newline at end of file diff --git a/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/examples/CheckNameAvailability_NotAvailable.json b/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/examples/CheckNameAvailability_NotAvailable.json new file mode 100644 index 000000000000..3df251dc511c --- /dev/null +++ b/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/examples/CheckNameAvailability_NotAvailable.json @@ -0,0 +1,20 @@ +{ + "parameters":{ + "subscriptionId":"77777777-b0c6-47a2-b37c-d8e65a629c18", + "api-version": "2016-06-01", + "location":"westus", + "input":{ + "name":"swaggerExample2", + "type": "Microsoft.RecoveryServices/Vaults" + } + }, + "responses":{ + "200":{ + "body":{ + "nameAvailable": false, + "reason": "AlreadyExists", + "message": "Resource already exists with the same name." + } + } + } +} \ No newline at end of file diff --git a/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/vaults.json b/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/vaults.json index 6d377229587f..a7fdc9028b20 100644 --- a/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/vaults.json +++ b/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/vaults.json @@ -18,6 +18,61 @@ "application/json" ], "paths": { + "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{location}/checkNameAvailability": { + "post": { + "tags": [ + "CheckResourceNameAvailability" + ], + "summary": "API to check for resource name availability.\r\nA name is available if no other resource exists that has the same SubscriptionId, Resource Name and Type\r\nor if one or more such resources exist, each of these must be GCed and their time of deletion be more than 24 Hours Ago", + "operationId": "CheckResourceNameAvailability_Post", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/SubscriptionId" + }, + { + "$ref": "#/parameters/ApiVersion" + }, + { + "name": "location", + "in": "path", + "description": "Location of the resource", + "required": true, + "type": "string" + }, + { + "name": "input", + "in": "body", + "description": "Contains information about Resource type and Resource name", + "required": true, + "schema": { + "$ref": "#/definitions/ResourceNameAvailabilityInput" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/ResourceNameAvailabilityResponseResource" + } + } + }, + "x-ms-examples": { + "Availability status of Resource Name when no resource with same name, type and subscription exists, nor has been deleted within last 24 hours": { + "$ref": "./examples/CheckNameAvailability_Available.json" + }, + "Availability status of Resource Name when resource with same name, type and subscription exists": { + "$ref": "./examples/CheckNameAvailability_NotAvailable.json" + } + } + } + }, "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/vaults": { "get": { "tags": [ @@ -123,7 +178,7 @@ "deprecated": false, "x-ms-pageable": { "nextLinkName": "nextLink", - "itemName":"value" + "itemName": "value" }, "x-ms-examples": { "List of Recovery Services Resources in ResourceGroup": { @@ -256,7 +311,7 @@ } }, "deprecated": false, - "x-ms-examples":{ + "x-ms-examples": { "Delete Recovery Services Vault": { "$ref": "./examples/DeleteVault.json" } @@ -589,6 +644,47 @@ }, "x-ms-azure-resource": true }, + "ResourceNameAvailabilityInput": { + "description": "Resource information, as sent to the regional resource provider from Global RP.", + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "name": { + "type": "string" + } + } + }, + "ResourceNameAvailabilityResponse": { + "description": "Response for check name availability API. Resource provider will set availability as true | false.", + "type": "object", + "properties": { + "nameAvailable": { + "type": "boolean" + }, + "reason": { + "type": "string" + }, + "message": { + "type": "string" + } + } + }, + "ResourceNameAvailabilityResponseResource": { + "description": "Response for check name availability API. Resource provider will set availability as true | false.", + "allOf": [ + { + "$ref": "#/definitions/Resource" + } + ], + "properties": { + "properties": { + "$ref": "#/definitions/ResourceNameAvailabilityResponse", + "description": "ResourceNameAvailabilityResponseResource properties" + } + } + }, "Sku": { "description": "Identifies the unique system identifier for each Azure resource.", "required": [ @@ -621,7 +717,7 @@ "$ref": "#/definitions/Resource" } ], - "properties":{ + "properties": { "location": { "description": "Resource location.", "type": "string" @@ -643,7 +739,7 @@ "$ref": "#/definitions/Resource" } ], - "properties":{ + "properties": { "location": { "description": "Resource location.", "type": "string" diff --git a/specification/recoveryservices/resource-manager/readme.md b/specification/recoveryservices/resource-manager/readme.md index db306432a8fd..2b3e86474c03 100644 --- a/specification/recoveryservices/resource-manager/readme.md +++ b/specification/recoveryservices/resource-manager/readme.md @@ -31,6 +31,16 @@ openapi-type: arm tag: package-2016-06 ``` +### Validations +Run validations when `--validate` is specified on command line + +``` yaml $(validate) +azure-validator: true +model-validator: true +semantic-validator: true +message-format: json +``` + ### Tag: package-2016-06 These settings apply only when `--tag=package-2016-06` is specified on the command line. From 98fc5bc2e92ecc7e07de2d9ee43f90561c140fe1 Mon Sep 17 00:00:00 2001 From: Aman Chandna Date: Thu, 28 Mar 2019 16:32:36 +0530 Subject: [PATCH 2/6] Adding ResourceGroupName to Route for CheckNameAvailability API and renaming ResourceNameAvailabilityInput to ResourceNameAvailabilityParameters --- .../examples/CheckNameAvailability_Available.json | 1 + .../CheckNameAvailability_NotAvailable.json | 1 + .../stable/2016-06-01/vaults.json | 13 +++++++++---- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/examples/CheckNameAvailability_Available.json b/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/examples/CheckNameAvailability_Available.json index daf6de2f773e..90f35f7f2540 100644 --- a/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/examples/CheckNameAvailability_Available.json +++ b/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/examples/CheckNameAvailability_Available.json @@ -1,6 +1,7 @@ { "parameters":{ "subscriptionId":"77777777-b0c6-47a2-b37c-d8e65a629c18", + "resourceGroupName":"resGroupFoo", "api-version": "2016-06-01", "location":"westus", "input":{ diff --git a/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/examples/CheckNameAvailability_NotAvailable.json b/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/examples/CheckNameAvailability_NotAvailable.json index 3df251dc511c..8f4920378705 100644 --- a/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/examples/CheckNameAvailability_NotAvailable.json +++ b/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/examples/CheckNameAvailability_NotAvailable.json @@ -1,6 +1,7 @@ { "parameters":{ "subscriptionId":"77777777-b0c6-47a2-b37c-d8e65a629c18", + "resourceGroupName":"resGroupBar", "api-version": "2016-06-01", "location":"westus", "input":{ diff --git a/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/vaults.json b/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/vaults.json index 6dc51e2c5240..50207b5a7e70 100644 --- a/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/vaults.json +++ b/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/vaults.json @@ -18,7 +18,7 @@ "application/json" ], "paths": { - "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{location}/checkNameAvailability": { + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/locations/{location}/checkNameAvailability": { "post": { "tags": [ "CheckResourceNameAvailability" @@ -35,6 +35,9 @@ { "$ref": "#/parameters/SubscriptionId" }, + { + "$ref": "#/parameters/ResourceGroupName" + }, { "$ref": "#/parameters/ApiVersion" }, @@ -51,7 +54,7 @@ "description": "Contains information about Resource type and Resource name", "required": true, "schema": { - "$ref": "#/definitions/ResourceNameAvailabilityInput" + "$ref": "#/definitions/ResourceNameAvailabilityParameters" } } ], @@ -644,14 +647,16 @@ }, "x-ms-azure-resource": true }, - "ResourceNameAvailabilityInput": { - "description": "Resource information, as sent to the regional resource provider from Global RP.", + "ResourceNameAvailabilityParameters": { + "description": "Resource Name availability input parameters - Resource type and resource name", "type": "object", "properties": { "type": { + "description": "Describes the Resource type: Microsoft.RecoveryServices/Vaults", "type": "string" }, "name": { + "description": "Resource name for which availability needs to be checked", "type": "string" } } From 1c52533609d5a8a806f616702ab45f6b8c514b68 Mon Sep 17 00:00:00 2001 From: Aman Chandna Date: Thu, 28 Mar 2019 17:43:11 +0530 Subject: [PATCH 3/6] Changed operationId for checkNameAvailability from CheckResourceNameAvailability_Post to RecoveryServices_CheckNameAvailability --- .../Microsoft.RecoveryServices/stable/2016-06-01/vaults.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/vaults.json b/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/vaults.json index 50207b5a7e70..03de750b102a 100644 --- a/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/vaults.json +++ b/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/vaults.json @@ -21,10 +21,10 @@ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/locations/{location}/checkNameAvailability": { "post": { "tags": [ - "CheckResourceNameAvailability" + "RecoveryServices" ], "summary": "API to check for resource name availability.\r\nA name is available if no other resource exists that has the same SubscriptionId, Resource Name and Type\r\nor if one or more such resources exist, each of these must be GCed and their time of deletion be more than 24 Hours Ago", - "operationId": "CheckResourceNameAvailability_Post", + "operationId": "RecoveryServices_CheckNameAvailability", "consumes": [ "application/json" ], From 2edb73566dac3446f8b8a54399b9f14650c32e36 Mon Sep 17 00:00:00 2001 From: Aman Chandna Date: Thu, 28 Mar 2019 18:11:53 +0530 Subject: [PATCH 4/6] Renaming ResourceNameAvailabilityResponse to ResourceNameAvailabilityResult --- .../stable/2016-06-01/vaults.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/vaults.json b/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/vaults.json index 03de750b102a..ef5b93d19394 100644 --- a/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/vaults.json +++ b/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/vaults.json @@ -62,7 +62,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/ResourceNameAvailabilityResponseResource" + "$ref": "#/definitions/ResourceNameAvailabilityResultResource" } } }, @@ -661,7 +661,7 @@ } } }, - "ResourceNameAvailabilityResponse": { + "ResourceNameAvailabilityResult": { "description": "Response for check name availability API. Resource provider will set availability as true | false.", "type": "object", "properties": { @@ -676,7 +676,7 @@ } } }, - "ResourceNameAvailabilityResponseResource": { + "ResourceNameAvailabilityResultResource": { "description": "Response for check name availability API. Resource provider will set availability as true | false.", "allOf": [ { @@ -685,8 +685,8 @@ ], "properties": { "properties": { - "$ref": "#/definitions/ResourceNameAvailabilityResponse", - "description": "ResourceNameAvailabilityResponseResource properties" + "$ref": "#/definitions/ResourceNameAvailabilityResult", + "description": "ResourceNameAvailabilityResultResource properties" } } }, From f97eae58835c2bcc143d6c854a183830f257dda0 Mon Sep 17 00:00:00 2001 From: Aman Chandna Date: Fri, 29 Mar 2019 00:35:47 +0530 Subject: [PATCH 5/6] Renaming ResourceNameAvailabilityResult to CheckNameAvailabilityResult and changing GCed to GC'ed in swagger API summary --- .../stable/2016-06-01/vaults.json | 62 +++++++++---------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/vaults.json b/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/vaults.json index ef5b93d19394..dde76186932e 100644 --- a/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/vaults.json +++ b/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/vaults.json @@ -23,7 +23,7 @@ "tags": [ "RecoveryServices" ], - "summary": "API to check for resource name availability.\r\nA name is available if no other resource exists that has the same SubscriptionId, Resource Name and Type\r\nor if one or more such resources exist, each of these must be GCed and their time of deletion be more than 24 Hours Ago", + "summary": "API to check for resource name availability.\r\nA name is available if no other resource exists that has the same SubscriptionId, Resource Name and Type\r\nor if one or more such resources exist, each of these must be GC'd and their time of deletion be more than 24 Hours Ago", "operationId": "RecoveryServices_CheckNameAvailability", "consumes": [ "application/json" @@ -62,7 +62,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/ResourceNameAvailabilityResultResource" + "$ref": "#/definitions/CheckNameAvailabilityResultResource" } } }, @@ -519,6 +519,35 @@ } }, "definitions": { + "CheckNameAvailabilityResult": { + "description": "Response for check name availability API. Resource provider will set availability as true | false.", + "type": "object", + "properties": { + "nameAvailable": { + "type": "boolean" + }, + "reason": { + "type": "string" + }, + "message": { + "type": "string" + } + } + }, + "CheckNameAvailabilityResultResource": { + "description": "Response for check name availability API. Resource provider will set availability as true | false.", + "allOf": [ + { + "$ref": "#/definitions/Resource" + } + ], + "properties": { + "properties": { + "$ref": "#/definitions/CheckNameAvailabilityResult", + "description": "CheckNameAvailabilityResultResource properties" + } + } + }, "ClientDiscoveryDisplay": { "description": "Localized display information of an operation.", "type": "object", @@ -661,35 +690,6 @@ } } }, - "ResourceNameAvailabilityResult": { - "description": "Response for check name availability API. Resource provider will set availability as true | false.", - "type": "object", - "properties": { - "nameAvailable": { - "type": "boolean" - }, - "reason": { - "type": "string" - }, - "message": { - "type": "string" - } - } - }, - "ResourceNameAvailabilityResultResource": { - "description": "Response for check name availability API. Resource provider will set availability as true | false.", - "allOf": [ - { - "$ref": "#/definitions/Resource" - } - ], - "properties": { - "properties": { - "$ref": "#/definitions/ResourceNameAvailabilityResult", - "description": "ResourceNameAvailabilityResultResource properties" - } - } - }, "Sku": { "description": "Identifies the unique system identifier for each Azure resource.", "required": [ From cc6ecf84a7e767b9299aa77868b43817d17bde4c Mon Sep 17 00:00:00 2001 From: Aman Chandna Date: Fri, 29 Mar 2019 13:41:24 +0530 Subject: [PATCH 6/6] Renaming ResourceNameAvailabilityParameters to CheckNameAvailabilityParameters --- .../stable/2016-06-01/vaults.json | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/vaults.json b/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/vaults.json index dde76186932e..c00c530a0ca4 100644 --- a/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/vaults.json +++ b/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/vaults.json @@ -54,7 +54,7 @@ "description": "Contains information about Resource type and Resource name", "required": true, "schema": { - "$ref": "#/definitions/ResourceNameAvailabilityParameters" + "$ref": "#/definitions/CheckNameAvailabilityParameters" } } ], @@ -519,6 +519,20 @@ } }, "definitions": { + "CheckNameAvailabilityParameters": { + "description": "Resource Name availability input parameters - Resource type and resource name", + "type": "object", + "properties": { + "type": { + "description": "Describes the Resource type: Microsoft.RecoveryServices/Vaults", + "type": "string" + }, + "name": { + "description": "Resource name for which availability needs to be checked", + "type": "string" + } + } + }, "CheckNameAvailabilityResult": { "description": "Response for check name availability API. Resource provider will set availability as true | false.", "type": "object", @@ -676,20 +690,6 @@ }, "x-ms-azure-resource": true }, - "ResourceNameAvailabilityParameters": { - "description": "Resource Name availability input parameters - Resource type and resource name", - "type": "object", - "properties": { - "type": { - "description": "Describes the Resource type: Microsoft.RecoveryServices/Vaults", - "type": "string" - }, - "name": { - "description": "Resource name for which availability needs to be checked", - "type": "string" - } - } - }, "Sku": { "description": "Identifies the unique system identifier for each Azure resource.", "required": [