diff --git a/.chronus/changes/specs_arm_extension_resource-2024-10-28-9-45-57.md b/.chronus/changes/specs_arm_extension_resource-2024-10-28-9-45-57.md new file mode 100644 index 0000000000..688a828129 --- /dev/null +++ b/.chronus/changes/specs_arm_extension_resource-2024-10-28-9-45-57.md @@ -0,0 +1,7 @@ +--- +changeKind: feature +packages: + - "@azure-tools/azure-http-specs" +--- + +Added ExtensionResource 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 7217ff19aa..7b43a81145 100644 --- a/packages/azure-http-specs/spec-summary.md +++ b/packages/azure-http-specs/spec-summary.md @@ -916,6 +916,550 @@ Expected response body: } ``` +### Azure_ResourceManager_Resources_ExtensionsResources_createOrUpdate + +- Endpoint: `put https://management.azure.com` + +Resource PUT operation for tenant level extension resource. +Expected path: /providers/Azure.ResourceManager.Resources/extensionsResources/extension +Expected query parameter: api-version=2023-12-01-preview + +Expected request body: + +```json +{ + "properties": { + "description": "valid" + } +} +``` + +Expected response body: + +```json +{ + "id": "/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } +} +``` + +Resource PUT operation for subscription level extension resource. +Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/extensionsResources/extension +Expected query parameter: api-version=2023-12-01-preview + +Expected request body: + +```json +{ + "properties": { + "description": "valid" + } +} +``` + +Expected response body: + +```json +{ + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } +} +``` + +Resource PUT operation for resource group level extension resource. +Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/extensionsResources/extension +Expected query parameter: api-version=2023-12-01-preview + +Expected request body: + +```json +{ + "properties": { + "description": "valid" + } +} +``` + +Expected response body: + +```json +{ + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } +} +``` + +Resource PUT operation for resource level extension resource. +Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources/extension +Expected query parameter: api-version=2023-12-01-preview + +Expected request body: + +```json +{ + "properties": { + "description": "valid" + } +} +``` + +Expected response body: + +```json +{ + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } +} +``` + +### Azure_ResourceManager_Resources_ExtensionsResources_delete + +- Endpoint: `delete https://management.azure.com` + +Resource DELETE operation for tenant level extension resource. +Expected path: /providers/Azure.ResourceManager.Resources/extensionsResources/extension +Expected query parameter: api-version=2023-12-01-preview +Expected response status code: 204 + +Resource DELETE operation for subscription level extension resource. +Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/extensionsResources/extension +Expected query parameter: api-version=2023-12-01-preview +Expected response status code: 204 + +Resource DELETE operation for resource get level extension resource. +Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/extensionsResources/extension +Expected query parameter: api-version=2023-12-01-preview +Expected response status code: 204 + +Resource DELETE operation for resource level extension resource. +Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources/extension +Expected query parameter: api-version=2023-12-01-preview +Expected response status code: 204 + +### Azure_ResourceManager_Resources_ExtensionsResources_get + +- Endpoint: `get https://management.azure.com` + +Resource GET operation for tenant level extension resource. +Expected path: /providers/Azure.ResourceManager.Resources/extensionsResources/extension +Expected query parameter: api-version=2023-12-01-preview + +Expected response body: + +```json +{ +"id": "/providers/Azure.ResourceManager.Resources/extensionsResources/extension", +"name": "extension", +"type": "Azure.ResourceManager.Resources/extensionsResources", +"properties":{ + "description": "valid", + "provisioningState": "Succeeded" +}, +"systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", +} +} +``` + +Resource GET operation for subscription level extension resource. +Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/extensionsResources/extension +Expected query parameter: api-version=2023-12-01-preview + +Expected response body: + +```json +{ + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } +} +``` + +Resource GET operation for resource group level extension resource. +Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/extensionsResources/extension +Expected query parameter: api-version=2023-12-01-preview + +Expected response body: + +```json +{ + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } +} +``` + +Resource GET operation for resource level extension resource. +Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources/extension +Expected query parameter: api-version=2023-12-01-preview + +Expected response body: + +```json +{ + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } +} +``` + +### Azure_ResourceManager_Resources_ExtensionsResources_listByParent + +- Endpoint: `get https://management.azure.com` + +Resource LIST by tenant level url operation. +Expected path: /providers/Azure.ResourceManager.Resources/extensionResources +Expected query parameter: api-version=2023-12-01-preview + +Expected response body: + +```json +{ + "value": [{ + "id": "/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + }] +} +``` + +Resource LIST by subscription level url operation. +Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/extensionResources +Expected query parameter: api-version=2023-12-01-preview + +Expected response body: + +```json +{ + "value": [{ + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + }] +} +``` + +Resource LIST by resource group level url operation. +Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/extensionResources +Expected query parameter: api-version=2023-12-01-preview + +Expected response body: + +```json +{ + "value": [{ + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + }] +} +``` + +Resource LIST by resource level url operation. +Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionResources +Expected query parameter: api-version=2023-12-01-preview + +Expected response body: + +```json +{ + "value": [{ + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + }] +} +``` + +### Azure_ResourceManager_Resources_ExtensionsResources_update + +- Endpoint: `patch https://management.azure.com` + +Resource Patch operation for tenant level extension resource. +Expected path: /providers/Azure.ResourceManager.Resources/extensionsResources/extension +Expected query parameter: api-version=2023-12-01-preview + +Expected request body: + +```json +{ + "properties": { + "description": "valid2" + } +} +``` + +Expected response body: + +```json +{ + "id": "/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid2", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } +} +``` + +Resource Patch operation for subscription level extension resource. +Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/extensionsResources/extension +Expected query parameter: api-version=2023-12-01-preview + +Expected request body: + +```json +{ + "properties": { + "description": "valid2" + } +} +``` + +Expected response body: + +```json +{ + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid2", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } +} +``` + +Resource Patch operation for resource group level extension resource. +Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/extensionsResources/extension +Expected query parameter: api-version=2023-12-01-preview + +Expected request body: + +```json +{ + "properties": { + "description": "valid2" + } +} +``` + +Expected response body: + +```json +{ + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid2", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } +} +``` + +Resource Patch operation for resource level extension resource. +Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources/extension +Expected query parameter: api-version=2023-12-01-preview + +Expected request body: + +```json +{ + "properties": { + "description": "valid2" + } +} +``` + +Expected response body: + +```json +{ + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid2", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } +} +``` + ### Azure_ResourceManager_Resources_Nested_createOrReplace - Endpoint: `put https://management.azure.com` diff --git a/packages/azure-http-specs/specs/azure/resource-manager/resources/extension.tsp b/packages/azure-http-specs/specs/azure/resource-manager/resources/extension.tsp new file mode 100644 index 0000000000..bf2d07dbd3 --- /dev/null +++ b/packages/azure-http-specs/specs/azure/resource-manager/resources/extension.tsp @@ -0,0 +1,554 @@ +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.Resources; + +model ExtensionsResource is ExtensionResource { + ...ResourceNameParameter; +} + +/** ExtensionsResource properties */ +model ExtensionsResourceProperties { + @doc("The description of the resource.") + description?: string; + + /** The status of the last operation. */ + @visibility("read") + provisioningState?: ProvisioningState; +} + +/** The interface of extensions resources, + * it contains 4 kinds of URLs (resource, resource group, subscription and tenant) + */ +@armResourceOperations +interface ExtensionsResources { + @scenario + @scenarioDoc(""" + Resource GET extension resource by tenant. + Expected path: /providers/Azure.ResourceManager.Resources/extensionsResources/extension + Expected query parameter: api-version=2023-12-01-preview + + Expected response body: + ```json + { + "id": "/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + } + ``` + + Resource GET extension resource by subscription. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/extensionsResources/extension + Expected query parameter: api-version=2023-12-01-preview + + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + } + ``` + + Resource GET extension resource by resource group. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/extensionsResources/extension + Expected query parameter: api-version=2023-12-01-preview + + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + } + ``` + + Resource GET extension resource by resource. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources/extension + Expected query parameter: api-version=2023-12-01-preview + + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + } + ``` + """) + get is ArmResourceRead; + + @scenario + @scenarioDoc(""" + Resource PUT extension resource by tenant. + Expected path: /providers/Azure.ResourceManager.Resources/extensionsResources/extension + Expected query parameter: api-version=2023-12-01-preview + + Expected request body: + ```json + { + "properties":{ + "description": "valid", + } + } + ``` + + Expected response body: + ```json + { + "id": "/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + } + ``` + + Resource PUT extension resource by subscription. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/extensionsResources/extension + Expected query parameter: api-version=2023-12-01-preview + + Expected request body: + ```json + { + "properties":{ + "description": "valid", + } + } + ``` + + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + } + ``` + + Resource PUT extension resource by resource group. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/extensionsResources/extension + Expected query parameter: api-version=2023-12-01-preview + + Expected request body: + ```json + { + "properties":{ + "description": "valid", + } + } + ``` + + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + } + ``` + + Resource PUT extension resource by resource. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources/extension + Expected query parameter: api-version=2023-12-01-preview + + Expected request body: + ```json + { + "properties":{ + "description": "valid", + } + } + ``` + + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + } + ``` + """) + createOrUpdate is ArmResourceCreateOrReplaceAsync; + + @scenario + @scenarioDoc(""" + Resource Patch extension resource by tenant. + Expected path: /providers/Azure.ResourceManager.Resources/extensionsResources/extension + Expected query parameter: api-version=2023-12-01-preview + + Expected request body: + ```json + { + "properties":{ + "description": "valid2", + } + } + ``` + + Expected response body: + ```json + { + "id": "/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid2", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + } + ``` + + Resource Patch extension resource by subscription. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/extensionsResources/extension + Expected query parameter: api-version=2023-12-01-preview + + Expected request body: + ```json + { + "properties":{ + "description": "valid2", + } + } + ``` + + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid2", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + } + ``` + + Resource Patch extension resource by resource group. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/extensionsResources/extension + Expected query parameter: api-version=2023-12-01-preview + + Expected request body: + ```json + { + "properties":{ + "description": "valid2", + } + } + ``` + + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid2", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + } + ``` + + Resource Patch extension resource by resource. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources/extension + Expected query parameter: api-version=2023-12-01-preview + + Expected request body: + ```json + { + "properties":{ + "description": "valid2", + } + } + ``` + + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid2", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + } + ``` + """) + update is ArmResourcePatchSync; + + @scenario + @scenarioDoc(""" + Resource DELETE extension resource by tenant. + Expected path: /providers/Azure.ResourceManager.Resources/extensionsResources/extension + Expected query parameter: api-version=2023-12-01-preview + Expected response status code: 204 + + Resource DELETE extension resource by subscription. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/extensionsResources/extension + Expected query parameter: api-version=2023-12-01-preview + Expected response status code: 204 + + Resource DELETE extension resource by resource group. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/extensionsResources/extension + Expected query parameter: api-version=2023-12-01-preview + Expected response status code: 204 + + Resource DELETE extension resource by resource. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources/extension + Expected query parameter: api-version=2023-12-01-preview + Expected response status code: 204 + """) + delete is ArmResourceDeleteSync; + + @scenario + @scenarioDoc(""" + Resource LIST extension resources by tenant. + Expected path: /providers/Azure.ResourceManager.Resources/extensionResources + Expected query parameter: api-version=2023-12-01-preview + + Expected response body: + ```json + { + "value": [{ + "id": "/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + }] + } + ``` + + Resource LIST extension resources by subscription. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/extensionResources + Expected query parameter: api-version=2023-12-01-preview + + Expected response body: + ```json + { + "value": [{ + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + }] + } + ``` + + Resource LIST extension resources by resource group. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/extensionResources + Expected query parameter: api-version=2023-12-01-preview + + Expected response body: + ```json + { + "value": [{ + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + }] + } + ``` + + Resource LIST extension resources by resource. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionResources + Expected query parameter: api-version=2023-12-01-preview + + Expected response body: + ```json + { + "value": [{ + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + }] + } + ``` + """) + listByParent is ArmResourceListByParent; +} diff --git a/packages/azure-http-specs/specs/azure/resource-manager/resources/main.tsp b/packages/azure-http-specs/specs/azure/resource-manager/resources/main.tsp index 6cfddb625c..e075ad9a06 100644 --- a/packages/azure-http-specs/specs/azure/resource-manager/resources/main.tsp +++ b/packages/azure-http-specs/specs/azure/resource-manager/resources/main.tsp @@ -7,6 +7,7 @@ import "@azure-tools/typespec-client-generator-core"; import "./toplevel.tsp"; import "./nested.tsp"; import "./singleton.tsp"; +import "./extension.tsp"; using TypeSpec.Http; using TypeSpec.Rest; 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..39c6fa722b 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 @@ -60,6 +60,500 @@ const validSingletonResource = { }, }; +const validResourceGroupExtensionsResource = { + id: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}/providers/Azure.ResourceManager.Resources/extensionsResources/extension`, + name: "extension", + type: "Azure.ResourceManager.Resources/extensionsResources", + properties: { + description: "valid", + provisioningState: "Succeeded", + }, + systemData: { + createdBy: "AzureSDK", + createdByType: "User", + createdAt: "2024-10-04T00:56:07.442Z", + lastModifiedBy: "AzureSDK", + lastModifiedAt: "2024-10-04T00:56:07.442Z", + lastModifiedByType: "User", + }, +}; + +const validSubscriptionExtensionsResource = { + id: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.Resources/extensionsResources/extension`, + name: "extension", + type: "Azure.ResourceManager.Resources/extensionsResources", + properties: { + description: "valid", + provisioningState: "Succeeded", + }, + systemData: { + createdBy: "AzureSDK", + createdByType: "User", + createdAt: "2024-10-04T00:56:07.442Z", + lastModifiedBy: "AzureSDK", + lastModifiedAt: "2024-10-04T00:56:07.442Z", + lastModifiedByType: "User", + }, +}; + +const validTenantExtensionsResource = { + id: `/providers/Azure.ResourceManager.Resources/extensionsResources/extension`, + name: "extension", + type: "Azure.ResourceManager.Resources/extensionsResources", + properties: { + description: "valid", + provisioningState: "Succeeded", + }, + systemData: { + createdBy: "AzureSDK", + createdByType: "User", + createdAt: "2024-10-04T00:56:07.442Z", + lastModifiedBy: "AzureSDK", + lastModifiedAt: "2024-10-04T00:56:07.442Z", + lastModifiedByType: "User", + }, +}; + +const validResourceExtensionsResource = { + id: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources/extension`, + name: "extension", + type: "Azure.ResourceManager.Resources/extensionsResources", + properties: { + description: "valid", + provisioningState: "Succeeded", + }, + systemData: { + createdBy: "AzureSDK", + createdByType: "User", + createdAt: "2024-10-04T00:56:07.442Z", + lastModifiedBy: "AzureSDK", + lastModifiedAt: "2024-10-04T00:56:07.442Z", + lastModifiedByType: "User", + }, +}; + +// extension tracked resource +Scenarios.Azure_ResourceManager_Resources_ExtensionsResources_get = passOnSuccess([ + { + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/extensionsResources/:extensionName", + method: "get", + request: { + params: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + extensionName: "extension", + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 200, + body: json(validResourceGroupExtensionsResource), + }, + kind: "MockApiDefinition", + }, + { + uri: "/subscriptions/:subscriptionId/providers/Azure.ResourceManager.Resources/extensionsResources/:extensionName", + method: "get", + request: { + params: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + extensionName: "extension", + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 200, + body: json(validSubscriptionExtensionsResource), + }, + kind: "MockApiDefinition", + }, + { + uri: "/providers/Azure.ResourceManager.Resources/extensionsResources/:extensionName", + method: "get", + request: { + params: { + extensionName: "extension", + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 200, + body: json(validTenantExtensionsResource), + }, + kind: "MockApiDefinition", + }, + { + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/:topLevelResourceName/providers/Azure.ResourceManager.Resources/extensionsResources/:extensionName", + method: "get", + request: { + params: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + extensionName: "extension", + topLevelResourceName: "top", + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 200, + body: json(validResourceExtensionsResource), + }, + kind: "MockApiDefinition", + }, +]); + +Scenarios.Azure_ResourceManager_Resources_ExtensionsResources_createOrUpdate = passOnSuccess([ + { + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/extensionsResources/:extensionName", + method: "put", + request: { + params: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + extensionName: "extension", + "api-version": "2023-12-01-preview", + }, + body: { + properties: { + description: "valid", + }, + }, + }, + response: { + status: 200, + body: json(validResourceGroupExtensionsResource), + }, + kind: "MockApiDefinition", + }, + { + uri: "/subscriptions/:subscriptionId/providers/Azure.ResourceManager.Resources/extensionsResources/:extensionName", + method: "put", + request: { + params: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + extensionName: "extension", + "api-version": "2023-12-01-preview", + }, + body: { + properties: { + description: "valid", + }, + }, + }, + response: { + status: 200, + body: json(validSubscriptionExtensionsResource), + }, + kind: "MockApiDefinition", + }, + { + uri: "/providers/Azure.ResourceManager.Resources/extensionsResources/:extensionName", + method: "put", + request: { + params: { + extensionName: "extension", + "api-version": "2023-12-01-preview", + }, + body: { + properties: { + description: "valid", + }, + }, + }, + response: { + status: 200, + body: json(validTenantExtensionsResource), + }, + kind: "MockApiDefinition", + }, + { + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/:topLevelResourceName/providers/Azure.ResourceManager.Resources/extensionsResources/:extensionName", + method: "put", + request: { + params: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + topLevelResourceName: "top", + extensionName: "extension", + "api-version": "2023-12-01-preview", + }, + body: { + properties: { + description: "valid", + }, + }, + }, + response: { + status: 200, + body: json(validResourceExtensionsResource), + }, + kind: "MockApiDefinition", + }, +]); + +Scenarios.Azure_ResourceManager_Resources_ExtensionsResources_update = passOnSuccess([ + { + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/extensionsResources/:extensionName", + method: "patch", + request: { + params: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + extensionName: "extension", + "api-version": "2023-12-01-preview", + }, + body: { + properties: { + description: "valid2", + }, + }, + headers: { + "Content-Type": "application/merge-patch+json", + }, + }, + response: { + status: 200, + body: json({ + ...validResourceGroupExtensionsResource, + properties: { + provisioningState: "Succeeded", + description: "valid2", + }, + }), + }, + kind: "MockApiDefinition", + }, + { + uri: "/subscriptions/:subscriptionId/providers/Azure.ResourceManager.Resources/extensionsResources/:extensionName", + method: "patch", + request: { + params: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + extensionName: "extension", + "api-version": "2023-12-01-preview", + }, + body: { + properties: { + description: "valid2", + }, + }, + headers: { + "Content-Type": "application/merge-patch+json", + }, + }, + response: { + status: 200, + body: json({ + ...validSubscriptionExtensionsResource, + properties: { + provisioningState: "Succeeded", + description: "valid2", + }, + }), + }, + kind: "MockApiDefinition", + }, + { + uri: "/providers/Azure.ResourceManager.Resources/extensionsResources/:extensionName", + method: "patch", + request: { + params: { + extensionName: "extension", + "api-version": "2023-12-01-preview", + }, + body: { + properties: { + description: "valid2", + }, + }, + headers: { + "Content-Type": "application/merge-patch+json", + }, + }, + response: { + status: 200, + body: json({ + ...validTenantExtensionsResource, + properties: { + provisioningState: "Succeeded", + description: "valid2", + }, + }), + }, + kind: "MockApiDefinition", + }, + { + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/:topLevelResourceName/providers/Azure.ResourceManager.Resources/extensionsResources/:extensionName", + method: "patch", + request: { + params: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + topLevelResourceName: "top", + extensionName: "extension", + "api-version": "2023-12-01-preview", + }, + body: { + properties: { + description: "valid2", + }, + }, + headers: { + "Content-Type": "application/merge-patch+json", + }, + }, + response: { + status: 200, + body: json({ + ...validResourceExtensionsResource, + properties: { + provisioningState: "Succeeded", + description: "valid2", + }, + }), + }, + kind: "MockApiDefinition", + }, +]); + +Scenarios.Azure_ResourceManager_Resources_ExtensionsResources_delete = passOnSuccess([ + { + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/extensionsResources/:extensionName", + method: "delete", + request: { + params: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + extensionName: "extension", + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, + { + uri: "/subscriptions/:subscriptionId/providers/Azure.ResourceManager.Resources/extensionsResources/:extensionName", + method: "delete", + request: { + params: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + extensionName: "extension", + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, + { + uri: "/providers/Azure.ResourceManager.Resources/extensionsResources/:extensionName", + method: "delete", + request: { + params: { + extensionName: "extension", + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, + { + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/:topLevelResourceName/providers/Azure.ResourceManager.Resources/extensionsResources/:extensionName", + method: "delete", + request: { + params: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + topLevelResourceName: "top", + extensionName: "extension", + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, +]); + +Scenarios.Azure_ResourceManager_Resources_ExtensionsResources_listByParent = passOnSuccess([ + { + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/extensionsResources", + method: "get", + request: { + params: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 200, + body: json({ + value: [validResourceGroupExtensionsResource], + }), + }, + kind: "MockApiDefinition", + }, + { + uri: "/subscriptions/:subscriptionId/providers/Azure.ResourceManager.Resources/extensionsResources", + method: "get", + request: { + params: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 200, + body: json({ + value: [validSubscriptionExtensionsResource], + }), + }, + kind: "MockApiDefinition", + }, + { + uri: "/providers/Azure.ResourceManager.Resources/extensionsResources", + method: "get", + request: { + params: { + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 200, + body: json({ + value: [validTenantExtensionsResource], + }), + }, + kind: "MockApiDefinition", + }, + { + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/:topLevelResourceName/providers/Azure.ResourceManager.Resources/extensionsResources", + method: "get", + request: { + params: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + topLevelResourceName: "top", + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 200, + body: json({ + value: [validResourceExtensionsResource], + }), + }, + kind: "MockApiDefinition", + }, +]); + // singleton tracked resource Scenarios.Azure_ResourceManager_Resources_Singleton_getByResourceGroup = passOnSuccess({ uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/singletonTrackedResources/default",