-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
azure-http-specs, add ARM CheckNameAvailability operations case (#1934)
### Context - fix Azure/cadl-ranch#680 - not covering legacy cases
- Loading branch information
Showing
5 changed files
with
173 additions
and
0 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
.chronus/changes/specs_arm_CheckNameAvailability_operations-2024-10-29-17-11-41.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
changeKind: feature | ||
packages: | ||
- "@azure-tools/azure-http-specs" | ||
--- | ||
|
||
Added CheckNameAvailability operations case for ARM tests. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
...re-http-specs/specs/azure/resource-manager/operation-templates/checkname-availability.tsp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import "@typespec/http"; | ||
import "@typespec/rest"; | ||
import "@azure-tools/typespec-azure-core"; | ||
import "@azure-tools/typespec-azure-resource-manager"; | ||
import "@typespec/spector"; | ||
|
||
using TypeSpec.Http; | ||
using TypeSpec.Rest; | ||
using Azure.Core; | ||
using Azure.ResourceManager; | ||
using TypeSpec.OpenAPI; | ||
using Spector; | ||
|
||
namespace Azure.ResourceManager.OperationTemplates; | ||
|
||
interface CheckNameAvailability { | ||
@scenario | ||
@scenarioDoc(""" | ||
Resource POST operation. | ||
Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.OperationTemplates/checkNameAvailability | ||
Expected query parameter: api-version=2023-12-01-preview | ||
Expected request body: | ||
```json | ||
{ | ||
"name": "checkName", | ||
"type": "Microsoft.Web/site" | ||
} | ||
``` | ||
Expected response body: | ||
```json | ||
{ | ||
"nameAvailable": false, | ||
"reason": "AlreadyExists", | ||
"message": "Hostname 'checkName' already exists. Please select a different name." | ||
} | ||
``` | ||
""") | ||
checkGlobal is checkGlobalNameAvailability; | ||
|
||
@scenario | ||
@scenarioDoc(""" | ||
Resource POST operation. | ||
Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.OperationTemplates/locations/westus/checkNameAvailability | ||
Expected query parameter: api-version=2023-12-01-preview | ||
Expected request body: | ||
```json | ||
{ | ||
"name": "checkName", | ||
"type": "Microsoft.Web/site", | ||
} | ||
``` | ||
Expected response body: | ||
```json | ||
{ | ||
"nameAvailable": false, | ||
"reason": "AlreadyExists", | ||
"message": "Hostname 'checkName' already exists. Please select a different name." | ||
} | ||
``` | ||
""") | ||
checkLocal is checkLocalNameAvailability; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters