From 4e2c1033f68538317b3fec122169cf8baa633845 Mon Sep 17 00:00:00 2001 From: LucasYao93 <53558334+LucasYao93@users.noreply.github.com> Date: Fri, 31 Jul 2020 16:33:59 +0800 Subject: [PATCH 1/4] Add test cases of autorest extension. --- tests-upgrade/datamodels-enums/readme.md | 10 ++ tests-upgrade/datamodels-enums/swagger.json | 73 +++++++++++ tests-upgrade/examples/OperationsList.json | 65 ++++++++++ tests-upgrade/examples/WorkspaceCreate.json | 89 ++++++++++++++ .../WorkspaceCreateWithParameters.json | 114 ++++++++++++++++++ tests-upgrade/examples/WorkspaceDelete.json | 13 ++ tests-upgrade/examples/WorkspaceGet.json | 47 ++++++++ .../examples/WorkspaceGetParameters.json | 60 +++++++++ tests-upgrade/examples/WorkspaceUpdate.json | 55 +++++++++ .../WorkspacesListByResourceGroup.json | 86 +++++++++++++ .../WorkspacesListBySubscription.json | 85 +++++++++++++ .../extension-ms-azureresource/readme.md | 10 ++ .../extension-ms-azureresource/swagger.json | 79 ++++++++++++ .../extension-ms-clientflatten/readme.md | 10 ++ .../extension-ms-clientflatten/swagger.json | 80 ++++++++++++ .../extension-ms-clientname/readme.md | 10 ++ .../extension-ms-clientname/swagger.json | 78 ++++++++++++ .../extension-ms-discriminatorvalue/readme.md | 10 ++ .../swagger.json | 66 ++++++++++ tests-upgrade/extension-ms-enum/readme.md | 10 ++ tests-upgrade/extension-ms-enum/swagger.json | 80 ++++++++++++ tests-upgrade/extension-ms-examples/readme.md | 10 ++ .../extension-ms-examples/swagger.json | 64 ++++++++++ .../readme.md | 10 ++ .../swagger.json | 60 +++++++++ .../extension-ms-mutability/readme.md | 10 ++ .../extension-ms-mutability/swagger.json | 86 +++++++++++++ tests-upgrade/extension-ms-pageable/readme.md | 10 ++ .../extension-ms-pageable/swagger.json | 71 +++++++++++ .../extension-ms-paramlocation/readme.md | 10 ++ .../extension-ms-paramlocation/swagger.json | 73 +++++++++++ 31 files changed, 1534 insertions(+) create mode 100644 tests-upgrade/datamodels-enums/readme.md create mode 100644 tests-upgrade/datamodels-enums/swagger.json create mode 100644 tests-upgrade/examples/OperationsList.json create mode 100644 tests-upgrade/examples/WorkspaceCreate.json create mode 100644 tests-upgrade/examples/WorkspaceCreateWithParameters.json create mode 100644 tests-upgrade/examples/WorkspaceDelete.json create mode 100644 tests-upgrade/examples/WorkspaceGet.json create mode 100644 tests-upgrade/examples/WorkspaceGetParameters.json create mode 100644 tests-upgrade/examples/WorkspaceUpdate.json create mode 100644 tests-upgrade/examples/WorkspacesListByResourceGroup.json create mode 100644 tests-upgrade/examples/WorkspacesListBySubscription.json create mode 100644 tests-upgrade/extension-ms-azureresource/readme.md create mode 100644 tests-upgrade/extension-ms-azureresource/swagger.json create mode 100644 tests-upgrade/extension-ms-clientflatten/readme.md create mode 100644 tests-upgrade/extension-ms-clientflatten/swagger.json create mode 100644 tests-upgrade/extension-ms-clientname/readme.md create mode 100644 tests-upgrade/extension-ms-clientname/swagger.json create mode 100644 tests-upgrade/extension-ms-discriminatorvalue/readme.md create mode 100644 tests-upgrade/extension-ms-discriminatorvalue/swagger.json create mode 100644 tests-upgrade/extension-ms-enum/readme.md create mode 100644 tests-upgrade/extension-ms-enum/swagger.json create mode 100644 tests-upgrade/extension-ms-examples/readme.md create mode 100644 tests-upgrade/extension-ms-examples/swagger.json create mode 100644 tests-upgrade/extension-ms-longruningoperation/readme.md create mode 100644 tests-upgrade/extension-ms-longruningoperation/swagger.json create mode 100644 tests-upgrade/extension-ms-mutability/readme.md create mode 100644 tests-upgrade/extension-ms-mutability/swagger.json create mode 100644 tests-upgrade/extension-ms-pageable/readme.md create mode 100644 tests-upgrade/extension-ms-pageable/swagger.json create mode 100644 tests-upgrade/extension-ms-paramlocation/readme.md create mode 100644 tests-upgrade/extension-ms-paramlocation/swagger.json diff --git a/tests-upgrade/datamodels-enums/readme.md b/tests-upgrade/datamodels-enums/readme.md new file mode 100644 index 00000000000..cd6b9c0ac24 --- /dev/null +++ b/tests-upgrade/datamodels-enums/readme.md @@ -0,0 +1,10 @@ +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +require: + - $(this-folder)/../readme.azure.noprofile.md +input-file: + - $(this-folder)/swagger.json + +``` diff --git a/tests-upgrade/datamodels-enums/swagger.json b/tests-upgrade/datamodels-enums/swagger.json new file mode 100644 index 00000000000..efa7111df69 --- /dev/null +++ b/tests-upgrade/datamodels-enums/swagger.json @@ -0,0 +1,73 @@ +{ + + "swagger": "2.0", + "info": { + "title": "DatabricksClient", + "version": "2018-04-01", + "description": "ARM Databricks" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "flow": "implicit", + "description": "Azure Active Directory OAuth2 Flow", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "paths": { + "/subscriptions/resourceGroup/{resourceGroup}": { + "get": { + "tags": [ + "Workspaces" + ], + "operationId": "Workspaces_Get", + "description": "Gets the workspace.", + "parameters": [ + { + "$ref": "#/parameters/ResourceGroupName" + } + ], + "responses": { + "200": { + "description": "OK-Return workspace." + } + } + } + } + }, + "parameters": { + "ResourceGroupName":{ + "in": "path", + "name": "resourceGroup", + "description": "Resource group name", + "required": true, + "schema": { + "type": "string", + "enum": [ + "azure cloud", + "azure prod" + ] + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/examples/OperationsList.json b/tests-upgrade/examples/OperationsList.json new file mode 100644 index 00000000000..4da476627d5 --- /dev/null +++ b/tests-upgrade/examples/OperationsList.json @@ -0,0 +1,65 @@ +{ + "parameters": { + "api-version": "2018-04-01" + }, + "responses": { + "200": { + "body": [ + { + "name": "Microsoft.Databricks/workspaces/read", + "display": { + "provider": "Microsoft Databricks", + "resource": "Workspace", + "operation": "List Workspaces", + "description": "Retrieves a list of workspaces." + } + }, + { + "name": "Microsoft.Databricks/workspaces/write", + "display": { + "provider": "Microsoft Databricks", + "resource": "Workspace", + "operation": "Create Workspace", + "description": "Creates an workspace." + } + }, + { + "name": "Microsoft.Databricks/workspaces/delete", + "display": { + "provider": "Microsoft Databricks", + "resource": "Workspace", + "operation": "Remove Workspace", + "description": "Removes an workspace." + } + }, + { + "name": "Microsoft.Databricks/workspaces/virtualNetworkPeerings/read", + "display": { + "provider": "Microsoft Databricks", + "resource": "Virtual Network Peering", + "operation": "Get Virtual Network Peering", + "description": "Gets the virtual network peering." + } + }, + { + "name": "Microsoft.Databricks/workspaces/virtualNetworkPeerings/write", + "display": { + "provider": "Microsoft Databricks", + "resource": "Virtual Network Peering", + "operation": "Add Virtual Network Peering", + "description": "Add or modify virtual network peering" + } + }, + { + "name": "Microsoft.Databricks/workspaces/virtualNetworkPeerings/delete", + "display": { + "provider": "Microsoft Databricks", + "resource": "Virtual Network Peering", + "operation": "Delete Virtual Network Peering", + "description": "Deletes a virtual network peering" + } + } + ] + } + } +} diff --git a/tests-upgrade/examples/WorkspaceCreate.json b/tests-upgrade/examples/WorkspaceCreate.json new file mode 100644 index 00000000000..2c296267716 --- /dev/null +++ b/tests-upgrade/examples/WorkspaceCreate.json @@ -0,0 +1,89 @@ +{ + "parameters": { + "subscriptionId": "subid", + "resourceGroupName": "rg", + "workspaceName": "myWorkspace", + "api-version": "2018-04-01", + "parameters": { + "properties": { + "managedResourceGroupId": "/subscriptions/subid/resourceGroups/myManagedRG" + }, + "location": "westus" + } + }, + "responses": { + "200": { + "body": { + "id": "/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Databricks/workspaces/myWorkspace", + "type": "Microsoft.Databricks/workspaces", + "location": "East US 2", + "tags": null, + "sku": { + "name": "premium" + }, + "properties": { + "managedResourceGroupId": "/subscriptions/subid/resourceGroups/myManagedRG", + "parameters": null, + "provisioningState": "Accepted", + "uiDefinitionUri": "https://path/to/workspaceCreateUiDefinition.json", + "authorizations": [ + { + "principalId": "00000000-0000-0000-0000-000000000000", + "roleDefinitionId": "11111111-1111-1111-1111-111111111111" + } + ], + "createdBy": { + "oid": "22222222-2222-2222-2222-222222222222", + "puid": "33333333", + "applicationId": "44444444-4444-4444-4444-444444444444" + }, + "updatedBy": { + "oid": "22222222-2222-2222-2222-222222222222", + "puid": "33333333", + "applicationId": "44444444-4444-4444-4444-444444444444" + }, + "createdDateTime": "2020-02-20T00:10:29.2858439Z", + "workspaceId": "5555555555555555", + "workspaceUrl": "adb-5555555555555555.19.azuredatabricks.net" + } + } + }, + "201": { + "body": { + "name": "myWorkspace", + "id": "/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Databricks/workspaces/myWorkspace", + "type": "Microsoft.Databricks/workspaces", + "location": "East US 2", + "tags": { + "environment": "dev" + }, + "sku": { + "name": "premium" + }, + "properties": { + "managedResourceGroupId": "/subscriptions/subid/resourceGroups/myManagedRG", + "parameters": null, + "provisioningState": "Accepted", + "uiDefinitionUri": "https://path/to/workspaceCreateUiDefinition.json", + "authorizations": [ + { + "principalId": "00000000-0000-0000-0000-000000000000", + "roleDefinitionId": "11111111-1111-1111-1111-111111111111" + } + ], + "createdBy": { + "oid": "22222222-2222-2222-2222-222222222222", + "puid": "33333333", + "applicationId": "44444444-4444-4444-4444-444444444444" + }, + "updatedBy": { + "oid": "22222222-2222-2222-2222-222222222222", + "puid": "33333333", + "applicationId": "44444444-4444-4444-4444-444444444444" + }, + "createdDateTime": "2020-02-20T00:10:29.2858439Z" + } + } + } + } +} diff --git a/tests-upgrade/examples/WorkspaceCreateWithParameters.json b/tests-upgrade/examples/WorkspaceCreateWithParameters.json new file mode 100644 index 00000000000..4a6d36ecbcf --- /dev/null +++ b/tests-upgrade/examples/WorkspaceCreateWithParameters.json @@ -0,0 +1,114 @@ +{ + "parameters": { + "subscriptionId": "subid", + "resourceGroupName": "rg", + "workspaceName": "myWorkspace", + "api-version": "2018-04-01", + "parameters": { + "properties": { + "managedResourceGroupId": "/subscriptions/subid/resourceGroups/myManagedRG", + "parameters": { + "customVirtualNetworkId": { + "value": "/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/myNetwork" + }, + "customPublicSubnetName": { + "value": "myPublicSubnet" + }, + "customPrivateSubnetName": { + "value": "myPrivateSubnet" + } + } + }, + "location": "westus" + } + }, + "responses": { + "200": { + "headers": {}, + "body": { + "id": "/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Databricks/workspaces/myWorkspace", + "type": "Microsoft.Databricks/workspaces", + "location": "East US 2", + "tags": null, + "sku": { + "name": "premium" + }, + "properties": { + "managedResourceGroupId": "/subscriptions/subid/resourceGroups/myManagedRG", + "parameters": { + "customPrivateSubnetName": { + "type": "String", + "value": "myPrivateSubnet" + }, + "customPublicSubnetName": { + "type": "String", + "value": "myPublicSubnet" + }, + "customVirtualNetworkId": { + "type": "String", + "value": "/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/myNetwork" + } + }, + "provisioningState": "Succeeded", + "uiDefinitionUri": "https://path/to/workspaceCreateUiDefinition.json", + "authorizations": [ + { + "principalId": "00000000-0000-0000-0000-000000000000", + "roleDefinitionId": "11111111-1111-1111-1111-111111111111" + } + ], + "createdBy": { + "oid": "22222222-2222-2222-2222-222222222222", + "puid": "33333333", + "applicationId": "44444444-4444-4444-4444-444444444444" + }, + "updatedBy": { + "oid": "22222222-2222-2222-2222-222222222222", + "puid": "33333333", + "applicationId": "44444444-4444-4444-4444-444444444444" + }, + "createdDateTime": "2020-02-20T00:10:29.2858439Z", + "workspaceId": "5555555555555555", + "workspaceUrl": "adb-5555555555555555.19.azuredatabricks.net" + } + } + }, + "201": { + "headers": {}, + "body": { + "name": "myWorkspace", + "id": "/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Databricks/workspaces/myWorkspace", + "type": "Microsoft.Databricks/workspaces", + "location": "East US 2", + "tags": { + "environment": "dev" + }, + "sku": { + "name": "premium" + }, + "properties": { + "managedResourceGroupId": "/subscriptions/subid/resourceGroups/myManagedRG", + "provisioningState": "Accepted", + "uiDefinitionUri": "https://path/to/workspaceCreateUiDefinition.json", + "authorizations": [ + { + "principalId": "00000000-0000-0000-0000-000000000000", + "roleDefinitionId": "11111111-1111-1111-1111-111111111111" + } + ], + "createdBy": { + "oid": "22222222-2222-2222-2222-222222222222", + "puid": "33333333", + "applicationId": "44444444-4444-4444-4444-444444444444" + }, + "updatedBy": { + "oid": "22222222-2222-2222-2222-222222222222", + "puid": "33333333", + "applicationId": "44444444-4444-4444-4444-444444444444" + }, + "createdDateTime": "2020-02-20T00:10:29.2858439Z" + } + } + } + } +} diff --git a/tests-upgrade/examples/WorkspaceDelete.json b/tests-upgrade/examples/WorkspaceDelete.json new file mode 100644 index 00000000000..affad060724 --- /dev/null +++ b/tests-upgrade/examples/WorkspaceDelete.json @@ -0,0 +1,13 @@ +{ + "parameters": { + "workspaceName": "myWorkspace", + "resourceGroupName": "rg", + "api-version": "2018-04-01", + "subscriptionId": "subid" + }, + "responses": { + "200": {}, + "202": {}, + "204": {} + } +} diff --git a/tests-upgrade/examples/WorkspaceGet.json b/tests-upgrade/examples/WorkspaceGet.json new file mode 100644 index 00000000000..48fe6d0b499 --- /dev/null +++ b/tests-upgrade/examples/WorkspaceGet.json @@ -0,0 +1,47 @@ +{ + "parameters": { + "subscriptionId": "subid", + "resourceGroupName": "rg", + "workspaceName": "myWorkspace", + "api-version": "2018-04-01" + }, + "responses": { + "200": { + "headers": {}, + "body": { + "name": "myWorkspace", + "id": "/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Databricks/workspaces/myWorkspace", + "type": "Microsoft.Databricks/workspaces", + "sku": { + "name": "premium" + }, + "location": "East US 2", + "properties": { + "managedResourceGroupId": "/subscriptions/subid/resourceGroups/myManagedRG", + "parameters": null, + "provisioningState": "Succeeded", + "uiDefinitionUri": "https://path/to/workspaceCreateUiDefinition.json", + "authorizations": [ + { + "principalId": "00000000-0000-0000-0000-000000000000", + "roleDefinitionId": "11111111-1111-1111-1111-111111111111" + } + ], + "createdBy": { + "oid": "22222222-2222-2222-2222-222222222222", + "puid": "33333333", + "applicationId": "44444444-4444-4444-4444-444444444444" + }, + "updatedBy": { + "oid": "22222222-2222-2222-2222-222222222222", + "puid": "33333333", + "applicationId": "44444444-4444-4444-4444-444444444444" + }, + "createdDateTime": "2020-02-20T00:10:29.2858439Z", + "workspaceId": "5555555555555555", + "workspaceUrl": "adb-5555555555555555.19.azuredatabricks.net" + } + } + } + } +} diff --git a/tests-upgrade/examples/WorkspaceGetParameters.json b/tests-upgrade/examples/WorkspaceGetParameters.json new file mode 100644 index 00000000000..7babe97ee78 --- /dev/null +++ b/tests-upgrade/examples/WorkspaceGetParameters.json @@ -0,0 +1,60 @@ +{ + "parameters": { + "subscriptionId": "subid", + "resourceGroupName": "rg", + "workspaceName": "myWorkspace", + "api-version": "2018-04-01" + }, + "responses": { + "200": { + "headers": {}, + "body": { + "name": "myWorkspace", + "id": "/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Databricks/workspaces/myWorkspace", + "type": "Microsoft.Databricks/workspaces", + "location": "East US 2", + "sku": { + "name": "premium" + }, + "properties": { + "managedResourceGroupId": "/subscriptions/subid/resourceGroups/myManagedRG", + "parameters": { + "customPrivateSubnetName": { + "type": "String", + "value": "PrivateBob" + }, + "customPublicSubnetName": { + "type": "String", + "value": "PublicSarah" + }, + "customVirtualNetworkId": { + "type": "String", + "value": "/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/myNetwork" + } + }, + "provisioningState": "Succeeded", + "uiDefinitionUri": "https://path/to/workspaceCreateUiDefinition.json", + "authorizations": [ + { + "principalId": "00000000-0000-0000-0000-000000000000", + "roleDefinitionId": "11111111-1111-1111-1111-111111111111" + } + ], + "createdBy": { + "oid": "22222222-2222-2222-2222-222222222222", + "puid": "33333333", + "applicationId": "44444444-4444-4444-4444-444444444444" + }, + "updatedBy": { + "oid": "22222222-2222-2222-2222-222222222222", + "puid": "33333333", + "applicationId": "44444444-4444-4444-4444-444444444444" + }, + "createdDateTime": "2020-02-20T00:10:29.2858439Z", + "workspaceId": "5555555555555555", + "workspaceUrl": "adb-5555555555555555.19.azuredatabricks.net" + } + } + } + } +} diff --git a/tests-upgrade/examples/WorkspaceUpdate.json b/tests-upgrade/examples/WorkspaceUpdate.json new file mode 100644 index 00000000000..766bbcd7872 --- /dev/null +++ b/tests-upgrade/examples/WorkspaceUpdate.json @@ -0,0 +1,55 @@ +{ + "parameters": { + "subscriptionId": "subid", + "resourceGroupName": "rg", + "workspaceName": "myWorkspace", + "api-version": "2018-04-01", + "parameters": { + "tags": { + "mytag1": "myvalue1" + } + } + }, + "responses": { + "200": { + "headers": {}, + "body": { + "id": "/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Databricks/workspaces/myWorkspace", + "type": "Microsoft.Databricks/workspaces", + "location": "East US 2", + "tags": { + "mytag1": "myvalue1" + }, + "sku": { + "name": "premium" + }, + "properties": { + "managedResourceGroupId": "/subscriptions/subid/resourceGroups/myManagedRG", + "parameters": null, + "provisioningState": "Succeeded", + "uiDefinitionUri": "https://path/to/workspaceCreateUiDefinition.json", + "authorizations": [ + { + "principalId": "00000000-0000-0000-0000-000000000000", + "roleDefinitionId": "11111111-1111-1111-1111-111111111111" + } + ], + "createdBy": { + "oid": "22222222-2222-2222-2222-222222222222", + "puid": "33333333", + "applicationId": "44444444-4444-4444-4444-444444444444" + }, + "updatedBy": { + "oid": "22222222-2222-2222-2222-222222222222", + "puid": "33333333", + "applicationId": "44444444-4444-4444-4444-444444444444" + }, + "createdDateTime": "2020-02-20T00:10:29.2858439Z", + "workspaceId": "6666666666666666", + "workspaceUrl": "adb-6666666666666666.19.azuredatabricks.net" + } + } + }, + "202": {} + } +} diff --git a/tests-upgrade/examples/WorkspacesListByResourceGroup.json b/tests-upgrade/examples/WorkspacesListByResourceGroup.json new file mode 100644 index 00000000000..f8fad446745 --- /dev/null +++ b/tests-upgrade/examples/WorkspacesListByResourceGroup.json @@ -0,0 +1,86 @@ +{ + "parameters": { + "subscriptionId": "subid", + "resourceGroupName": "rg", + "api-version": "2018-04-01" + }, + "responses": { + "200": { + "headers": {}, + "body": { + "value": [ + { + "name": "myWorkspace1", + "id": "/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Databricks/workspaces/myWorkspace1", + "type": "Microsoft.Databricks/workspaces", + "location": "East US 2", + "tags": null, + "sku": { + "name": "premium" + }, + "properties": { + "managedResourceGroupId": "/subscriptions/subid/resourceGroups/myManagedRG", + "parameters": null, + "provisioningState": "Succeeded", + "uiDefinitionUri": "https://path/to/workspaceCreateUiDefinition.json", + "authorizations": [ + { + "principalId": "00000000-0000-0000-0000-000000000000", + "roleDefinitionId": "11111111-1111-1111-1111-111111111111" + } + ], + "createdBy": { + "oid": "22222222-2222-2222-2222-222222222222", + "puid": "33333333", + "applicationId": "44444444-4444-4444-4444-444444444444" + }, + "updatedBy": { + "oid": "22222222-2222-2222-2222-222222222222", + "puid": "33333333", + "applicationId": "44444444-4444-4444-4444-444444444444" + }, + "createdDateTime": "2020-02-20T00:10:29.2858439Z", + "workspaceId": "5555555555555555", + "workspaceUrl": "adb-5555555555555555.19.azuredatabricks.net" + } + }, + { + "name": "myWorkspace2", + "id": "/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Databricks/workspaces/myWorkspace2", + "type": "Microsoft.Databricks/workspaces", + "location": "East US 2", + "tags": null, + "sku": { + "name": "standard" + }, + "properties": { + "managedResourceGroupId": "/subscriptions/subid/resourceGroups/myManagedRG", + "parameters": null, + "provisioningState": "Succeeded", + "uiDefinitionUri": "https://path/to/workspaceCreateUiDefinition.json", + "authorizations": [ + { + "principalId": "00000000-0000-0000-0000-000000000000", + "roleDefinitionId": "11111111-1111-1111-1111-111111111111" + } + ], + "createdBy": { + "oid": "22222222-2222-2222-2222-222222222222", + "puid": "33333333", + "applicationId": "44444444-4444-4444-4444-444444444444" + }, + "updatedBy": { + "oid": "22222222-2222-2222-2222-222222222222", + "puid": "33333333", + "applicationId": "44444444-4444-4444-4444-444444444444" + }, + "createdDateTime": "2020-02-20T00:10:29.2858439Z", + "workspaceId": "6666666666666666", + "workspaceUrl": "adb-6666666666666666.19.azuredatabricks.net" + } + } + ] + } + } + } +} diff --git a/tests-upgrade/examples/WorkspacesListBySubscription.json b/tests-upgrade/examples/WorkspacesListBySubscription.json new file mode 100644 index 00000000000..de92bdaeaf1 --- /dev/null +++ b/tests-upgrade/examples/WorkspacesListBySubscription.json @@ -0,0 +1,85 @@ +{ + "parameters": { + "subscriptionId": "subid", + "api-version": "2018-04-01" + }, + "responses": { + "200": { + "headers": {}, + "body": { + "value": [ + { + "name": "myWorkspace1", + "id": "/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Databricks/workspaces/myWorkspace1", + "type": "Microsoft.Databricks/workspaces", + "location": "East US 2", + "tags": null, + "sku": { + "name": "premium" + }, + "properties": { + "managedResourceGroupId": "/subscriptions/subid/resourceGroups/myManagedRG", + "parameters": null, + "provisioningState": "Succeeded", + "uiDefinitionUri": "https://path/to/workspaceCreateUiDefinition.json", + "authorizations": [ + { + "principalId": "00000000-0000-0000-0000-000000000000", + "roleDefinitionId": "11111111-1111-1111-1111-111111111111" + } + ], + "createdBy": { + "oid": "22222222-2222-2222-2222-222222222222", + "puid": "33333333", + "applicationId": "44444444-4444-4444-4444-444444444444" + }, + "updatedBy": { + "oid": "22222222-2222-2222-2222-222222222222", + "puid": "33333333", + "applicationId": "44444444-4444-4444-4444-444444444444" + }, + "createdDateTime": "2020-02-20T00:10:29.2858439Z", + "workspaceId": "5555555555555555", + "workspaceUrl": "adb-5555555555555555.19.azuredatabricks.net" + } + }, + { + "name": "myWorkspace2", + "id": "/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Databricks/workspaces/myWorkspace2", + "type": "Microsoft.Databricks/workspaces", + "location": "East US 2", + "tags": null, + "sku": { + "name": "standard" + }, + "properties": { + "managedResourceGroupId": "/subscriptions/subid/resourceGroups/myManagedRG", + "parameters": null, + "provisioningState": "Succeeded", + "uiDefinitionUri": "https://path/to/workspaceCreateUiDefinition.json", + "authorizations": [ + { + "principalId": "00000000-0000-0000-0000-000000000000", + "roleDefinitionId": "11111111-1111-1111-1111-111111111111" + } + ], + "createdBy": { + "oid": "22222222-2222-2222-2222-222222222222", + "puid": "33333333", + "applicationId": "44444444-4444-4444-4444-444444444444" + }, + "updatedBy": { + "oid": "22222222-2222-2222-2222-222222222222", + "puid": "33333333", + "applicationId": "44444444-4444-4444-4444-444444444444" + }, + "createdDateTime": "2020-02-20T00:10:29.2858439Z", + "workspaceId": "6666666666666666", + "workspaceUrl": "adb-6666666666666666.19.azuredatabricks.net" + } + } + ] + } + } + } +} diff --git a/tests-upgrade/extension-ms-azureresource/readme.md b/tests-upgrade/extension-ms-azureresource/readme.md new file mode 100644 index 00000000000..cd6b9c0ac24 --- /dev/null +++ b/tests-upgrade/extension-ms-azureresource/readme.md @@ -0,0 +1,10 @@ +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +require: + - $(this-folder)/../readme.azure.noprofile.md +input-file: + - $(this-folder)/swagger.json + +``` diff --git a/tests-upgrade/extension-ms-azureresource/swagger.json b/tests-upgrade/extension-ms-azureresource/swagger.json new file mode 100644 index 00000000000..abd0e6ce8c1 --- /dev/null +++ b/tests-upgrade/extension-ms-azureresource/swagger.json @@ -0,0 +1,79 @@ +{ + + "swagger": "2.0", + "info": { + "title": "DatabricksClient", + "version": "2018-04-01", + "description": "ARM Databricks" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "flow": "implicit", + "description": "Azure Active Directory OAuth2 Flow", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "paths": { + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}": { + "get": { + "tags": [ + "Workspaces" + ], + "operationId": "Workspaces_Get", + "description": "Gets the workspace.", + "responses": { + "200": { + "description": "OK - Returns the workspace." + }, + "default": { + "description": "Error response describing why the operation failed." + } + } + } + } + }, + "definitions": { + "Resource": { + "description": "The core properties of ARM resources", + "properties": { + "id": { + "readOnly": true, + "type": "string", + "description": "Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + }, + "name": { + "readOnly": true, + "type": "string", + "description": "The name of the resource" + }, + "type": { + "readOnly": true, + "type": "string", + "description": "The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts." + } + }, + "x-ms-azure-resource": true + } + } +} \ No newline at end of file diff --git a/tests-upgrade/extension-ms-clientflatten/readme.md b/tests-upgrade/extension-ms-clientflatten/readme.md new file mode 100644 index 00000000000..cd6b9c0ac24 --- /dev/null +++ b/tests-upgrade/extension-ms-clientflatten/readme.md @@ -0,0 +1,10 @@ +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +require: + - $(this-folder)/../readme.azure.noprofile.md +input-file: + - $(this-folder)/swagger.json + +``` diff --git a/tests-upgrade/extension-ms-clientflatten/swagger.json b/tests-upgrade/extension-ms-clientflatten/swagger.json new file mode 100644 index 00000000000..b5be373a859 --- /dev/null +++ b/tests-upgrade/extension-ms-clientflatten/swagger.json @@ -0,0 +1,80 @@ +{ + + "swagger": "2.0", + "info": { + "title": "DatabricksClient", + "version": "2018-04-01", + "description": "ARM Databricks" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "flow": "implicit", + "description": "Azure Active Directory OAuth2 Flow", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "paths": { + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces": { + "get": { + "tags": [ + "Workspaces" + ], + "operationId": "Workspaces_Get", + "description": "Gets the workspace.", + "responses": { + "200": { + "description": "OK - Returns the workspace." + }, + "default": { + "description": "Error response describing why the operation failed." + } + } + } + } + }, + "definitions": { + "Workspace": { + "properties": { + "properties": { + "x-ms-client-flatten": true, + "$ref": "#/definitions/WorkspaceProperties", + "description": "The workspace properties." + } + }, + "required": [ + "properties" + ], + "description": "Information about workspace." + }, + "WorkspaceProperties": { + "properties": { + "managedResourceGroupId": { + "type": "string", + "description": "The managed resource group Id." + } + }, + "description": "The workspace properties." + } + } +} \ No newline at end of file diff --git a/tests-upgrade/extension-ms-clientname/readme.md b/tests-upgrade/extension-ms-clientname/readme.md new file mode 100644 index 00000000000..cd6b9c0ac24 --- /dev/null +++ b/tests-upgrade/extension-ms-clientname/readme.md @@ -0,0 +1,10 @@ +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +require: + - $(this-folder)/../readme.azure.noprofile.md +input-file: + - $(this-folder)/swagger.json + +``` diff --git a/tests-upgrade/extension-ms-clientname/swagger.json b/tests-upgrade/extension-ms-clientname/swagger.json new file mode 100644 index 00000000000..ecf7132608d --- /dev/null +++ b/tests-upgrade/extension-ms-clientname/swagger.json @@ -0,0 +1,78 @@ +{ + + "swagger": "2.0", + "info": { + "title": "DatabricksClient", + "version": "2018-04-01", + "description": "ARM Databricks" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "flow": "implicit", + "description": "Azure Active Directory OAuth2 Flow", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "paths": { + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces": { + "get": { + "tags": [ + "Workspaces" + ], + "operationId": "Workspaces_Get", + "description": "Gets the workspace.", + "responses": { + "200": { + "description": "OK - Returns the workspace." + }, + "default": { + "description": "Error response describing why the operation failed." + } + } + } + } + }, + "definitions": { + "Encryption": { + "properties": { + "KeyName": { + "type": "string", + "description": "The name of KeyVault key.", + "x-ms-client-name": "KeyName" + }, + "keyversion": { + "type": "string", + "description": "The version of KeyVault key.", + "x-ms-client-name": "KeyVersion" + }, + "keyvaulturi": { + "type": "string", + "description": "The Uri of KeyVault.", + "x-ms-client-name": "KeyVaultUri" + } + }, + "description": "The object that contains details of encryption used on the workspace." + } + } +} \ No newline at end of file diff --git a/tests-upgrade/extension-ms-discriminatorvalue/readme.md b/tests-upgrade/extension-ms-discriminatorvalue/readme.md new file mode 100644 index 00000000000..cd6b9c0ac24 --- /dev/null +++ b/tests-upgrade/extension-ms-discriminatorvalue/readme.md @@ -0,0 +1,10 @@ +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +require: + - $(this-folder)/../readme.azure.noprofile.md +input-file: + - $(this-folder)/swagger.json + +``` diff --git a/tests-upgrade/extension-ms-discriminatorvalue/swagger.json b/tests-upgrade/extension-ms-discriminatorvalue/swagger.json new file mode 100644 index 00000000000..fc0749d9999 --- /dev/null +++ b/tests-upgrade/extension-ms-discriminatorvalue/swagger.json @@ -0,0 +1,66 @@ +{ + + "swagger": "2.0", + "info": { + "title": "DatabricksClient", + "version": "2018-04-01", + "description": "ARM Databricks" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "flow": "implicit", + "description": "Azure Active Directory OAuth2 Flow", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "paths": { + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces": { + "get": { + "tags": [ + "Workspaces" + ], + "operationId": "Workspaces_Get", + "description": "Gets the workspace.", + "responses": { + "200": { + "description": "OK - Returns the workspace." + }, + "default": { + "description": "Error response describing why the operation failed." + } + } + } + } + }, + "definitions": { + "SecureString": { + "x-ms-discriminator-value": "SecureString", + "properties": { + "value": { + "type": "string" + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/extension-ms-enum/readme.md b/tests-upgrade/extension-ms-enum/readme.md new file mode 100644 index 00000000000..cd6b9c0ac24 --- /dev/null +++ b/tests-upgrade/extension-ms-enum/readme.md @@ -0,0 +1,10 @@ +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +require: + - $(this-folder)/../readme.azure.noprofile.md +input-file: + - $(this-folder)/swagger.json + +``` diff --git a/tests-upgrade/extension-ms-enum/swagger.json b/tests-upgrade/extension-ms-enum/swagger.json new file mode 100644 index 00000000000..c94b2b31512 --- /dev/null +++ b/tests-upgrade/extension-ms-enum/swagger.json @@ -0,0 +1,80 @@ +{ + + "swagger": "2.0", + "info": { + "title": "DatabricksClient", + "version": "2018-04-01", + "description": "ARM Databricks" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "flow": "implicit", + "description": "Azure Active Directory OAuth2 Flow", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "paths": { + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces": { + "get": { + "tags": [ + "Workspaces" + ], + "operationId": "Workspaces_Get", + "description": "Gets the workspace.", + "responses": { + "200": { + "description": "OK - Returns the workspace." + }, + "default": { + "description": "Error response describing why the operation failed." + } + } + } + } + }, + "definitions": { + "ProvisioningState": { + "description": "Provisioning status of the workspace.", + "readOnly": true, + "enum": [ + "Accepted", + "Running", + "Ready", + "Creating", + "Created", + "Deleting", + "Deleted", + "Canceled", + "Failed", + "Succeeded", + "Updating" + ], + "type": "string", + "x-ms-enum": { + "name": "ProvisioningState", + "modelAsString": true + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/extension-ms-examples/readme.md b/tests-upgrade/extension-ms-examples/readme.md new file mode 100644 index 00000000000..cd6b9c0ac24 --- /dev/null +++ b/tests-upgrade/extension-ms-examples/readme.md @@ -0,0 +1,10 @@ +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +require: + - $(this-folder)/../readme.azure.noprofile.md +input-file: + - $(this-folder)/swagger.json + +``` diff --git a/tests-upgrade/extension-ms-examples/swagger.json b/tests-upgrade/extension-ms-examples/swagger.json new file mode 100644 index 00000000000..f107c255c14 --- /dev/null +++ b/tests-upgrade/extension-ms-examples/swagger.json @@ -0,0 +1,64 @@ +{ + + "swagger": "2.0", + "info": { + "title": "DatabricksClient", + "version": "2018-04-01", + "description": "ARM Databricks" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "flow": "implicit", + "description": "Azure Active Directory OAuth2 Flow", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "paths": { + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}": { + "get": { + "tags": [ + "Workspaces" + ], + "operationId": "Workspaces_Get", + "description": "Gets the workspace.", + "x-ms-examples": { + "Get a workspace": { + "$ref": "./examples/WorkspaceGet.json" + }, + "Get a workspace with custom parameters": { + "$ref": "./examples/WorkspaceGetParameters.json" + } + }, + "responses": { + "200": { + "description": "OK - Returns the workspace." + }, + "default": { + "description": "Error response describing why the operation failed." + } + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/extension-ms-longruningoperation/readme.md b/tests-upgrade/extension-ms-longruningoperation/readme.md new file mode 100644 index 00000000000..cd6b9c0ac24 --- /dev/null +++ b/tests-upgrade/extension-ms-longruningoperation/readme.md @@ -0,0 +1,10 @@ +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +require: + - $(this-folder)/../readme.azure.noprofile.md +input-file: + - $(this-folder)/swagger.json + +``` diff --git a/tests-upgrade/extension-ms-longruningoperation/swagger.json b/tests-upgrade/extension-ms-longruningoperation/swagger.json new file mode 100644 index 00000000000..02cd91a8e2b --- /dev/null +++ b/tests-upgrade/extension-ms-longruningoperation/swagger.json @@ -0,0 +1,60 @@ +{ + + "swagger": "2.0", + "info": { + "title": "DatabricksClient", + "version": "2018-04-01", + "description": "ARM Databricks" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "flow": "implicit", + "description": "Azure Active Directory OAuth2 Flow", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "paths": { + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}": { + "delete": { + "tags": [ + "Workspaces" + ], + "operationId": "Workspaces_Delete", + "description": "Deletes the workspace.", + "responses": { + "204": { + "description": "NoContent" + }, + "202": { + "description": "Accepted - Returns this status until the asynchronous operation has completed." + }, + "200": { + "description": "OK. The request has succeeded." + } + }, + "x-ms-long-running-operation": true + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/extension-ms-mutability/readme.md b/tests-upgrade/extension-ms-mutability/readme.md new file mode 100644 index 00000000000..cd6b9c0ac24 --- /dev/null +++ b/tests-upgrade/extension-ms-mutability/readme.md @@ -0,0 +1,10 @@ +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +require: + - $(this-folder)/../readme.azure.noprofile.md +input-file: + - $(this-folder)/swagger.json + +``` diff --git a/tests-upgrade/extension-ms-mutability/swagger.json b/tests-upgrade/extension-ms-mutability/swagger.json new file mode 100644 index 00000000000..2e028ce2a9b --- /dev/null +++ b/tests-upgrade/extension-ms-mutability/swagger.json @@ -0,0 +1,86 @@ +{ + + "swagger": "2.0", + "info": { + "title": "DatabricksClient", + "version": "2018-04-01", + "description": "ARM Databricks" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "flow": "implicit", + "description": "Azure Active Directory OAuth2 Flow", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "paths": { + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces": { + "get": { + "tags": [ + "Workspaces" + ], + "operationId": "Workspaces_Get", + "description": "Gets the workspace.", + "responses": { + "200": { + "description": "OK - Returns the workspace." + }, + "default": { + "description": "Error response describing why the operation failed." + } + } + } + } + }, + "definitions": { + "TrackedResource": { + "description": "The resource model definition for a ARM tracked top level resource", + "properties": { + "tags": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "x-ms-mutability": [ + "read", + "create", + "update" + ], + "description": "Resource tags." + }, + "location": { + "type": "string", + "x-ms-mutability": [ + "read", + "create" + ], + "description": "The geo-location where the resource lives" + } + }, + "required": [ + "location" + ] + } + } +} \ No newline at end of file diff --git a/tests-upgrade/extension-ms-pageable/readme.md b/tests-upgrade/extension-ms-pageable/readme.md new file mode 100644 index 00000000000..cd6b9c0ac24 --- /dev/null +++ b/tests-upgrade/extension-ms-pageable/readme.md @@ -0,0 +1,10 @@ +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +require: + - $(this-folder)/../readme.azure.noprofile.md +input-file: + - $(this-folder)/swagger.json + +``` diff --git a/tests-upgrade/extension-ms-pageable/swagger.json b/tests-upgrade/extension-ms-pageable/swagger.json new file mode 100644 index 00000000000..3fca89e36ab --- /dev/null +++ b/tests-upgrade/extension-ms-pageable/swagger.json @@ -0,0 +1,71 @@ +{ + + "swagger": "2.0", + "info": { + "title": "DatabricksClient", + "version": "2018-04-01", + "description": "ARM Databricks" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "flow": "implicit", + "description": "Azure Active Directory OAuth2 Flow", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "paths": { + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces": { + "get": { + "tags": [ + "Workspaces" + ], + "operationId": "Workspaces_ListByResourceGroup", + "description": "Gets all the workspaces within a resource group.", + "responses": { + "200": { + "description": "OK - Returns an array of workspaces.", + "schema": { + "$ref": "#/definitions/WorkspaceList" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + } + }, + "definitions": { + "WorkspaceList": { + "properties": { + "value": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/extension-ms-paramlocation/readme.md b/tests-upgrade/extension-ms-paramlocation/readme.md new file mode 100644 index 00000000000..cd6b9c0ac24 --- /dev/null +++ b/tests-upgrade/extension-ms-paramlocation/readme.md @@ -0,0 +1,10 @@ +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +require: + - $(this-folder)/../readme.azure.noprofile.md +input-file: + - $(this-folder)/swagger.json + +``` diff --git a/tests-upgrade/extension-ms-paramlocation/swagger.json b/tests-upgrade/extension-ms-paramlocation/swagger.json new file mode 100644 index 00000000000..d42eebb553c --- /dev/null +++ b/tests-upgrade/extension-ms-paramlocation/swagger.json @@ -0,0 +1,73 @@ +{ + + "swagger": "2.0", + "info": { + "title": "DatabricksClient", + "version": "2018-04-01", + "description": "ARM Databricks" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "flow": "implicit", + "description": "Azure Active Directory OAuth2 Flow", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "paths": { + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}": { + "get": { + "tags": [ + "Workspaces" + ], + "operationId": "Workspaces_Get", + "description": "Gets the workspace.", + "parameters": [ + { + "$ref": "#/parameters/WorkspaceName" + } + ], + "responses": { + "200": { + "description": "OK - Returns the workspace." + }, + "default": { + "description": "Error response describing why the operation failed." + } + } + } + } + }, + "parameters": { + "WorkspaceName": { + "name": "workspaceName", + "in": "path", + "required": true, + "type": "string", + "description": "The name of the workspace.", + "minLength": 3, + "maxLength": 64, + "x-ms-parameter-location": "method" + } + } +} \ No newline at end of file From 631de3769d79dddd7fbfd07b4b65e153b80603b2 Mon Sep 17 00:00:00 2001 From: LucasYao93 <53558334+LucasYao93@users.noreply.github.com> Date: Mon, 3 Aug 2020 16:27:22 +0800 Subject: [PATCH 2/4] Add test cases of directive. --- tests-upgrade/.gitignore | 3 +- tests-upgrade/directive-cmdlet/readme.md | 53 +++++ tests-upgrade/directive-cmdlet/swagger.json | 188 ++++++++++++++++++ tests-upgrade/directive-parameter/readme.md | 38 ++++ .../directive-parameter/swagger.json | 185 +++++++++++++++++ 5 files changed, 466 insertions(+), 1 deletion(-) create mode 100644 tests-upgrade/directive-cmdlet/readme.md create mode 100644 tests-upgrade/directive-cmdlet/swagger.json create mode 100644 tests-upgrade/directive-parameter/readme.md create mode 100644 tests-upgrade/directive-parameter/swagger.json diff --git a/tests-upgrade/.gitignore b/tests-upgrade/.gitignore index dc9b2375c7a..c2a0592bbc5 100644 --- a/tests-upgrade/.gitignore +++ b/tests-upgrade/.gitignore @@ -1 +1,2 @@ -generated \ No newline at end of file +generated +generate \ No newline at end of file diff --git a/tests-upgrade/directive-cmdlet/readme.md b/tests-upgrade/directive-cmdlet/readme.md new file mode 100644 index 00000000000..ba2e53e840b --- /dev/null +++ b/tests-upgrade/directive-cmdlet/readme.md @@ -0,0 +1,53 @@ +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +require: + - $(this-folder)/../readme.azure.noprofile.md +input-file: + - $(this-folder)/swagger.json + +directive: + - where: + verb: Get + subject: VirtualMachine + set: + subject: VM + - where: + subject: (^Configuration)(.*) + set: + subject: Config$2 + - select: command + where: + verb: Get + subject: Object + parameter-name: Id + set: + subject: obj + - where: + verb: Get + subject: ResourceGroup + set: + alias: Get-RG + - where: + verb: Get + subject: MultipleAlias + set: + alias: + - Get-MA1 + - Get-MA2 + - where: + verb: patch + subject: CmdletHide + hide: true + - where: + subject: ConfigHide.* + hide: true + - where: + verb: Get + subject: Remove + remove: true + - where: + subject: RegexRemove.* + remove: true +``` diff --git a/tests-upgrade/directive-cmdlet/swagger.json b/tests-upgrade/directive-cmdlet/swagger.json new file mode 100644 index 00000000000..d6941714ff6 --- /dev/null +++ b/tests-upgrade/directive-cmdlet/swagger.json @@ -0,0 +1,188 @@ +{ + + "swagger": "2.0", + "info": { + "title": "DatabricksClient", + "version": "2018-04-01", + "description": "ARM Databricks" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "flow": "implicit", + "description": "Azure Active Directory OAuth2 Flow", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "paths": { + "/VirtualMachine": { + "get": { + "tags": [ + "VirtualMachine" + ], + "operationId": "VirtualMachine_Get", + "description": "rename the cmdlet 'Get-VirtualMachine' to 'Get-VM'", + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/ConfigurationStore": { + "get": { + "tags": [ + "ConfigurationStore" + ], + "operationId": "ConfigurationStore_Get", + "description": "This will change every cmdlet where the subject starts with 'Configuration'", + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/ObjectId/Id/{Id}": { + "get": { + "tags": [ + "Object" + ], + "operationId": "Object_Get", + "description": "rename the cmdlet.", + "parameters": [ + {"$ref": "#/parameters/Id"} + ], + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/ResourceGroup": { + "get": { + "tags": [ + "ResourceGroup" + ], + "operationId": "ResourceGroup_Get", + "description": "rename the cmdlet.", + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/MultipleAlias": { + "get": { + "tags": [ + "MultipleAlias" + ], + "operationId": "MultipleAlias_Get", + "description": "rename the cmdlet.", + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/CmdletHide": { + "get": { + "tags": [ + "CmdletHide" + ], + "operationId": "CmdletHide_Get", + "description": "Hide the cmdlet.", + "responses": { + "200": { + "description": "OK" + } + } + }, + "patch": { + "tags": [ + "CmdletHide" + ], + "operationId": "CmdletHide_Update", + "description": "Hide the cmdlet.", + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/HideRegexCmdlet": { + "get": { + "tags": [ + "HideRegexCmdlet" + ], + "operationId": "ConfigHide_Get", + "description": "Hide the cmdlet.", + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/Remove": { + "get": { + "tags": [ + "Remove" + ], + "operationId": "Remove_Get", + "description": "Remove the cmdlet.", + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/RegexRemove": { + "get": { + "tags": [ + "RegexRemove" + ], + "operationId": "RegexRemoveTest_Get", + "description": "Regex Remove the cmdlet.", + "responses": { + "200": { + "description": "OK" + } + } + } + } + }, + "parameters": { + "Id": { + "name": "Id", + "in": "path", + "type": "string", + "required": true + } + } +} \ No newline at end of file diff --git a/tests-upgrade/directive-parameter/readme.md b/tests-upgrade/directive-parameter/readme.md new file mode 100644 index 00000000000..149198a96df --- /dev/null +++ b/tests-upgrade/directive-parameter/readme.md @@ -0,0 +1,38 @@ +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +require: + - $(this-folder)/../readme.azure.noprofile.md +input-file: + - $(this-folder)/swagger.json + +directive: + - where: + parameter-name: Sku + set: + parameter-name: SkuName + - where: + verb: Get + subject: VirtualMachineSize_Get + parameter-name: VirtualMachineSize + set: + parameter-name: VMSize + - where: + parameter-name: VirtualMachine + set: + alias: + - VM + - VMachine + - where: + parameter-name: ResourceGroup + set: + parameter-description: This is resource group name. + - where: + parameter-name: SubscriptionId + set: + default: + name: SubscriptionId Default + description: Gets the SubscriptionId from the current context. + script: '(Get-AzContext).Subscription.Id' +``` diff --git a/tests-upgrade/directive-parameter/swagger.json b/tests-upgrade/directive-parameter/swagger.json new file mode 100644 index 00000000000..14a301398f7 --- /dev/null +++ b/tests-upgrade/directive-parameter/swagger.json @@ -0,0 +1,185 @@ +{ + + "swagger": "2.0", + "info": { + "title": "DatabricksClient", + "version": "2018-04-01", + "description": "ARM Databricks" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "flow": "implicit", + "description": "Azure Active Directory OAuth2 Flow", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "paths": { + "/SkuName/{Sku}": { + "get": { + "tags": [ + "Sku" + ], + "operationId": "Sku_Get", + "description": "Gets the Sku.", + "parameters": [ + {"$ref": "#/parameters/Sku"} + ], + "responses": { + "200": { + "description": "OK - Returns the Sku." + } + } + } + }, + "/VirtualMachineSize/{VirtualMachineSize}": { + "get": { + "tags": [ + "VirtualMachine" + ], + "operationId": "VirtualMachineSize_Get", + "description": "Get the Virtual Machine.", + "parameters": [ + {"$ref": "#/parameters/VirtualMachineSize"} + ], + "responses": { + "200": { + "description": "OK - Returns the Virtual Machine." + } + } + } + }, + "/VirtualMachine/{VirtualMachine}": { + "get": { + "tags": [ + "VirtualMachine" + ], + "operationId": "VirtualMachine_Get", + "description": "Get the Virtual Machine.", + "parameters": [ + {"$ref": "#/parameters/VirtualMachine"} + ], + "responses": { + "200": { + "description": "OK - Returns the Virtual Machine." + } + } + } + }, + "/Workspace/WorksapceName/{WorkspaceName}": { + "get": { + "tags":[ + "Workspace" + ], + "operationId": "Workspace_Get", + "description": "Get workspace", + "parameters": [ + {"$ref": "#/parameters/WorkspaceName"} + ], + "responses": { + "200": { + "description": "OK - Returns the Workspace." + } + } + } + }, + "/ResourceGroup/{ResourceGroup}": { + "get": { + "tags":[ + "ResourceGroup" + ], + "operationId": "ResourceGroup_Get", + "description": "Get ResourceGroup", + "parameters": [ + {"$ref": "#/parameters/ResourceGroup"} + ], + "responses": { + "200": { + "description": "OK - Returns the Resource Group." + } + } + } + }, + "/SubscriptionId/{SubscriptionId}": { + "get": { + "tags":[ + "Subscription" + ], + "operationId": "Subscription_Get", + "description": "Get SubscriptionId", + "parameters": [ + {"$ref": "#/parameters/SubscriptionId"} + ], + "responses": { + "200": { + "description": "OK - Returns the Subscription." + } + } + } + } + }, + "parameters": { + "Sku": { + "name": "Sku", + "in": "path", + "type": "string", + "required": true, + "description": "SKU for the resource." + }, + "VirtualMachineSize": { + "name": "VirtualMachineSize", + "in": "path", + "type": "string", + "required": true, + "description": "Virtual machine size." + }, + "VirtualMachine": { + "name": "VirtualMachine", + "in": "path", + "type": "string", + "required": true, + "description": "Virtual machine size." + }, + "WorkspaceName": { + "name": "WorkspaceName", + "in": "path", + "type": "string", + "required": true, + "description": "Workspace Name." + }, + "ResourceGroup": { + "name": "ResourceGroup", + "in": "path", + "type": "string", + "required": true, + "description": "Resource Group Name." + }, + "SubscriptionId": { + "name": "SubscriptionId", + "in": "path", + "type": "string", + "required": true, + "description": "Subscription Id." + } + } +} \ No newline at end of file From 310653aa273a16d1948bb482e717c06558a49e86 Mon Sep 17 00:00:00 2001 From: LucasYao93 <53558334+LucasYao93@users.noreply.github.com> Date: Tue, 4 Aug 2020 15:17:50 +0800 Subject: [PATCH 3/4] Add test case of directive. --- tests-upgrade/.gitignore | 4 +- tests-upgrade/Configuration.json | 11 +- tests-upgrade/basic-get-querystr/readme.md | 9 ++ tests-upgrade/basic-get-querystr/swagger.json | 61 ++++++++ tests-upgrade/basic-request-methods/readme.md | 9 ++ .../basic-request-methods/swagger.json | 89 ++++++++++++ .../component-definitions-remote/readme.md | 9 ++ .../component-definitions-remote/swagger.json | 59 ++++++++ .../component-definitions-url/readme.md | 9 ++ .../component-definitions-url/swagger.json | 59 ++++++++ .../directive-aliasremoval/readme.md | 14 ++ .../directive-aliasremoval/swagger.json | 87 +++++++++++ tests-upgrade/directive-enum/readme.md | 16 +++ tests-upgrade/directive-enum/swagger.json | 78 ++++++++++ tests-upgrade/directive-model/readme.md | 28 ++++ tests-upgrade/directive-model/swagger.json | 135 ++++++++++++++++++ tests-upgrade/directive-tableformat/readme.md | 23 +++ .../directive-tableformat/swagger.json | 75 ++++++++++ tests-upgrade/examples/RemoteDefinitions.json | 103 +++++++++++++ .../extension-ms-examples/swagger.json | 4 +- 20 files changed, 876 insertions(+), 6 deletions(-) create mode 100644 tests-upgrade/basic-get-querystr/readme.md create mode 100644 tests-upgrade/basic-get-querystr/swagger.json create mode 100644 tests-upgrade/basic-request-methods/readme.md create mode 100644 tests-upgrade/basic-request-methods/swagger.json create mode 100644 tests-upgrade/component-definitions-remote/readme.md create mode 100644 tests-upgrade/component-definitions-remote/swagger.json create mode 100644 tests-upgrade/component-definitions-url/readme.md create mode 100644 tests-upgrade/component-definitions-url/swagger.json create mode 100644 tests-upgrade/directive-aliasremoval/readme.md create mode 100644 tests-upgrade/directive-aliasremoval/swagger.json create mode 100644 tests-upgrade/directive-enum/readme.md create mode 100644 tests-upgrade/directive-enum/swagger.json create mode 100644 tests-upgrade/directive-model/readme.md create mode 100644 tests-upgrade/directive-model/swagger.json create mode 100644 tests-upgrade/directive-tableformat/readme.md create mode 100644 tests-upgrade/directive-tableformat/swagger.json create mode 100644 tests-upgrade/examples/RemoteDefinitions.json diff --git a/tests-upgrade/.gitignore b/tests-upgrade/.gitignore index c2a0592bbc5..6b78566a203 100644 --- a/tests-upgrade/.gitignore +++ b/tests-upgrade/.gitignore @@ -1,2 +1,4 @@ generated -generate \ No newline at end of file +generate + +CompareResult \ No newline at end of file diff --git a/tests-upgrade/Configuration.json b/tests-upgrade/Configuration.json index 6ad6ceb5e7f..19d490b1954 100644 --- a/tests-upgrade/Configuration.json +++ b/tests-upgrade/Configuration.json @@ -9,11 +9,16 @@ "basic-response-multioperation", "basic-spec-required", "basic-spec-root", - "datamodels-datatypes-array", - "component-param", + "component-definitions-combined", + "component-definitions-local", "component-multiparam", + "component-param", + "component-param-inbody", "component-param-localremote", - "component-param-inbody" + "component-param-remote", + "datamodels-datatypes-array", + "datamodels-datatypes-integer", + "datamodels-datatypes-string" ], "BlackList": [ "basic-get-querystr", diff --git a/tests-upgrade/basic-get-querystr/readme.md b/tests-upgrade/basic-get-querystr/readme.md new file mode 100644 index 00000000000..43b8fe48491 --- /dev/null +++ b/tests-upgrade/basic-get-querystr/readme.md @@ -0,0 +1,9 @@ +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +require: + - $(this-folder)/../readme.azure.noprofile.md +input-file: + - $(this-folder)/swagger.json +``` diff --git a/tests-upgrade/basic-get-querystr/swagger.json b/tests-upgrade/basic-get-querystr/swagger.json new file mode 100644 index 00000000000..8ec03daef8f --- /dev/null +++ b/tests-upgrade/basic-get-querystr/swagger.json @@ -0,0 +1,61 @@ +{ + + "swagger": "2.0", + "info": { + "title": "DatabricksClient", + "version": "2018-04-01", + "description": "ARM Databricks" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "flow": "implicit", + "description": "Azure Active Directory OAuth2 Flow", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "paths": { + "/users": { + "get": { + "tags": [ + "users" + ], + "operationId": "users_Get", + "description": "get user list.", + "parameters": [ + { + "in": "query", + "name": "role", + "type": "string", + "required": true + } + ], + "responses": { + "200": { + "description": "OK" + } + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/basic-request-methods/readme.md b/tests-upgrade/basic-request-methods/readme.md new file mode 100644 index 00000000000..43b8fe48491 --- /dev/null +++ b/tests-upgrade/basic-request-methods/readme.md @@ -0,0 +1,9 @@ +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +require: + - $(this-folder)/../readme.azure.noprofile.md +input-file: + - $(this-folder)/swagger.json +``` diff --git a/tests-upgrade/basic-request-methods/swagger.json b/tests-upgrade/basic-request-methods/swagger.json new file mode 100644 index 00000000000..c29f5743bb5 --- /dev/null +++ b/tests-upgrade/basic-request-methods/swagger.json @@ -0,0 +1,89 @@ +{ + + "swagger": "2.0", + "info": { + "title": "DatabricksClient", + "version": "2018-04-01", + "description": "ARM Databricks" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "flow": "implicit", + "description": "Azure Active Directory OAuth2 Flow", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "paths": { + "/users": { + "get": { + "tags": [ + "users" + ], + "operationId": "users_Get", + "description": "get user list.", + "responses": { + "200": { + "description": "OK" + } + } + }, + "delete": { + "tags": [ + "users" + ], + "operationId": "users_Delete", + "description": "delete a user.", + "responses": { + "200": { + "description": "OK" + } + } + }, + "put": { + "tags": [ + "users" + ], + "operationId": "users_CreateOrUpdate", + "description": "Create or Update a user.", + "responses": { + "200": { + "description": "OK" + } + } + }, + "post": { + "tags": [ + "users" + ], + "operationId": "users_Update", + "description": "Update a user.", + "responses": { + "200": { + "description": "OK" + } + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/component-definitions-remote/readme.md b/tests-upgrade/component-definitions-remote/readme.md new file mode 100644 index 00000000000..43b8fe48491 --- /dev/null +++ b/tests-upgrade/component-definitions-remote/readme.md @@ -0,0 +1,9 @@ +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +require: + - $(this-folder)/../readme.azure.noprofile.md +input-file: + - $(this-folder)/swagger.json +``` diff --git a/tests-upgrade/component-definitions-remote/swagger.json b/tests-upgrade/component-definitions-remote/swagger.json new file mode 100644 index 00000000000..06c53dc20f4 --- /dev/null +++ b/tests-upgrade/component-definitions-remote/swagger.json @@ -0,0 +1,59 @@ +{ + + "swagger": "2.0", + "info": { + "title": "DatabricksClient", + "version": "2018-04-01", + "description": "ARM Databricks" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "flow": "implicit", + "description": "Azure Active Directory OAuth2 Flow", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "paths": { + "/subscriptions/xxxx-xxxx-xxxx/providers/Microsoft.Databricks/workspaces": { + "get": { + "tags": [ + "Workspaces" + ], + "operationId": "Workspaces_ListBySubscription", + "description": "Gets all the workspaces within a subscription.", + "responses": { + "200": { + "description": "OK - Returns an array of workspaces." + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "../examples/RemoteDefinitions.json#/definitions/ErrorResponse" + } + } + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/component-definitions-url/readme.md b/tests-upgrade/component-definitions-url/readme.md new file mode 100644 index 00000000000..43b8fe48491 --- /dev/null +++ b/tests-upgrade/component-definitions-url/readme.md @@ -0,0 +1,9 @@ +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +require: + - $(this-folder)/../readme.azure.noprofile.md +input-file: + - $(this-folder)/swagger.json +``` diff --git a/tests-upgrade/component-definitions-url/swagger.json b/tests-upgrade/component-definitions-url/swagger.json new file mode 100644 index 00000000000..3c7b35cbfe6 --- /dev/null +++ b/tests-upgrade/component-definitions-url/swagger.json @@ -0,0 +1,59 @@ +{ + + "swagger": "2.0", + "info": { + "title": "DatabricksClient", + "version": "2018-04-01", + "description": "ARM Databricks" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "flow": "implicit", + "description": "Azure Active Directory OAuth2 Flow", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "paths": { + "/subscriptions/xxxx-xxxx-xxxx/providers/Microsoft.Databricks/workspaces": { + "get": { + "tags": [ + "Workspaces" + ], + "operationId": "Workspaces_ListBySubscription", + "description": "Gets all the workspaces within a subscription.", + "responses": { + "200": { + "description": "OK - Returns an array of workspaces." + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "https://github.com/LucasYao93/autorest.powershell/tree/lucas/modelerfour-dev/tests-upgrade/examples/RemoteDefinitions.json#definitions/ErrorResponse" + } + } + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/directive-aliasremoval/readme.md b/tests-upgrade/directive-aliasremoval/readme.md new file mode 100644 index 00000000000..0f616b88835 --- /dev/null +++ b/tests-upgrade/directive-aliasremoval/readme.md @@ -0,0 +1,14 @@ +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +require: + - $(this-folder)/../readme.azure.noprofile.md +input-file: + - $(this-folder)/swagger.json + +directive: + - where: + parameter-name: ResourceGroupName + clear-alias: true +``` diff --git a/tests-upgrade/directive-aliasremoval/swagger.json b/tests-upgrade/directive-aliasremoval/swagger.json new file mode 100644 index 00000000000..53ed81c131f --- /dev/null +++ b/tests-upgrade/directive-aliasremoval/swagger.json @@ -0,0 +1,87 @@ +{ + + "swagger": "2.0", + "info": { + "title": "DatabricksClient", + "version": "2018-04-01", + "description": "ARM Databricks" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "flow": "implicit", + "description": "Azure Active Directory OAuth2 Flow", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "paths": { + "/ResourceGroupName/{ResourceGroupName}": { + "get": { + "tags": [ + "ClearRename" + ], + "operationId": "ClearRename_Get", + "description": "rename the Model", + "parameters": [ + {"$ref": "#/parameters/ResourceGroup"} + ], + "responses": { + "200": { + "description": "OK" + } + } + } + } + }, + "parameters": { + "ResourceGroup": { + "name": "ResourceGroupName", + "in": "path", + "type": "string", + "required": true, + "description": "Resource Group Name." + } + }, + "definitions": { + "ResourceGroupName": { + "description": "The core properties of ARM resources", + "properties": { + "id": { + "readOnly": true, + "type": "string", + "description": "Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + }, + "name": { + "readOnly": true, + "type": "string", + "description": "The name of the resource" + }, + "type": { + "readOnly": true, + "type": "string", + "description": "The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts." + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/directive-enum/readme.md b/tests-upgrade/directive-enum/readme.md new file mode 100644 index 00000000000..071d8f56550 --- /dev/null +++ b/tests-upgrade/directive-enum/readme.md @@ -0,0 +1,16 @@ +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +require: + - $(this-folder)/../readme.azure.noprofile.md +input-file: + - $(this-folder)/swagger.json + +directive: + - where: + enum-name: provisioningState + enum-value-name: Upgrading + set: + enum-value-name: Update +``` diff --git a/tests-upgrade/directive-enum/swagger.json b/tests-upgrade/directive-enum/swagger.json new file mode 100644 index 00000000000..ccb13464b7b --- /dev/null +++ b/tests-upgrade/directive-enum/swagger.json @@ -0,0 +1,78 @@ +{ + + "swagger": "2.0", + "info": { + "title": "DatabricksClient", + "version": "2018-04-01", + "description": "ARM Databricks" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "flow": "implicit", + "description": "Azure Active Directory OAuth2 Flow", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "paths": { + "/subscriptions/resourceGroup": { + "get": { + "tags": [ + "Workspaces" + ], + "operationId": "Workspaces_Get", + "description": "Gets the workspace.", + "responses": { + "200": { + "description": "OK-Return workspace." + } + } + } + } + }, + "definitions": { + "CanonicalSupportPlanProperties": { + "type": "object", + "description": "The properties of the Canonical support plan.", + "properties": { + "provisioningState": { + "type": "string", + "description": "The provisioning state of the resource.", + "enum": [ + "Succeeded", + "Failed", + "Cancelled", + "Purchasing", + "Downgrading", + "Cancelling", + "Upgrading" + ], + "x-ms-enum": { + "name": "ProvisioningState", + "modelAsString": true + } + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/directive-model/readme.md b/tests-upgrade/directive-model/readme.md new file mode 100644 index 00000000000..600c44c596b --- /dev/null +++ b/tests-upgrade/directive-model/readme.md @@ -0,0 +1,28 @@ +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +require: + - $(this-folder)/../readme.azure.noprofile.md +input-file: + - $(this-folder)/swagger.json + +directive: + - where: + model-name: Resource + set: + model-name: AzureResource + - where: + model-name: ^KeyValue(.*) + set: + model-name: kv$1 + - where: + model-name: VirtualMachine + property-name: VirtualMachineName + set: + property-name: Name + - where: + property-name: (.*)Azure + set: + property-name: Az +``` diff --git a/tests-upgrade/directive-model/swagger.json b/tests-upgrade/directive-model/swagger.json new file mode 100644 index 00000000000..949c05c3ec9 --- /dev/null +++ b/tests-upgrade/directive-model/swagger.json @@ -0,0 +1,135 @@ +{ + + "swagger": "2.0", + "info": { + "title": "DatabricksClient", + "version": "2018-04-01", + "description": "ARM Databricks" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "flow": "implicit", + "description": "Azure Active Directory OAuth2 Flow", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "paths": { + "/ModelRename": { + "get": { + "tags": [ + "ModelRename" + ], + "operationId": "ModelRename_Get", + "description": "rename the Model", + "responses": { + "200": { + "description": "OK" + } + } + } + } + }, + "definitions": { + "Resource": { + "description": "The core properties of ARM resources", + "properties": { + "id": { + "readOnly": true, + "type": "string", + "description": "Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + }, + "name": { + "readOnly": true, + "type": "string", + "description": "The name of the resource" + }, + "type": { + "readOnly": true, + "type": "string", + "description": "The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts." + } + } + }, + "KeyValue": { + "description": "The core properties Key value", + "properties": { + "id": { + "readOnly": true, + "type": "string", + "description": "Fully qualified Key value Id for the Key value." + }, + "name": { + "readOnly": true, + "type": "string", + "description": "The name of the Key value" + }, + "type": { + "readOnly": true, + "type": "string", + "description": "The type of the Key value. " + } + } + }, + "VirtualMachine": { + "description": "The core properties of VirtualMachine", + "properties": { + "id": { + "readOnly": true, + "type": "string", + "description": "Fully qualified VirtualMachine Id for the VirtualMachine." + }, + "VirtualMachineName": { + "readOnly": true, + "type": "string", + "description": "The name of the VirtualMachine" + }, + "type": { + "readOnly": true, + "type": "string", + "description": "The type of the VirtualMachine." + } + } + }, + "AzureEnv": { + "description": "The core properties of AzureEnv", + "properties": { + "id": { + "readOnly": true, + "type": "string", + "description": "Fully qualified AzureEnv Id for the AzureEnv." + }, + "Name": { + "readOnly": true, + "type": "string", + "description": "The name of the AzureEnv" + }, + "typeAzure": { + "readOnly": true, + "type": "string", + "description": "The type of the AzureEnv." + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/directive-tableformat/readme.md b/tests-upgrade/directive-tableformat/readme.md new file mode 100644 index 00000000000..d09ec83598a --- /dev/null +++ b/tests-upgrade/directive-tableformat/readme.md @@ -0,0 +1,23 @@ +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +require: + - $(this-folder)/../readme.azure.noprofile.md +input-file: + - $(this-folder)/swagger.json + +directive: + - where: + model-name: VirtualMachine + set: + format-table: + properties: + - Name + - ResourceGroup + labels: + ResourceGroup: Resource Group + width: + Name: 60 + ResourceGroup: 80 +``` diff --git a/tests-upgrade/directive-tableformat/swagger.json b/tests-upgrade/directive-tableformat/swagger.json new file mode 100644 index 00000000000..5df9d161802 --- /dev/null +++ b/tests-upgrade/directive-tableformat/swagger.json @@ -0,0 +1,75 @@ +{ + + "swagger": "2.0", + "info": { + "title": "DatabricksClient", + "version": "2018-04-01", + "description": "ARM Databricks" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "flow": "implicit", + "description": "Azure Active Directory OAuth2 Flow", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "paths": { + "/TableFormatting": { + "get": { + "tags": [ + "TableFormatting" + ], + "operationId": "TableFormatting_Get", + "description": "Table Formatting", + "responses": { + "200": { + "description": "OK" + } + } + } + } + }, + "definitions": { + "VirtualMachine": { + "description": "The core properties of ARM resources", + "properties": { + "id": { + "readOnly": true, + "type": "string", + "description": "Fully qualified VirtualMachine Id for the VirtualMachine. " + }, + "name": { + "readOnly": true, + "type": "string", + "description": "The name of the VirtualMachine" + }, + "ResourceGroup": { + "readOnly": true, + "type": "string", + "description": "The type of the resource." + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/examples/RemoteDefinitions.json b/tests-upgrade/examples/RemoteDefinitions.json new file mode 100644 index 00000000000..547c57f8a9b --- /dev/null +++ b/tests-upgrade/examples/RemoteDefinitions.json @@ -0,0 +1,103 @@ +{ + + "swagger": "2.0", + "info": { + "title": "DatabricksClient", + "version": "2018-04-01", + "description": "ARM Databricks" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "flow": "implicit", + "description": "Azure Active Directory OAuth2 Flow", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "paths": { + }, + "definitions": { + "ErrorDetail": { + "title": "Error details.", + "type": "object", + "properties": { + "code": { + "description": "The error's code.", + "type": "string" + }, + "message": { + "description": "A human readable error message.", + "type": "string" + }, + "target": { + "description": "Indicates which property in the request is responsible for the error.", + "type": "string" + } + }, + "required": [ + "code", + "message" + ] + }, + "ErrorInfo": { + "title": "The code and message for an error.", + "type": "object", + "properties": { + "code": { + "description": "A machine readable error code.", + "type": "string" + }, + "message": { + "description": "A human readable error message.", + "type": "string" + }, + "details": { + "description": "error details.", + "type": "string" + }, + "innererror": { + "description": "Inner error details if they exist.", + "type": "string" + } + }, + "required": [ + "code", + "message" + ] + }, + "ErrorResponse": { + "title": "Error response.", + "description": "Contains details when the response code indicates an error.", + "type": "object", + "properties": { + "error": { + "description": "The error details.", + "type": "string" + } + }, + "required": [ + "error" + ] + } + } +} diff --git a/tests-upgrade/extension-ms-examples/swagger.json b/tests-upgrade/extension-ms-examples/swagger.json index f107c255c14..457c0601be6 100644 --- a/tests-upgrade/extension-ms-examples/swagger.json +++ b/tests-upgrade/extension-ms-examples/swagger.json @@ -44,10 +44,10 @@ "description": "Gets the workspace.", "x-ms-examples": { "Get a workspace": { - "$ref": "./examples/WorkspaceGet.json" + "$ref": "../examples/WorkspaceGet.json" }, "Get a workspace with custom parameters": { - "$ref": "./examples/WorkspaceGetParameters.json" + "$ref": "../examples/WorkspaceGetParameters.json" } }, "responses": { From 37bb2bb956a506e8e9855c6258261c0e9003969c Mon Sep 17 00:00:00 2001 From: LucasYao93 <53558334+LucasYao93@users.noreply.github.com> Date: Wed, 5 Aug 2020 16:15:27 +0800 Subject: [PATCH 4/4] Add test cases to AllowList. --- tests-upgrade/Configuration.json | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tests-upgrade/Configuration.json b/tests-upgrade/Configuration.json index f74ae0b382f..51c7d7c1ce7 100644 --- a/tests-upgrade/Configuration.json +++ b/tests-upgrade/Configuration.json @@ -5,13 +5,16 @@ "basic-get", "basic-get-delete", "basic-get-delete-put-patch", + "basic-get-querystr", "basic-get-response-operation", + "basic-polymorphism", + "basic-request-methods", "basic-response-multioperation", "basic-spec-required", "basic-spec-root", - "basic-polymorphism", "component-definitions-combined", "component-definitions-local", + "component-definitions-remote", "component-multiparam", "component-param", "component-param-inbody", @@ -19,7 +22,16 @@ "component-param-remote", "datamodels-datatypes-array", "datamodels-datatypes-integer", - "datamodels-datatypes-string" + "datamodels-datatypes-string", + "directive-model", + "directive-tableformat", + "extension-ms-azureresource", + "extension-ms-clientflatten", + "extension-ms-clientname", + "extension-ms-discriminatorvalue", + "extension-ms-examples", + "extension-ms-longruningoperation", + "extension-ms-pageable" ], "BlackList": [ "basic-get-querystr",