-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Swagger details for CheckNameAvailability API #4900
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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." | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the name should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done in New PR: #5496 |
||
"description": "Resource information, as sent to the regional resource provider from Global RP.", | ||
"type": "object", | ||
"properties": { | ||
"type": { | ||
"type": "string" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What exactly is type, would it make more sense to be an enum? Perhaps a better description would help. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is the Resource Type: Microsoft.RecoveryServices/vaults. Added the description above in new PR: #5496 |
||
}, | ||
"name": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"ResourceNameAvailabilityResponse": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this needs to be its own model, can't these fields be embedded directly in the parent? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The fields present in the response are completely different to that in the parent. |
||
"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": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done in New PR: #5496 |
||
"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" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will generate a client named
CheckResourceNameAvailability
with one methodPost
which isn't a very good user experience. A better name would be something likeRecoveryServices_CheckNameAvailability
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in New PR: #5496