Skip to content

Commit

Permalink
Added Swagger details for CheckNameAvailability API (#5496)
Browse files Browse the repository at this point in the history
* Added swagger for CheckNameAvailability API

* Adding ResourceGroupName to Route for CheckNameAvailability API and renaming ResourceNameAvailabilityInput to ResourceNameAvailabilityParameters

* Changed operationId for checkNameAvailability from CheckResourceNameAvailability_Post to RecoveryServices_CheckNameAvailability

* Renaming ResourceNameAvailabilityResponse to ResourceNameAvailabilityResult

* Renaming ResourceNameAvailabilityResult to CheckNameAvailabilityResult and changing GCed to GC'ed in swagger API summary

* Renaming ResourceNameAvailabilityParameters to CheckNameAvailabilityParameters
  • Loading branch information
amchandn authored and anuchandy committed Apr 3, 2019
1 parent cf480d9 commit e7ed198
Show file tree
Hide file tree
Showing 4 changed files with 155 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -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
}
}
}
}
Original file line number Diff line number Diff line change
@@ -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."
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -256,7 +314,7 @@
}
},
"deprecated": false,
"x-ms-examples":{
"x-ms-examples": {
"Delete Recovery Services Vault": {
"$ref": "./examples/DeleteVault.json"
}
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -621,7 +722,7 @@
"$ref": "#/definitions/Resource"
}
],
"properties":{
"properties": {
"location": {
"description": "Resource location.",
"type": "string"
Expand All @@ -643,7 +744,7 @@
"$ref": "#/definitions/Resource"
}
],
"properties":{
"properties": {
"location": {
"description": "Resource location.",
"type": "string"
Expand Down
10 changes: 10 additions & 0 deletions specification/recoveryservices/resource-manager/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit e7ed198

Please sign in to comment.