Skip to content
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

azure-http-specs, add ARM Resource Check Existence operations case #1940

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: feature
packages:
- "@azure-tools/azure-http-specs"
---

Added ARMResourceCheckExistence case for ARM tests.
32 changes: 22 additions & 10 deletions packages/azure-http-specs/spec-summary.md
Original file line number Diff line number Diff line change
Expand Up @@ -1478,17 +1478,27 @@ Expected response body:

- Endpoint: `post https://management.azure.com`

Resource sync action.
Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/actionSync
Expected query parameter: api-version=2023-12-01-preview
Expected request body:
Resource sync action.
Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/actionSync
Expected query parameter: api-version=2023-12-01-preview

```json
{
"message": "Resource action at top level.",
"urgent": true
}
```
Expected request body:

```json
{
"message": "Resource action at top level.",
"urgent": true
}
```

### Azure_ResourceManager_Resources_TopLevel_checkExistence

- Endpoint: `head https://management.azure.com`

Resource HEAD operation.
Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top
Expected query parameter: api-version=2023-12-01-preview
Expected response status code: 204

### Azure_ResourceManager_Resources_TopLevel_createOrReplace

Expand All @@ -1497,6 +1507,7 @@ Expected response body:
Resource PUT operation.
Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top
Expected query parameter: api-version=2023-12-01-preview

Expected request body:

```json
Expand Down Expand Up @@ -1645,6 +1656,7 @@ Expected response body:
Resource PATCH operation.
Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top
Expected query parameter: api-version=2023-12-01-preview

Expected request body:

```json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -415,3 +415,20 @@ Scenarios.Azure_ResourceManager_Resources_Nested_listByTopLevelTrackedResource =
},
kind: "MockApiDefinition",
});

Scenarios.Azure_ResourceManager_Resources_TopLevel_checkExistence = passOnSuccess({
uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/:topLevelResourceName",
method: "head",
request: {
params: {
subscriptionId: SUBSCRIPTION_ID_EXPECTED,
resourceGroup: RESOURCE_GROUP_EXPECTED,
topLevelResourceName: "top",
"api-version": "2023-12-01-preview",
},
},
response: {
status: 204,
},
kind: "MockApiDefinition",
});
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ interface TopLevel {
Resource PUT operation.
Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top
Expected query parameter: api-version=2023-12-01-preview

Expected request body:
```json
{
Expand All @@ -88,6 +89,7 @@ interface TopLevel {
}
}
```

Expected response body:
```json
{
Expand Down Expand Up @@ -117,6 +119,7 @@ interface TopLevel {
Resource PATCH operation.
Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top
Expected query parameter: api-version=2023-12-01-preview

Expected request body:
```json
{
Expand All @@ -125,6 +128,7 @@ interface TopLevel {
}
}
```

Expected response body:
```json
{
Expand Down Expand Up @@ -225,16 +229,26 @@ interface TopLevel {

@scenario
@scenarioDoc("""
Resource sync action.
Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/actionSync
Expected query parameter: api-version=2023-12-01-preview
Expected request body:
```json
{
"message": "Resource action at top level.",
"urgent": true
}
```
Resource sync action.
Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/actionSync
Expected query parameter: api-version=2023-12-01-preview

Expected request body:
```json
{
"message": "Resource action at top level.",
"urgent": true
}
```
""")
actionSync is ArmResourceActionNoContentSync<TopLevelTrackedResource, NotificationDetails>;

@scenario
@scenarioDoc("""
Resource HEAD operation.
Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top
Expected query parameter: api-version=2023-12-01-preview
Expected response status code: 204
""")
checkExistence is ArmResourceCheckExistence<TopLevelTrackedResource>;
}
Loading