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..90f35f7f2540 --- /dev/null +++ b/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/examples/CheckNameAvailability_Available.json @@ -0,0 +1,19 @@ +{ + "parameters":{ + "subscriptionId":"77777777-b0c6-47a2-b37c-d8e65a629c18", + "resourceGroupName":"resGroupFoo", + "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..8f4920378705 --- /dev/null +++ b/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2016-06-01/examples/CheckNameAvailability_NotAvailable.json @@ -0,0 +1,21 @@ +{ + "parameters":{ + "subscriptionId":"77777777-b0c6-47a2-b37c-d8e65a629c18", + "resourceGroupName":"resGroupBar", + "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 bd034da9be0d..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 @@ -18,6 +18,64 @@ "application/json" ], "paths": { + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/locations/{location}/checkNameAvailability": { + "post": { + "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 GC'd and their time of deletion be more than 24 Hours Ago", + "operationId": "RecoveryServices_CheckNameAvailability", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/SubscriptionId" + }, + { + "$ref": "#/parameters/ResourceGroupName" + }, + { + "$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/CheckNameAvailabilityParameters" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/CheckNameAvailabilityResultResource" + } + } + }, + "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 +181,7 @@ "deprecated": false, "x-ms-pageable": { "nextLinkName": "nextLink", - "itemName":"value" + "itemName": "value" }, "x-ms-examples": { "List of Recovery Services Resources in ResourceGroup": { @@ -256,7 +314,7 @@ } }, "deprecated": false, - "x-ms-examples":{ + "x-ms-examples": { "Delete Recovery Services Vault": { "$ref": "./examples/DeleteVault.json" } @@ -461,6 +519,49 @@ } }, "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", + "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", @@ -621,7 +722,7 @@ "$ref": "#/definitions/Resource" } ], - "properties":{ + "properties": { "location": { "description": "Resource location.", "type": "string" @@ -643,7 +744,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 204d82352b5e..5c7a92ad9e24 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.