diff --git a/packages/cadl-ranch-specs/cadl-ranch-summary.md b/packages/cadl-ranch-specs/cadl-ranch-summary.md index fad68d4e4..da850726b 100644 --- a/packages/cadl-ranch-specs/cadl-ranch-summary.md +++ b/packages/cadl-ranch-specs/cadl-ranch-summary.md @@ -912,8 +912,8 @@ Expected response body: - Endpoint: `put https://management.azure.com` Resource PUT operation. -Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/locations/eastus/providers/Azure.ResourceManager.Resources/locationResources/resource -Expected query parameter: api-version=2023-12-01-preview +Expected path: /subscriptions/-00000001-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources/resource +Expected query parameter: api-version=2022-12-01-preview Expected request body: ```json @@ -928,12 +928,12 @@ Expected response body: ```json { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/eastus/providers/Azure.ResourceManager.Resources/locationResources/resource", + "id": "/subscriptions/-00000001-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources/resource", "name": "resource", "type": "Azure.ResourceManager.Resources/locationResources", "properties": { "description": "valid", - "provisioningState": "Succeeded" + "provisioningState": "Succeeded", }, "systemData": { "createdBy": "AzureSDK", @@ -951,7 +951,7 @@ Expected response body: - Endpoint: `delete https://management.azure.com` Resource DELETE operation. -Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/locations/eastus/providers/Azure.ResourceManager.Resources/locationResources/resource +Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources/resource Expected query parameter: api-version=2023-12-01-preview ```` @@ -962,13 +962,13 @@ Expected response status code: 204 - Endpoint: `get https://management.azure.com` Resource GET operation. -Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/locations/eastus/providers/Azure.ResourceManager.Resources/locationResources/resource +Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources/resource Expected query parameter: api-version=2023-12-01-preview Expected response body: ```json { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/eastus/providers/Azure.ResourceManager.Resources/locationResources/resource", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources/resource", "name": "resource", "type": "Azure.ResourceManager.Resources/locationResources", "properties":{ @@ -991,7 +991,7 @@ Expected response body: - Endpoint: `get https://management.azure.com` Resource LIST by resource group operation. -Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/locations/eastus/providers/Azure.ResourceManager.Resources/locationResources +Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources Expected query parameter: api-version=2023-12-01-preview Expected response body: @@ -999,7 +999,7 @@ Expected response body: ```json { "value": [{ - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/eastus/providers/Azure.ResourceManager.Resources/locationResources/resource", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources/resource", "name": "resource", "type": "Azure.ResourceManager.Resources/locationResources", "properties":{ @@ -1023,7 +1023,7 @@ Expected response body: - Endpoint: `patch https://management.azure.com` Resource PATCH operation. -Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/locations/eastus/providers/Azure.ResourceManager.Resources/locationResources/resource +Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources/resource Expected query parameter: api-version=2023-12-01-preview Expected request body: @@ -1039,7 +1039,7 @@ Expected response body: ```json { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/eastus/providers/Azure.ResourceManager.Resources/locationResources/resource", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources/resource", "name": "resource", "type": "Azure.ResourceManager.Resources/locationResources", "properties":{ diff --git a/packages/cadl-ranch-specs/http/azure/resource-manager/resources/location.tsp b/packages/cadl-ranch-specs/http/azure/resource-manager/resources/location.tsp index 3cd482e0d..1703594cd 100644 --- a/packages/cadl-ranch-specs/http/azure/resource-manager/resources/location.tsp +++ b/packages/cadl-ranch-specs/http/azure/resource-manager/resources/location.tsp @@ -11,7 +11,8 @@ using TypeSpec.OpenAPI; namespace Azure.ResourceManager.Resources; -@locationResource +@resource("locationResources") +@parentResource(ResourceGroupLocationResource) model LocationResource is ProxyResource { ...ResourceNameParameter; } @@ -31,13 +32,13 @@ interface LocationResources { @scenario @scenarioDoc(""" Resource GET operation. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/locations/eastus/providers/Azure.ResourceManager.Resources/locationResources/resource + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources/resource Expected query parameter: api-version=2023-12-01-preview Expected response body: ```json { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/eastus/providers/Azure.ResourceManager.Resources/locationResources/resource", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources/resource", "name": "resource", "type": "Azure.ResourceManager.Resources/locationResources", "properties":{ @@ -60,8 +61,8 @@ interface LocationResources { @scenario @scenarioDoc(""" Resource PUT operation. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/locations/eastus/providers/Azure.ResourceManager.Resources/locationResources/resource - Expected query parameter: api-version=2023-12-01-preview + Expected path: /subscriptions/-00000001-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources/resource + Expected query parameter: api-version=2022-12-01-preview Expected request body: ```json { @@ -73,12 +74,12 @@ interface LocationResources { Expected response body: ```json { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/eastus/providers/Azure.ResourceManager.Resources/locationResources/resource", + "id": "/subscriptions/-00000001-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources/resource", "name": "resource", "type": "Azure.ResourceManager.Resources/locationResources", "properties": { "description": "valid", - "provisioningState": "Succeeded" + "provisioningState": "Succeeded", }, "systemData": { "createdBy": "AzureSDK", @@ -96,7 +97,7 @@ interface LocationResources { @scenario @scenarioDoc(""" Resource PATCH operation. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/locations/eastus/providers/Azure.ResourceManager.Resources/locationResources/resource + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources/resource Expected query parameter: api-version=2023-12-01-preview Expected request body: ```json @@ -109,7 +110,7 @@ interface LocationResources { Expected response body: ```json { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/eastus/providers/Azure.ResourceManager.Resources/locationResources/resource", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources/resource", "name": "resource", "type": "Azure.ResourceManager.Resources/locationResources", "properties":{ @@ -132,7 +133,7 @@ interface LocationResources { @scenario @scenarioDoc(""" Resource DELETE operation. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/locations/eastus/providers/Azure.ResourceManager.Resources/locationResources/resource + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources/resource Expected query parameter: api-version=2023-12-01-preview ``` Expected response status code: 204 @@ -142,14 +143,14 @@ interface LocationResources { @scenario @scenarioDoc(""" Resource LIST by resource group operation. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/locations/eastus/providers/Azure.ResourceManager.Resources/locationResources + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources Expected query parameter: api-version=2023-12-01-preview Expected response body: ```json { "value": [{ - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/locations/eastus/providers/Azure.ResourceManager.Resources/locationResources/resource", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources/resource", "name": "resource", "type": "Azure.ResourceManager.Resources/locationResources", "properties":{ diff --git a/packages/cadl-ranch-specs/http/azure/resource-manager/resources/mockapi.ts b/packages/cadl-ranch-specs/http/azure/resource-manager/resources/mockapi.ts index 47d404dcd..7c916ac31 100644 --- a/packages/cadl-ranch-specs/http/azure/resource-manager/resources/mockapi.ts +++ b/packages/cadl-ranch-specs/http/azure/resource-manager/resources/mockapi.ts @@ -62,8 +62,8 @@ const validSingletonResource = { }, }; -const validLocationResource = { - id: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/locations/${LOCATION_EXPECTED}/providers/Azure.ResourceManager.Resources/locationResources/resource`, +const validResourceGroupLocationResource = { + id: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}/providers/Azure.ResourceManager.Resources/locations/${LOCATION_EXPECTED}/locationResources/resource`, name: "resource", type: "Azure.ResourceManager.Resources/locationResources", properties: { @@ -80,13 +80,14 @@ const validLocationResource = { }, }; -// location tracked resource +// location resource Scenarios.Azure_ResourceManager_Resources_LocationResources_get = passOnSuccess({ - uri: "/subscriptions/:subscriptionId/locations/:location/providers/Azure.ResourceManager.Resources/locationResources/:locationResourceName", + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/locations/:location/locationResources/:locationResourceName", method: "get", request: { params: { "subscriptionId": SUBSCRIPTION_ID_EXPECTED, + "resourceGroup": RESOURCE_GROUP_EXPECTED, "location": LOCATION_EXPECTED, "locationResourceName": "resource", "api-version": "2023-12-01-preview", @@ -94,17 +95,18 @@ Scenarios.Azure_ResourceManager_Resources_LocationResources_get = passOnSuccess( }, response: { status: 200, - body: json(validLocationResource), + body: json(validResourceGroupLocationResource), }, kind: "MockApiDefinition", }); Scenarios.Azure_ResourceManager_Resources_LocationResources_createOrUpdate = passOnSuccess({ - uri: "/subscriptions/:subscriptionId/locations/:location/providers/Azure.ResourceManager.Resources/locationResources/:locationResourceName", + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/locations/:location/locationResources/:locationResourceName", method: "put", request: { params: { "subscriptionId": SUBSCRIPTION_ID_EXPECTED, + "resourceGroup": RESOURCE_GROUP_EXPECTED, "location": LOCATION_EXPECTED, "locationResourceName": "resource", "api-version": "2023-12-01-preview", @@ -117,17 +119,18 @@ Scenarios.Azure_ResourceManager_Resources_LocationResources_createOrUpdate = pas }, response: { status: 200, - body: json(validLocationResource), + body: json(validResourceGroupLocationResource), }, kind: "MockApiDefinition", }); Scenarios.Azure_ResourceManager_Resources_LocationResources_update = passOnSuccess({ - uri: "/subscriptions/:subscriptionId/locations/:location/providers/Azure.ResourceManager.Resources/locationResources/:locationResourceName", + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/locations/:location/locationResources/:locationResourceName", method: "patch", request: { params: { "subscriptionId": SUBSCRIPTION_ID_EXPECTED, + "resourceGroup": RESOURCE_GROUP_EXPECTED, "location": LOCATION_EXPECTED, "locationResourceName": "resource", "api-version": "2023-12-01-preview", @@ -144,7 +147,7 @@ Scenarios.Azure_ResourceManager_Resources_LocationResources_update = passOnSucce response: { status: 200, body: json({ - ...validLocationResource, + ...validResourceGroupLocationResource, properties: { provisioningState: "Succeeded", description: "valid2", @@ -155,11 +158,12 @@ Scenarios.Azure_ResourceManager_Resources_LocationResources_update = passOnSucce }); Scenarios.Azure_ResourceManager_Resources_LocationResources_delete = passOnSuccess({ - uri: "/subscriptions/:subscriptionId/locations/:location/providers/Azure.ResourceManager.Resources/locationResources/:locationResourceName", + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/locations/:location/locationResources/:locationResourceName", method: "delete", request: { params: { "subscriptionId": SUBSCRIPTION_ID_EXPECTED, + "resourceGroup": RESOURCE_GROUP_EXPECTED, "location": LOCATION_EXPECTED, "locationResourceName": "resource", "api-version": "2023-12-01-preview", @@ -172,11 +176,12 @@ Scenarios.Azure_ResourceManager_Resources_LocationResources_delete = passOnSucce }); Scenarios.Azure_ResourceManager_Resources_LocationResources_listByParent = passOnSuccess({ - uri: "/subscriptions/:subscriptionId/locations/:location/providers/Azure.ResourceManager.Resources/locationResources", + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/locations/:location/locationResources", method: "get", request: { params: { "subscriptionId": SUBSCRIPTION_ID_EXPECTED, + "resourceGroup": RESOURCE_GROUP_EXPECTED, "location": LOCATION_EXPECTED, "api-version": "2023-12-01-preview", }, @@ -184,7 +189,7 @@ Scenarios.Azure_ResourceManager_Resources_LocationResources_listByParent = passO response: { status: 200, body: json({ - value: [validLocationResource], + value: [validResourceGroupLocationResource], }), }, kind: "MockApiDefinition",