diff --git a/.chronus/changes/specs_arm_ResourceCheckExistence_operations-2024-11-3-11-13-22.md b/.chronus/changes/specs_arm_ResourceCheckExistence_operations-2024-11-3-11-13-22.md new file mode 100644 index 0000000000..1bfe0379f1 --- /dev/null +++ b/.chronus/changes/specs_arm_ResourceCheckExistence_operations-2024-11-3-11-13-22.md @@ -0,0 +1,7 @@ +--- +changeKind: feature +packages: + - "@azure-tools/azure-http-specs" +--- + +Added ARMResourceCheckExistence case for ARM tests. \ No newline at end of file diff --git a/packages/azure-http-specs/spec-summary.md b/packages/azure-http-specs/spec-summary.md index 0a1b2441be..e4446efad2 100644 --- a/packages/azure-http-specs/spec-summary.md +++ b/packages/azure-http-specs/spec-summary.md @@ -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 @@ -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 @@ -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 diff --git a/packages/azure-http-specs/specs/azure/resource-manager/resources/mockapi.ts b/packages/azure-http-specs/specs/azure/resource-manager/resources/mockapi.ts index 78e5dd3f64..7568a6b1ce 100644 --- a/packages/azure-http-specs/specs/azure/resource-manager/resources/mockapi.ts +++ b/packages/azure-http-specs/specs/azure/resource-manager/resources/mockapi.ts @@ -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", +}); diff --git a/packages/azure-http-specs/specs/azure/resource-manager/resources/toplevel.tsp b/packages/azure-http-specs/specs/azure/resource-manager/resources/toplevel.tsp index 2549bd3649..0d59a16c37 100644 --- a/packages/azure-http-specs/specs/azure/resource-manager/resources/toplevel.tsp +++ b/packages/azure-http-specs/specs/azure/resource-manager/resources/toplevel.tsp @@ -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 { @@ -88,6 +89,7 @@ interface TopLevel { } } ``` + Expected response body: ```json { @@ -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 { @@ -125,6 +128,7 @@ interface TopLevel { } } ``` + Expected response body: ```json { @@ -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; + + @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; }