From fd7330ee5fa72989bf06449efa6cb4f624d486cf Mon Sep 17 00:00:00 2001 From: Heng Lu Date: Wed, 8 May 2024 15:01:49 +0800 Subject: [PATCH] add more tests --- commands/generate_test.go | 84 +- commands/test_test.go | 106 + .../Accounts_AddRootCollectionAdmin.json | 22 + .../Accounts_CheckNameAvailability.json | 24 + .../examples/Accounts_CreateOrUpdate.json | 98 + .../examples/Accounts_Delete.json | 39 + .../examples/Accounts_Get.json | 76 + .../Accounts_ListByResourceGroup.json | 82 + .../examples/Accounts_ListBySubscription.json | 81 + .../examples/Accounts_ListKeys.json | 23 + .../examples/Accounts_Update.json | 117 + .../examples/DefaultAccounts_Get.json | 27 + .../examples/DefaultAccounts_Remove.json | 28 + .../examples/DefaultAccounts_Set.json | 32 + .../examples/Features_AccountGet.json | 31 + .../examples/Features_SubscriptionGet.json | 30 + .../KafkaConfigurations_CreateOrUpdate.json | 75 + .../examples/KafkaConfigurations_Delete.json | 13 + .../examples/KafkaConfigurations_Get.json | 38 + .../KafkaConfigurations_ListByAccount.json | 43 + .../examples/Operations_List.json | 75 + ...ateEndpointConnections_CreateOrUpdate.json | 69 + .../PrivateEndpointConnections_Delete.json | 40 + .../PrivateEndpointConnections_Get.json | 35 + ...vateEndpointConnections_ListByAccount.json | 53 + .../PrivateLinkResources_GetByGroupId.json | 34 + .../PrivateLinkResources_ListByAccount.json | 51 + .../examples/Usages_Get.json | 42 + .../expect/Microsoft.Purview/main.tf | 94 + .../expect/Microsoft.Purview_accounts/main.tf | 136 + .../main.tf | 108 + .../main.tf | 84 + .../main.tf | 75 + .../Microsoft.Purview_locations/main.tf | 71 + .../Microsoft.Purview_operations/main.tf | 42 + .../purview.json | 2685 +++++++++++++++++ ...ConfigurationStoresCreateWithIdentity.json | 0 .../expect/dependency.tf | 15 + .../expect/provider.tf | 35 + .../expect/testing.tf | 25 + ...SqlVulnerabilityAssessmentBaselineAdd.json | 0 ...DatabaseSqlVulnerabilityAssessmentGet.json | 0 .../expect/dependency.tf | 41 + .../expect/provider.tf | 35 + .../expect/testing.tf | 37 + .../testdata/TestTestCommand_AllPass/main.tf | 44 + .../TestTestCommand_BadRequest/main.tf | 44 + .../testdata/TestTestCommand_Diff/main.tf | 44 + .../TestTestCommand_MissingProperties/main.tf | 45 + resource/context.go | 4 +- tf/terraform.go | 2 + 51 files changed, 5112 insertions(+), 22 deletions(-) create mode 100644 commands/test_test.go create mode 100644 commands/testdata/TestGenerateCommand_fromSwagger/examples/Accounts_AddRootCollectionAdmin.json create mode 100644 commands/testdata/TestGenerateCommand_fromSwagger/examples/Accounts_CheckNameAvailability.json create mode 100644 commands/testdata/TestGenerateCommand_fromSwagger/examples/Accounts_CreateOrUpdate.json create mode 100644 commands/testdata/TestGenerateCommand_fromSwagger/examples/Accounts_Delete.json create mode 100644 commands/testdata/TestGenerateCommand_fromSwagger/examples/Accounts_Get.json create mode 100644 commands/testdata/TestGenerateCommand_fromSwagger/examples/Accounts_ListByResourceGroup.json create mode 100644 commands/testdata/TestGenerateCommand_fromSwagger/examples/Accounts_ListBySubscription.json create mode 100644 commands/testdata/TestGenerateCommand_fromSwagger/examples/Accounts_ListKeys.json create mode 100644 commands/testdata/TestGenerateCommand_fromSwagger/examples/Accounts_Update.json create mode 100644 commands/testdata/TestGenerateCommand_fromSwagger/examples/DefaultAccounts_Get.json create mode 100644 commands/testdata/TestGenerateCommand_fromSwagger/examples/DefaultAccounts_Remove.json create mode 100644 commands/testdata/TestGenerateCommand_fromSwagger/examples/DefaultAccounts_Set.json create mode 100644 commands/testdata/TestGenerateCommand_fromSwagger/examples/Features_AccountGet.json create mode 100644 commands/testdata/TestGenerateCommand_fromSwagger/examples/Features_SubscriptionGet.json create mode 100644 commands/testdata/TestGenerateCommand_fromSwagger/examples/KafkaConfigurations_CreateOrUpdate.json create mode 100644 commands/testdata/TestGenerateCommand_fromSwagger/examples/KafkaConfigurations_Delete.json create mode 100644 commands/testdata/TestGenerateCommand_fromSwagger/examples/KafkaConfigurations_Get.json create mode 100644 commands/testdata/TestGenerateCommand_fromSwagger/examples/KafkaConfigurations_ListByAccount.json create mode 100644 commands/testdata/TestGenerateCommand_fromSwagger/examples/Operations_List.json create mode 100644 commands/testdata/TestGenerateCommand_fromSwagger/examples/PrivateEndpointConnections_CreateOrUpdate.json create mode 100644 commands/testdata/TestGenerateCommand_fromSwagger/examples/PrivateEndpointConnections_Delete.json create mode 100644 commands/testdata/TestGenerateCommand_fromSwagger/examples/PrivateEndpointConnections_Get.json create mode 100644 commands/testdata/TestGenerateCommand_fromSwagger/examples/PrivateEndpointConnections_ListByAccount.json create mode 100644 commands/testdata/TestGenerateCommand_fromSwagger/examples/PrivateLinkResources_GetByGroupId.json create mode 100644 commands/testdata/TestGenerateCommand_fromSwagger/examples/PrivateLinkResources_ListByAccount.json create mode 100644 commands/testdata/TestGenerateCommand_fromSwagger/examples/Usages_Get.json create mode 100644 commands/testdata/TestGenerateCommand_fromSwagger/expect/Microsoft.Purview/main.tf create mode 100644 commands/testdata/TestGenerateCommand_fromSwagger/expect/Microsoft.Purview_accounts/main.tf create mode 100644 commands/testdata/TestGenerateCommand_fromSwagger/expect/Microsoft.Purview_accounts_kafkaConfigurations/main.tf create mode 100644 commands/testdata/TestGenerateCommand_fromSwagger/expect/Microsoft.Purview_accounts_privateEndpointConnections/main.tf create mode 100644 commands/testdata/TestGenerateCommand_fromSwagger/expect/Microsoft.Purview_accounts_privateLinkResources/main.tf create mode 100644 commands/testdata/TestGenerateCommand_fromSwagger/expect/Microsoft.Purview_locations/main.tf create mode 100644 commands/testdata/TestGenerateCommand_fromSwagger/expect/Microsoft.Purview_operations/main.tf create mode 100644 commands/testdata/TestGenerateCommand_fromSwagger/purview.json rename commands/testdata/{case1 => TestGenerateCommand_identity}/ConfigurationStoresCreateWithIdentity.json (100%) create mode 100644 commands/testdata/TestGenerateCommand_identity/expect/dependency.tf create mode 100644 commands/testdata/TestGenerateCommand_identity/expect/provider.tf create mode 100644 commands/testdata/TestGenerateCommand_identity/expect/testing.tf rename commands/testdata/{case0 => TestGenerateCommand_multiple}/DatabaseSqlVulnerabilityAssessmentBaselineAdd.json (100%) rename commands/testdata/{case0 => TestGenerateCommand_multiple}/DatabaseSqlVulnerabilityAssessmentGet.json (100%) create mode 100644 commands/testdata/TestGenerateCommand_multiple/expect/dependency.tf create mode 100644 commands/testdata/TestGenerateCommand_multiple/expect/provider.tf create mode 100644 commands/testdata/TestGenerateCommand_multiple/expect/testing.tf create mode 100644 commands/testdata/TestTestCommand_AllPass/main.tf create mode 100644 commands/testdata/TestTestCommand_BadRequest/main.tf create mode 100644 commands/testdata/TestTestCommand_Diff/main.tf create mode 100644 commands/testdata/TestTestCommand_MissingProperties/main.tf diff --git a/commands/generate_test.go b/commands/generate_test.go index 745d20d1..fd319b28 100644 --- a/commands/generate_test.go +++ b/commands/generate_test.go @@ -1,51 +1,60 @@ package commands_test import ( + "fmt" + "math/rand" "os" "path" + "strings" "testing" "github.com/azure/armstrong/commands" + "github.com/azure/armstrong/resource" "github.com/azure/armstrong/tf" ) func TestGenerateCommand_multiple(t *testing.T) { - wd, err := os.Getwd() - if err != nil { - t.Fatalf("failed to get working directory: %+v", err) - } - runGenerateCommand([][]string{ - {"-type", "data", "-path", path.Join(wd, "testdata", "case0", "DatabaseSqlVulnerabilityAssessmentGet.json")}, - {"-path", path.Join(wd, "testdata", "case0", "DatabaseSqlVulnerabilityAssessmentBaselineAdd.json")}, - }, t) + runGenerateCommand(t, [][]string{ + {"-type", "data", "-path", "DatabaseSqlVulnerabilityAssessmentGet.json"}, + {"-path", "DatabaseSqlVulnerabilityAssessmentBaselineAdd.json"}, + }) } func TestGenerateCommand_identity(t *testing.T) { - wd, err := os.Getwd() - if err != nil { - t.Fatalf("failed to get working directory: %+v", err) - } - runGenerateCommand([][]string{ - {"-path", path.Join(wd, "testdata", "case1", "ConfigurationStoresCreateWithIdentity.json")}, - }, t) + runGenerateCommand(t, [][]string{ + {"-path", "ConfigurationStoresCreateWithIdentity.json"}, + }) +} + +func TestGenerateCommand_fromSwagger(t *testing.T) { + runGenerateCommand(t, [][]string{ + {"-swagger", "purview.json"}, + }) } -func runGenerateCommand(args [][]string, t *testing.T) { +func runGenerateCommand(t *testing.T, args [][]string) { + resource.R = rand.New(rand.NewSource(0)) + wd, err := os.Getwd() if err != nil { t.Fatalf("failed to get working directory: %+v", err) } - wd = path.Join(wd, ".temp", t.Name()) - if err := os.MkdirAll(wd, 0755); err != nil { + tfDir := path.Join(wd, ".temp", t.Name()) + if err := os.MkdirAll(tfDir, 0755); err != nil { t.Fatalf("failed to create working directory: %+v", err) } - defer os.RemoveAll(wd) + defer os.RemoveAll(tfDir) command := commands.GenerateCommand{} for _, arg := range args { - res := command.Run(append([]string{"-working-dir", wd}, arg...)) + for i, a := range arg { + if a == "-path" || a == "-swagger" { + arg[i+1] = path.Join(wd, "testdata", t.Name(), arg[i+1]) + } + } + res := command.Run(append([]string{"-working-dir", tfDir}, arg...)) if res != 0 { t.Fatalf("failed to generate terraform configuration") } @@ -67,4 +76,39 @@ func runGenerateCommand(args [][]string, t *testing.T) { if out.ErrorCount != 0 { t.Fatalf("[Error] terraform configuration is not valid: %+v\n", out) } + + expectDir := path.Join(wd, "testdata", t.Name(), "expect") + if err := requireFoldersEqual(expectDir, tfDir); err != nil { + t.Fatal(err) + } +} + +func requireFoldersEqual(path1, path2 string) error { + files, err := os.ReadDir(path1) + if err != nil { + return err + } + for _, f := range files { + if f.IsDir() { + if err := requireFoldersEqual(path.Join(path1, f.Name()), path.Join(path2, f.Name())); err != nil { + return err + } + } else { + if f.Name() == "provider.tf" || !strings.HasSuffix(f.Name(), ".tf") { + continue + } + actual, err := os.ReadFile(path.Join(path2, f.Name())) + if err != nil { + return err + } + expect, err := os.ReadFile(path.Join(path1, f.Name())) + if err != nil { + return err + } + if string(expect) != string(actual) { + return fmt.Errorf("expected %s to be equal to %s", path.Join(path1, f.Name()), path.Join(path2, f.Name())) + } + } + } + return nil } diff --git a/commands/test_test.go b/commands/test_test.go new file mode 100644 index 00000000..3af29f78 --- /dev/null +++ b/commands/test_test.go @@ -0,0 +1,106 @@ +package commands_test + +import ( + "os" + "path" + "strings" + "testing" + + "github.com/azure/armstrong/commands" +) + +func TestTestCommand_AllPass(t *testing.T) { + if os.Getenv("TF_ACC") == "" { + t.Skip("TF_ACC is not set") + } + runTestCommand(t, map[string]string{ + "all_passed_report.md": "Microsoft.Automation/automationAccounts@2023-11-01 (azapi_resource.automationAccount)", + }) +} + +func TestTestCommand_Diff(t *testing.T) { + if os.Getenv("TF_ACC") == "" { + t.Skip("TF_ACC is not set") + } + runTestCommand(t, map[string]string{ + "partial_passed_report.md": "Microsoft.Resources/resourceGroups@2020-06-01 (azapi_resource.resourceGroup)", + "Microsoft.Automation_automationAccounts@2023-11-01_automationAccount.md": ".properties.sku.name: expect Free, but got Basic", + }) +} + +func TestTestCommand_MissingProperties(t *testing.T) { + if os.Getenv("TF_ACC") == "" { + t.Skip("TF_ACC is not set") + } + runTestCommand(t, map[string]string{ + "partial_passed_report.md": "Microsoft.Resources/resourceGroups@2020-06-01 (azapi_resource.resourceGroup)", + "Microsoft.Automation_automationAccounts@2023-11-01_automationAccount.md": ".properties.sku.family = bar: not returned from response", + }) +} + +func TestTestCommand_BadRequest(t *testing.T) { + if os.Getenv("TF_ACC") == "" { + t.Skip("TF_ACC is not set") + } + runTestCommand(t, map[string]string{ + "partial_passed_report.md": "Microsoft.Resources/resourceGroups@2020-06-01 (azapi_resource.resourceGroup)", + "Microsoft.Automation_automationAccounts@2023-11-01_automationAccount.md": "RESPONSE 400: 400 Bad Request", + }) +} + +func runTestCommand(t *testing.T, fileContentMap map[string]string) { + wd, err := os.Getwd() + if err != nil { + t.Fatalf("failed to get working directory: %+v", err) + } + + tfDir := path.Join(wd, ".temp", t.Name()) + if err := os.MkdirAll(tfDir, 0755); err != nil { + t.Fatalf("failed to create working directory: %+v", err) + } + defer os.RemoveAll(tfDir) + defer commands.CleanupCommand{}.Run([]string{"-working-dir", tfDir}) + + if err := copyFile(path.Join(wd, "testdata", t.Name(), "main.tf"), path.Join(tfDir, "main.tf")); err != nil { + t.Fatalf("failed to copy file: %+v", err) + } + + command := commands.TestCommand{} + command.Run([]string{"-working-dir", tfDir}) + + reportDir := tfDir + dirs, err := os.ReadDir(reportDir) + if err != nil { + t.Fatalf("failed to read directory %s: %+v", reportDir, err) + } + for _, dir := range dirs { + if dir.IsDir() && strings.HasPrefix(dir.Name(), "armstrong_reports_") { + reportDir = path.Join(reportDir, dir.Name()) + break + } + } + + for file, content := range fileContentMap { + filePath := path.Join(reportDir, file) + if _, err := os.Stat(filePath); os.IsNotExist(err) { + t.Fatalf("file %s not found", filePath) + } + if content != "" { + data, err := os.ReadFile(filePath) + if err != nil { + t.Fatalf("failed to read file %s: %+v", filePath, err) + } + if !strings.Contains(string(data), content) { + t.Fatalf("file %s does not contain expected content", filePath) + } + } + } +} + +func copyFile(src, dst string) error { + data, err := os.ReadFile(src) + if err != nil { + return err + } + return os.WriteFile(dst, data, 0644) +} diff --git a/commands/testdata/TestGenerateCommand_fromSwagger/examples/Accounts_AddRootCollectionAdmin.json b/commands/testdata/TestGenerateCommand_fromSwagger/examples/Accounts_AddRootCollectionAdmin.json new file mode 100644 index 00000000..828dab22 --- /dev/null +++ b/commands/testdata/TestGenerateCommand_fromSwagger/examples/Accounts_AddRootCollectionAdmin.json @@ -0,0 +1,22 @@ +{ + "parameters": { + "subscriptionId": "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + "resourceGroupName": "SampleResourceGroup", + "accountName": "account1", + "api-version": "2021-12-01", + "collectionAdminUpdate": { + "objectId": "7e8de0e7-2bfc-4e1f-9659-2a5785e4356f" + } + }, + "responses": { + "200": { + "headers": { + "Date": "Wed, 13 Sep 2017 18:04:32 GMT", + "x-ms-request-id": "d5496da4-9c52-402f-b067-83cc9ddea888", + "X-Content-Type-Options": "nosniff", + "x-ms-ratelimit-remaining-tenant-reads": "14999", + "x-ms-correlation-request-id": "25c78f97-0b0a-4fe9-ad39-883a482265cd" + } + } + } +} diff --git a/commands/testdata/TestGenerateCommand_fromSwagger/examples/Accounts_CheckNameAvailability.json b/commands/testdata/TestGenerateCommand_fromSwagger/examples/Accounts_CheckNameAvailability.json new file mode 100644 index 00000000..2b9427ea --- /dev/null +++ b/commands/testdata/TestGenerateCommand_fromSwagger/examples/Accounts_CheckNameAvailability.json @@ -0,0 +1,24 @@ +{ + "parameters": { + "checkNameAvailabilityRequest": { + "name": "account1", + "type": "Microsoft.Purview/accounts" + }, + "api-version": "2021-12-01", + "subscriptionId": "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345" + }, + "responses": { + "200": { + "headers": { + "Date": "Wed, 13 Sep 2017 18:04:32 GMT", + "x-ms-request-id": "d5496da4-9c52-402f-b067-83cc9ddea888", + "X-Content-Type-Options": "nosniff", + "x-ms-ratelimit-remaining-tenant-reads": "14999", + "x-ms-correlation-request-id": "25c78f97-0b0a-4fe9-ad39-883a482265cd" + }, + "body": { + "nameAvailable": true + } + } + } +} diff --git a/commands/testdata/TestGenerateCommand_fromSwagger/examples/Accounts_CreateOrUpdate.json b/commands/testdata/TestGenerateCommand_fromSwagger/examples/Accounts_CreateOrUpdate.json new file mode 100644 index 00000000..96483bdf --- /dev/null +++ b/commands/testdata/TestGenerateCommand_fromSwagger/examples/Accounts_CreateOrUpdate.json @@ -0,0 +1,98 @@ +{ + "parameters": { + "subscriptionId": "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + "resourceGroupName": "SampleResourceGroup", + "accountName": "account1", + "api-version": "2021-12-01", + "account": { + "location": "West US 2", + "properties": { + "managedResourceGroupName": "custom-rgname", + "managedResourcesPublicNetworkAccess": "Enabled" + } + } + }, + "responses": { + "201": { + "headers": { + "Date": "Wed, 13 Sep 2017 18:04:32 GMT", + "x-ms-request-id": "d5496da4-9c52-402f-b067-83cc9ddea888", + "X-Content-Type-Options": "nosniff", + "x-ms-ratelimit-remaining-tenant-reads": "14999", + "x-ms-correlation-request-id": "25c78f97-0b0a-4fe9-ad39-883a482265cd" + }, + "body": { + "location": "West US 2", + "id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account1", + "name": "account1", + "type": "Microsoft.Purview/accounts", + "sku": { + "name": "Standard", + "capacity": 1 + }, + "properties": { + "friendlyName": "friendly-account1", + "provisioningState": "Creating", + "accountStatus": { + "accountProvisioningState": "Succeeded", + "errorDetails": {} + }, + "endpoints": { + "catalog": "https://account1.catalog.purview.azure-test.com", + "scan": "https://account1.scan.purview.azure-test.com", + "guardian": "https://account1.guardian.purview.azure-test.com" + }, + "publicNetworkAccess": "Enabled" + } + } + }, + "200": { + "headers": { + "Date": "Wed, 13 Sep 2017 18:04:32 GMT", + "x-ms-request-id": "d5496da4-9c52-402f-b067-83cc9ddea888", + "X-Content-Type-Options": "nosniff", + "x-ms-ratelimit-remaining-tenant-reads": "14999", + "x-ms-correlation-request-id": "25c78f97-0b0a-4fe9-ad39-883a482265cd" + }, + "body": { + "location": "West US 2", + "id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account1", + "name": "account1", + "type": "Microsoft.Purview/accounts", + "sku": { + "name": "Standard", + "capacity": 1 + }, + "systemData": { + "createdBy": "client-name", + "createdByType": "User", + "createdAt": "2019-11-22T18:39:58.6929344Z", + "lastModifiedBy": "client-name", + "lastModifiedByType": "User", + "lastModifiedAt": "2021-03-16T23:24:34.3430059Z" + }, + "properties": { + "friendlyName": "friendly-account1", + "provisioningState": "Succeeded", + "accountStatus": { + "accountProvisioningState": "Succeeded", + "errorDetails": {} + }, + "endpoints": { + "catalog": "https://account1.catalog.purview.azure-test.com", + "scan": "https://account1.scan.purview.azure-test.com", + "guardian": "https://account1.guardian.purview.azure-test.com" + }, + "publicNetworkAccess": "Enabled", + "managedResourceGroupName": "custom-rgname", + "managedResourcesPublicNetworkAccess": "Enabled", + "managedResources": { + "resourceGroup": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/custom-rgname", + "storageAccount": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/custom-rgname/providers/Microsoft.Storage/storageAccounts/scanwestustzaagzr", + "eventHubNamespace": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/custom-rgname/providers/Microsoft.EventHub/namespaces/atlas-westusdddnbtp" + } + } + } + } + } +} diff --git a/commands/testdata/TestGenerateCommand_fromSwagger/examples/Accounts_Delete.json b/commands/testdata/TestGenerateCommand_fromSwagger/examples/Accounts_Delete.json new file mode 100644 index 00000000..25aa5a7c --- /dev/null +++ b/commands/testdata/TestGenerateCommand_fromSwagger/examples/Accounts_Delete.json @@ -0,0 +1,39 @@ +{ + "parameters": { + "subscriptionId": "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + "resourceGroupName": "SampleResourceGroup", + "accountName": "account1", + "api-version": "2021-12-01" + }, + "responses": { + "200": { + "headers": { + "Date": "Wed, 13 Sep 2017 18:04:32 GMT", + "x-ms-request-id": "d5496da4-9c52-402f-b067-83cc9ddea888", + "X-Content-Type-Options": "nosniff", + "x-ms-ratelimit-remaining-tenant-reads": "14999", + "x-ms-correlation-request-id": "25c78f97-0b0a-4fe9-ad39-883a482265cd" + } + }, + "202": { + "headers": { + "Date": "Wed, 13 Sep 2017 18:04:32 GMT", + "x-ms-request-id": "d5496da4-9c52-402f-b067-83cc9ddea888", + "X-Content-Type-Options": "nosniff", + "x-ms-ratelimit-remaining-tenant-reads": "14999", + "x-ms-correlation-request-id": "25c78f97-0b0a-4fe9-ad39-883a482265cd", + "x-ms-long-running-operation": true, + "Azure-AsyncOperation": "https://management.azure.com/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account1/operationResults/dad6baec-3a39-41df-a469-843a9ee94213?api-version=2021-07-01" + } + }, + "204": { + "headers": { + "Date": "Wed, 13 Sep 2017 18:04:32 GMT", + "x-ms-request-id": "d5496da4-9c52-402f-b067-83cc9ddea888", + "X-Content-Type-Options": "nosniff", + "x-ms-ratelimit-remaining-tenant-reads": "14999", + "x-ms-correlation-request-id": "25c78f97-0b0a-4fe9-ad39-883a482265cd" + } + } + } +} diff --git a/commands/testdata/TestGenerateCommand_fromSwagger/examples/Accounts_Get.json b/commands/testdata/TestGenerateCommand_fromSwagger/examples/Accounts_Get.json new file mode 100644 index 00000000..1980cad3 --- /dev/null +++ b/commands/testdata/TestGenerateCommand_fromSwagger/examples/Accounts_Get.json @@ -0,0 +1,76 @@ +{ + "parameters": { + "subscriptionId": "12345678-1234-1234-12345678abc", + "resourceGroupName": "SampleResourceGroup", + "accountName": "account1", + "api-version": "2021-12-01" + }, + "responses": { + "200": { + "headers": { + "Date": "Wed, 13 Sep 2017 18:04:32 GMT", + "x-ms-request-id": "d5496da4-9c52-402f-b067-83cc9ddea888", + "X-Content-Type-Options": "nosniff", + "x-ms-ratelimit-remaining-tenant-reads": "14999", + "x-ms-correlation-request-id": "25c78f97-0b0a-4fe9-ad39-883a482265cd" + }, + "body": { + "location": "West US 2", + "id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account1", + "name": "account1", + "type": "Microsoft.Purview/accounts", + "sku": { + "name": "Standard", + "capacity": 1 + }, + "systemData": { + "createdBy": "client-name", + "createdByType": "User", + "createdAt": "2019-11-22T18:39:58.6929344Z", + "lastModifiedBy": "client-name", + "lastModifiedByType": "User", + "lastModifiedAt": "2021-03-16T23:24:34.3430059Z" + }, + "properties": { + "friendlyName": "friendly-account1", + "provisioningState": "Succeeded", + "accountStatus": { + "accountProvisioningState": "Succeeded", + "errorDetails": {} + }, + "endpoints": { + "catalog": "https://account1.catalog.purview.azure-test.com", + "scan": "https://account1.scan.purview.azure-test.com", + "guardian": "https://account1.guardian.purview.azure-test.com" + }, + "privateEndpointConnections": [ + { + "properties": { + "provisioningState": "Succeeded", + "privateEndpoint": { + "id": "/subscriptions/baca8a88-4527-4c35-a13e-b2775ce0d7fc/resourceGroups/nrpResourceGroupName/providers/Microsoft.Network/privateEndpoints/peName" + }, + "privateLinkServiceConnectionState": { + "status": "Pending", + "description": "Please approve my connection, thanks.", + "actionsRequired": "None" + } + }, + "id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account1/privateEndpointConnections/peName-8536c337-7b36-4d67-a7ce-081655baf59e", + "name": "peName-8536c337-7b36-4d67-a7ce-081655baf59e", + "type": "Microsoft.Purview/accounts/privateEndpointConnections" + } + ], + "publicNetworkAccess": "Enabled", + "managedResourceGroupName": "managed-rg-mwjotkl", + "managedResourcesPublicNetworkAccess": "Enabled", + "managedResources": { + "resourceGroup": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/managed-rg-mwjotkl", + "storageAccount": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/managed-rg-mwjotkl/providers/Microsoft.Storage/storageAccounts/scanwestustzaagzr", + "eventHubNamespace": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/managed-rg-mwjotkl/providers/Microsoft.EventHub/namespaces/atlas-westusdddnbtp" + } + } + } + } + } +} diff --git a/commands/testdata/TestGenerateCommand_fromSwagger/examples/Accounts_ListByResourceGroup.json b/commands/testdata/TestGenerateCommand_fromSwagger/examples/Accounts_ListByResourceGroup.json new file mode 100644 index 00000000..b2d26850 --- /dev/null +++ b/commands/testdata/TestGenerateCommand_fromSwagger/examples/Accounts_ListByResourceGroup.json @@ -0,0 +1,82 @@ +{ + "parameters": { + "api-version": "2021-12-01", + "subscriptionId": "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + "resourceGroupName": "SampleResourceGroup" + }, + "responses": { + "200": { + "headers": { + "Date": "Wed, 13 Sep 2017 17:33:55 GMT", + "x-ms-request-id": "8e58266a-de42-40d5-b3c4-c6a7e159cfba", + "X-Content-Type-Options": "nosniff", + "x-ms-ratelimit-remaining-subscription-reads": "14993", + "x-ms-correlation-request-id": "5d862c55-4de9-4a46-969d-cf1ed3e235ed" + }, + "body": { + "value": [ + { + "location": "West US 2", + "id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account1", + "name": "account1", + "type": "Microsoft.Purview/accounts", + "sku": { + "name": "Standard", + "capacity": 1 + }, + "systemData": { + "createdBy": "client-name", + "createdByType": "User", + "createdAt": "2019-11-22T18:39:58.6929344Z", + "lastModifiedBy": "client-name", + "lastModifiedByType": "User", + "lastModifiedAt": "2021-03-16T23:24:34.3430059Z" + }, + "properties": { + "friendlyName": "friendly-account1", + "provisioningState": "Succeeded", + "accountStatus": { + "accountProvisioningState": "Succeeded", + "errorDetails": {} + }, + "endpoints": { + "catalog": "https://account1.catalog.purview.azure-test.com", + "scan": "https://account1.scan.purview.azure-test.com", + "guardian": "https://account1.guardian.purview.azure-test.com" + }, + "publicNetworkAccess": "Enabled" + } + }, + { + "location": "West US 2", + "id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account2", + "name": "account2", + "type": "Microsoft.Purview/accounts", + "sku": { + "name": "Standard", + "capacity": 1 + }, + "systemData": { + "createdBy": "client-name", + "createdByType": "User", + "createdAt": "2019-11-22T18:39:58.6929344Z", + "lastModifiedBy": "client-name", + "lastModifiedByType": "User", + "lastModifiedAt": "2021-03-16T23:24:34.3430059Z" + }, + "properties": { + "friendlyName": "friendly-account1", + "provisioningState": "Succeeded", + "endpoints": { + "catalog": "https://account2.catalog.purview.azure-test.com", + "scan": "https://account2.scan.purview.azure-test.com", + "guardian": "https://account1.guardian.purview.azure-test.com" + }, + "publicNetworkAccess": "Enabled" + } + } + ] + } + } + } +} diff --git a/commands/testdata/TestGenerateCommand_fromSwagger/examples/Accounts_ListBySubscription.json b/commands/testdata/TestGenerateCommand_fromSwagger/examples/Accounts_ListBySubscription.json new file mode 100644 index 00000000..2d846387 --- /dev/null +++ b/commands/testdata/TestGenerateCommand_fromSwagger/examples/Accounts_ListBySubscription.json @@ -0,0 +1,81 @@ +{ + "parameters": { + "api-version": "2021-12-01", + "subscriptionId": "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345" + }, + "responses": { + "200": { + "headers": { + "Date": "Wed, 13 Sep 2017 17:33:55 GMT", + "x-ms-request-id": "8e58266a-de42-40d5-b3c4-c6a7e159cfba", + "X-Content-Type-Options": "nosniff", + "x-ms-ratelimit-remaining-subscription-reads": "14993", + "x-ms-correlation-request-id": "5d862c55-4de9-4a46-969d-cf1ed3e235ed" + }, + "body": { + "value": [ + { + "location": "West US 2", + "id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account1", + "name": "account1", + "type": "Microsoft.Purview/accounts", + "sku": { + "name": "Standard", + "capacity": 1 + }, + "systemData": { + "createdBy": "client-name", + "createdByType": "User", + "createdAt": "2019-11-22T18:39:58.6929344Z", + "lastModifiedBy": "client-name", + "lastModifiedByType": "User", + "lastModifiedAt": "2021-03-16T23:24:34.3430059Z" + }, + "properties": { + "friendlyName": "friendly-account1", + "provisioningState": "Succeeded", + "accountStatus": { + "accountProvisioningState": "Succeeded", + "errorDetails": {} + }, + "endpoints": { + "catalog": "https://account1.catalog.purview.azure-test.com", + "scan": "https://account1.scan.purview.azure-test.com", + "guardian": "https://account1.guardian.purview.azure-test.com" + }, + "publicNetworkAccess": "Enabled" + } + }, + { + "location": "West US 2", + "id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account2", + "name": "account2", + "type": "Microsoft.Purview/accounts", + "sku": { + "name": "Standard", + "capacity": 1 + }, + "systemData": { + "createdBy": "client-name", + "createdByType": "User", + "createdAt": "2019-11-22T18:39:58.6929344Z", + "lastModifiedBy": "client-name", + "lastModifiedByType": "User", + "lastModifiedAt": "2021-03-16T23:24:34.3430059Z" + }, + "properties": { + "friendlyName": "friendly-account1", + "provisioningState": "Succeeded", + "endpoints": { + "catalog": "https://account2.catalog.purview.azure-test.com", + "scan": "https://account2.scan.purview.azure-test.com", + "guardian": "https://account1.guardian.purview.azure-test.com" + }, + "publicNetworkAccess": "Enabled" + } + } + ] + } + } + } +} diff --git a/commands/testdata/TestGenerateCommand_fromSwagger/examples/Accounts_ListKeys.json b/commands/testdata/TestGenerateCommand_fromSwagger/examples/Accounts_ListKeys.json new file mode 100644 index 00000000..8a1b4c27 --- /dev/null +++ b/commands/testdata/TestGenerateCommand_fromSwagger/examples/Accounts_ListKeys.json @@ -0,0 +1,23 @@ +{ + "parameters": { + "subscriptionId": "12345678-1234-1234-12345678abc", + "resourceGroupName": "SampleResourceGroup", + "accountName": "account1", + "api-version": "2021-12-01" + }, + "responses": { + "200": { + "headers": { + "Date": "Wed, 13 Sep 2017 18:04:32 GMT", + "x-ms-request-id": "d5496da4-9c52-402f-b067-83cc9ddea888", + "X-Content-Type-Options": "nosniff", + "x-ms-ratelimit-remaining-tenant-reads": "14999", + "x-ms-correlation-request-id": "25c78f97-0b0a-4fe9-ad39-883a482265cd" + }, + "body": { + "atlasKafkaPrimaryEndpoint": "Endpoint=sb://fake_objectId.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=ASDASasdfmasdf123412341234=", + "atlasKafkaSecondaryEndpoint": "Endpoint=sb://fake_objectId.servicebus.windows.net/;SharedAccessKeyName=AlternateSharedAccessKey;SharedAccessKey=BSDASasdfmasdf123412341234=" + } + } + } +} diff --git a/commands/testdata/TestGenerateCommand_fromSwagger/examples/Accounts_Update.json b/commands/testdata/TestGenerateCommand_fromSwagger/examples/Accounts_Update.json new file mode 100644 index 00000000..501b872e --- /dev/null +++ b/commands/testdata/TestGenerateCommand_fromSwagger/examples/Accounts_Update.json @@ -0,0 +1,117 @@ +{ + "parameters": { + "subscriptionId": "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + "resourceGroupName": "SampleResourceGroup", + "accountName": "account1", + "api-version": "2021-12-01", + "accountUpdateParameters": { + "tags": { + "newTag": "New tag value." + }, + "properties": { + "cloudConnectors": {}, + "managedResourceGroupName": "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "publicNetworkAccess": "NotSpecified", + "managedResourcesPublicNetworkAccess": "Disabled" + } + } + }, + "responses": { + "200": { + "headers": { + "Date": "Wed, 13 Sep 2017 18:04:32 GMT", + "x-ms-request-id": "d5496da4-9c52-402f-b067-83cc9ddea888", + "X-Content-Type-Options": "nosniff", + "x-ms-ratelimit-remaining-tenant-reads": "14999", + "x-ms-correlation-request-id": "25c78f97-0b0a-4fe9-ad39-883a482265cd" + }, + "body": { + "location": "West US 2", + "id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account1", + "name": "account1", + "type": "Microsoft.Purview/accounts", + "sku": { + "name": "Standard", + "capacity": 1 + }, + "systemData": { + "createdBy": "client-name", + "createdByType": "User", + "createdAt": "2019-11-22T18:39:58.6929344Z", + "lastModifiedBy": "client-name", + "lastModifiedByType": "User", + "lastModifiedAt": "2021-03-16T23:24:34.3430059Z" + }, + "properties": { + "friendlyName": "friendly-account1", + "provisioningState": "Succeeded", + "accountStatus": { + "accountProvisioningState": "Succeeded", + "errorDetails": {} + }, + "endpoints": { + "catalog": "https://account2.catalog.purview.azure-test.com", + "scan": "https://account2.scan.purview.azure-test.com", + "guardian": "https://account1.guardian.purview.azure-test.com" + }, + "publicNetworkAccess": "Enabled", + "managedResources": { + "resourceGroup": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/managed-rg-mwjotkl", + "storageAccount": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/managed-rg-mwjotkl/providers/Microsoft.Storage/storageAccounts/scanwestustzaagzr", + "eventHubNamespace": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/managed-rg-mwjotkl/providers/Microsoft.EventHub/namespaces/atlas-westusdddnbtp" + } + }, + "tags": { + "newTag": "New tag value." + } + } + }, + "202": { + "headers": { + "Date": "Wed, 13 Sep 2017 18:04:32 GMT", + "x-ms-request-id": "d5496da4-9c52-402f-b067-83cc9ddea888", + "X-Content-Type-Options": "nosniff", + "x-ms-ratelimit-remaining-tenant-reads": "14999", + "x-ms-correlation-request-id": "25c78f97-0b0a-4fe9-ad39-883a482265cd", + "x-ms-long-running-operation": true, + "Azure-AsyncOperation": "https://management.azure.com/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account1/operationResults/dad6baec-3a39-41df-a469-843a9ee94213?api-version=2021-07-01" + }, + "body": { + "location": "West US 2", + "id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account1", + "name": "account1", + "type": "Microsoft.Purview/accounts", + "sku": { + "name": "Standard", + "capacity": 1 + }, + "systemData": { + "createdBy": "client-name", + "createdByType": "User", + "createdAt": "2019-11-22T18:39:58.6929344Z", + "lastModifiedBy": "client-name", + "lastModifiedByType": "User", + "lastModifiedAt": "2021-03-16T23:24:34.3430059Z" + }, + "properties": { + "friendlyName": "friendly-account1", + "provisioningState": "Succeeded", + "endpoints": { + "catalog": "https://account2.catalog.purview.azure-test.com", + "scan": "https://account2.scan.purview.azure-test.com", + "guardian": "https://account1.guardian.purview.azure-test.com" + }, + "publicNetworkAccess": "Enabled", + "managedResources": { + "resourceGroup": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/managed-rg-mwjotkl", + "storageAccount": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/managed-rg-mwjotkl/providers/Microsoft.Storage/storageAccounts/scanwestustzaagzr", + "eventHubNamespace": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/managed-rg-mwjotkl/providers/Microsoft.EventHub/namespaces/atlas-westusdddnbtp" + } + }, + "tags": { + "newTag": "New tag value." + } + } + } + } +} diff --git a/commands/testdata/TestGenerateCommand_fromSwagger/examples/DefaultAccounts_Get.json b/commands/testdata/TestGenerateCommand_fromSwagger/examples/DefaultAccounts_Get.json new file mode 100644 index 00000000..cfb4a7cd --- /dev/null +++ b/commands/testdata/TestGenerateCommand_fromSwagger/examples/DefaultAccounts_Get.json @@ -0,0 +1,27 @@ +{ + "parameters": { + "scopeTenantId": "ee85a74c-405e-4adc-bb47-ffa8ca0c9f31", + "scopeType": "Tenant", + "scope": "12345678-1234-1234-1234-12345678abcd", + "api-version": "2021-12-01" + }, + "responses": { + "200": { + "headers": { + "Date": "Wed, 13 Sep 2017 18:04:32 GMT", + "x-ms-request-id": "d5496da4-9c52-402f-b067-83cc9ddea888", + "X-Content-Type-Options": "nosniff", + "x-ms-ratelimit-remaining-tenant-reads": "14999", + "x-ms-correlation-request-id": "25c78f97-0b0a-4fe9-ad39-883a482265cd" + }, + "body": { + "scopeTenantId": "12345678-1234-1234-1234-12345678abcd", + "scopeType": "Tenant", + "scope": "12345678-1234-1234-1234-12345678abcd", + "accountName": "myDefaultAccount", + "resourceGroupName": "rg-1", + "subscriptionId": "12345678-1234-1234-1234-12345678aaaa" + } + } + } +} diff --git a/commands/testdata/TestGenerateCommand_fromSwagger/examples/DefaultAccounts_Remove.json b/commands/testdata/TestGenerateCommand_fromSwagger/examples/DefaultAccounts_Remove.json new file mode 100644 index 00000000..14824d33 --- /dev/null +++ b/commands/testdata/TestGenerateCommand_fromSwagger/examples/DefaultAccounts_Remove.json @@ -0,0 +1,28 @@ +{ + "parameters": { + "scopeTenantId": "ee85a74c-405e-4adc-bb47-ffa8ca0c9f31", + "scopeType": "Tenant", + "scope": "12345678-1234-1234-1234-12345678abcd", + "api-version": "2021-12-01" + }, + "responses": { + "200": { + "headers": { + "Date": "Wed, 13 Sep 2017 18:04:32 GMT", + "x-ms-request-id": "d5496da4-9c52-402f-b067-83cc9ddea888", + "X-Content-Type-Options": "nosniff", + "x-ms-ratelimit-remaining-tenant-reads": "14999", + "x-ms-correlation-request-id": "25c78f97-0b0a-4fe9-ad39-883a482265cd" + } + }, + "204": { + "headers": { + "Date": "Wed, 13 Sep 2017 18:04:32 GMT", + "x-ms-request-id": "d5496da4-9c52-402f-b067-83cc9ddea888", + "X-Content-Type-Options": "nosniff", + "x-ms-ratelimit-remaining-tenant-reads": "14999", + "x-ms-correlation-request-id": "25c78f97-0b0a-4fe9-ad39-883a482265cd" + } + } + } +} diff --git a/commands/testdata/TestGenerateCommand_fromSwagger/examples/DefaultAccounts_Set.json b/commands/testdata/TestGenerateCommand_fromSwagger/examples/DefaultAccounts_Set.json new file mode 100644 index 00000000..b1f9edb7 --- /dev/null +++ b/commands/testdata/TestGenerateCommand_fromSwagger/examples/DefaultAccounts_Set.json @@ -0,0 +1,32 @@ +{ + "parameters": { + "api-version": "2021-12-01", + "defaultAccountPayload": { + "scopeTenantId": "12345678-1234-1234-1234-12345678abcd", + "scopeType": "Tenant", + "scope": "12345678-1234-1234-1234-12345678abcd", + "accountName": "myDefaultAccount", + "resourceGroupName": "rg-1", + "subscriptionId": "12345678-1234-1234-1234-12345678aaaa" + } + }, + "responses": { + "200": { + "headers": { + "Date": "Wed, 13 Sep 2017 18:04:32 GMT", + "x-ms-request-id": "d5496da4-9c52-402f-b067-83cc9ddea888", + "X-Content-Type-Options": "nosniff", + "x-ms-ratelimit-remaining-tenant-reads": "14999", + "x-ms-correlation-request-id": "25c78f97-0b0a-4fe9-ad39-883a482265cd" + }, + "body": { + "scopeTenantId": "12345678-1234-1234-1234-12345678abcd", + "scopeType": "Tenant", + "scope": "12345678-1234-1234-1234-12345678abcd", + "accountName": "myDefaultAccount", + "resourceGroupName": "rg-1", + "subscriptionId": "12345678-1234-1234-1234-12345678aaaa" + } + } + } +} diff --git a/commands/testdata/TestGenerateCommand_fromSwagger/examples/Features_AccountGet.json b/commands/testdata/TestGenerateCommand_fromSwagger/examples/Features_AccountGet.json new file mode 100644 index 00000000..67190495 --- /dev/null +++ b/commands/testdata/TestGenerateCommand_fromSwagger/examples/Features_AccountGet.json @@ -0,0 +1,31 @@ +{ + "parameters": { + "subscriptionId": "12345678-1234-1234-12345678abc", + "resourceGroupName": "SampleResourceGroup", + "accountName": "account1", + "featureRequest": { + "features": [ + "Feature1", + "Feature2", + "FeatureThatDoesntExist" + ] + }, + "api-version": "2021-12-01" + }, + "responses": { + "200": { + "headers": { + "Date": "Wed, 13 Sep 2017 18:04:32 GMT", + "x-ms-request-id": "d5496da4-9c52-402f-b067-83cc9ddea888", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "25c78f97-0b0a-4fe9-ad39-883a482265cd" + }, + "body": { + "features": { + "Feature1": true, + "Feature2": false + } + } + } + } +} diff --git a/commands/testdata/TestGenerateCommand_fromSwagger/examples/Features_SubscriptionGet.json b/commands/testdata/TestGenerateCommand_fromSwagger/examples/Features_SubscriptionGet.json new file mode 100644 index 00000000..5d842c6a --- /dev/null +++ b/commands/testdata/TestGenerateCommand_fromSwagger/examples/Features_SubscriptionGet.json @@ -0,0 +1,30 @@ +{ + "parameters": { + "subscriptionId": "12345678-1234-1234-12345678abc", + "locations": "eastus", + "featureRequest": { + "features": [ + "Feature1", + "Feature2", + "FeatureThatDoesntExist" + ] + }, + "api-version": "2021-12-01" + }, + "responses": { + "200": { + "headers": { + "Date": "Wed, 13 Sep 2017 18:04:32 GMT", + "x-ms-request-id": "d5496da4-9c52-402f-b067-83cc9ddea888", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "25c78f97-0b0a-4fe9-ad39-883a482265cd" + }, + "body": { + "features": { + "Feature1": true, + "Feature2": false + } + } + } + } +} diff --git a/commands/testdata/TestGenerateCommand_fromSwagger/examples/KafkaConfigurations_CreateOrUpdate.json b/commands/testdata/TestGenerateCommand_fromSwagger/examples/KafkaConfigurations_CreateOrUpdate.json new file mode 100644 index 00000000..9ca635f3 --- /dev/null +++ b/commands/testdata/TestGenerateCommand_fromSwagger/examples/KafkaConfigurations_CreateOrUpdate.json @@ -0,0 +1,75 @@ +{ + "parameters": { + "subscriptionId": "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + "resourceGroupName": "rgpurview", + "accountName": "account1", + "kafkaConfigurationName": "kafkaConfigName", + "kafkaConfiguration": { + "properties": { + "eventStreamingState": "Enabled", + "eventStreamingType": "Azure", + "consumerGroup": "consumerGroup", + "eventHubType": "Notification", + "eventHubPartitionId": "partitionId", + "eventHubResourceId": "/subscriptions/225be6fe-ec1c-4d51-a368-f69348d2e6c5/resourceGroups/testRG/providers/Microsoft.EventHub/namespaces/eventHubNameSpaceName" + } + }, + "api-version": "2021-12-01" + }, + "responses": { + "200": { + "body": { + "name": "kafkaConfigName", + "properties": { + "eventStreamingState": "Enabled", + "eventStreamingType": "Azure", + "consumerGroup": "consumerGroup", + "credentials": { + "identityId": "/subscriptions/47e8596d-ee73-4eb2-b6b4-cc13c2b87ssd/resourceGroups/testRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testId", + "type": "UserAssigned" + }, + "eventHubType": "Notification", + "eventHubPartitionId": "partitionId", + "eventHubResourceId": "/subscriptions/225be6fe-ec1c-4d51-a368-f69348d2e6c5/resourceGroups/testRG/providers/Microsoft.EventHub/namespaces/eventHubNameSpaceName" + }, + "id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account1/kafkaConfigurations/default", + "systemData": { + "createdAt": "2022-03-09T01:36:27.637Z", + "createdBy": "User@user", + "createdByType": "User", + "lastModifiedAt": "2022-03-09T01:36:27.637Z", + "lastModifiedBy": "User", + "lastModifiedByType": "User" + }, + "type": "Microsoft.Purview/accounts/kafkaconfiguration" + } + }, + "201": { + "body": { + "name": "kafkaConfigName", + "properties": { + "eventStreamingState": "Enabled", + "eventStreamingType": "Azure", + "consumerGroup": "consumerGroup", + "credentials": { + "identityId": "/subscriptions/47e8596d-ee73-4eb2-b6b4-cc13c2b87ssd/resourceGroups/testRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testId", + "type": "UserAssigned" + }, + "eventHubType": "Notification", + "eventHubPartitionId": "partitionId", + "eventHubResourceId": "/subscriptions/225be6fe-ec1c-4d51-a368-f69348d2e6c5/resourceGroups/testRG/providers/Microsoft.EventHub/namespaces/eventHubNameSpaceName" + }, + "id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account1/kafkaConfigurations/default", + "systemData": { + "createdAt": "2022-03-09T01:36:27.637Z", + "createdBy": "User@user", + "createdByType": "User", + "lastModifiedAt": "2022-03-09T01:36:27.637Z", + "lastModifiedBy": "User", + "lastModifiedByType": "User" + }, + "type": "Microsoft.Purview/accounts/kafkaconfiguration" + } + } + } +} diff --git a/commands/testdata/TestGenerateCommand_fromSwagger/examples/KafkaConfigurations_Delete.json b/commands/testdata/TestGenerateCommand_fromSwagger/examples/KafkaConfigurations_Delete.json new file mode 100644 index 00000000..ff848717 --- /dev/null +++ b/commands/testdata/TestGenerateCommand_fromSwagger/examples/KafkaConfigurations_Delete.json @@ -0,0 +1,13 @@ +{ + "parameters": { + "subscriptionId": "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + "resourceGroupName": "rgpurview", + "accountName": "account1", + "kafkaConfigurationName": "kafkaConfigName", + "api-version": "2021-12-01" + }, + "responses": { + "200": {}, + "204": {} + } +} diff --git a/commands/testdata/TestGenerateCommand_fromSwagger/examples/KafkaConfigurations_Get.json b/commands/testdata/TestGenerateCommand_fromSwagger/examples/KafkaConfigurations_Get.json new file mode 100644 index 00000000..1714b714 --- /dev/null +++ b/commands/testdata/TestGenerateCommand_fromSwagger/examples/KafkaConfigurations_Get.json @@ -0,0 +1,38 @@ +{ + "parameters": { + "subscriptionId": "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + "resourceGroupName": "rgpurview", + "accountName": "account1", + "kafkaConfigurationName": "kafkaConfigName", + "api-version": "2021-12-01" + }, + "responses": { + "200": { + "body": { + "properties": { + "eventStreamingState": "Enabled", + "eventStreamingType": "Azure", + "consumerGroup": "consumerGroup", + "credentials": { + "identityId": "/subscriptions/47e8596d-ee73-4eb2-b6b4-cc13c2b87ssd/resourceGroups/testRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testId", + "type": "UserAssigned" + }, + "eventHubType": "Notification", + "eventHubPartitionId": "partitionId", + "eventHubResourceId": "/subscriptions/225be6fe-ec1c-4d51-a368-f69348d2e6c5/resourceGroups/testRG/providers/Microsoft.EventHub/namespaces/eventHubNameSpaceName" + }, + "id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account1/kafkaConfigurations/default", + "name": "kafkaConfigName", + "systemData": { + "createdAt": "2022-03-09T01:36:27.637Z", + "createdBy": "User@user", + "createdByType": "User", + "lastModifiedAt": "2022-03-09T01:36:27.637Z", + "lastModifiedBy": "User", + "lastModifiedByType": "User" + }, + "type": "Microsoft.Purview/accounts/kafkaconfiguration" + } + } + } +} diff --git a/commands/testdata/TestGenerateCommand_fromSwagger/examples/KafkaConfigurations_ListByAccount.json b/commands/testdata/TestGenerateCommand_fromSwagger/examples/KafkaConfigurations_ListByAccount.json new file mode 100644 index 00000000..7ee60b61 --- /dev/null +++ b/commands/testdata/TestGenerateCommand_fromSwagger/examples/KafkaConfigurations_ListByAccount.json @@ -0,0 +1,43 @@ +{ + "parameters": { + "subscriptionId": "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + "resourceGroupName": "rgpurview", + "accountName": "account1", + "api-version": "2021-12-01", + "$skipToken": "token" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account1/kafkaConfigurations/default", + "name": "kafkaconfigName", + "type": "Microsoft.Purview/accounts/kafkaconfiguration", + "properties": { + "eventStreamingState": "Disabled", + "eventStreamingType": "None", + "consumerGroup": "consumerGroup", + "credentials": { + "identityId": "/subscriptions/47e8596d-ee73-4eb2-b6b4-cc13c2b87ssd/resourceGroups/testRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testId", + "type": "UserAssigned" + }, + "eventHubType": "Notification", + "eventHubPartitionId": "partitionId", + "eventHubResourceId": "/subscriptions/225be6fe-ec1c-4d51-a368-f69348d2e6c5/resourceGroups/testRG/providers/Microsoft.EventHub/namespaces/eventHubNameSpaceName" + }, + "systemData": { + "createdAt": "2022-03-17T04:23:24.157Z", + "createdBy": "user", + "createdByType": "User", + "lastModifiedAt": "2022-03-17T04:23:24.157Z", + "lastModifiedBy": "user", + "lastModifiedByType": "User" + } + } + ], + "nextLink": "nextLink" + } + } + } +} diff --git a/commands/testdata/TestGenerateCommand_fromSwagger/examples/Operations_List.json b/commands/testdata/TestGenerateCommand_fromSwagger/examples/Operations_List.json new file mode 100644 index 00000000..1cfb10a6 --- /dev/null +++ b/commands/testdata/TestGenerateCommand_fromSwagger/examples/Operations_List.json @@ -0,0 +1,75 @@ +{ + "parameters": { + "subscriptionId": "12345678-1234-1234-12345678abc", + "api-version": "2021-12-01" + }, + "responses": { + "200": { + "headers": { + "Date": "Wed, 13 Sep 2017 18:04:32 GMT", + "x-ms-request-id": "d5496da4-9c52-402f-b067-83cc9ddea888", + "X-Content-Type-Options": "nosniff", + "x-ms-ratelimit-remaining-tenant-reads": "14999", + "x-ms-correlation-request-id": "25c78f97-0b0a-4fe9-ad39-883a482265cd" + }, + "body": { + "value": [ + { + "name": "Microsoft.Purview/operations/read", + "display": { + "provider": "Microsoft Purview", + "resource": "Operations", + "operation": "Read all operations", + "description": "Reads all available operations in Purview Resource Provider." + } + }, + { + "name": "Microsoft.Purview/register/action", + "display": { + "provider": "Microsoft Purview", + "resource": "Purview Resource Provider", + "operation": "Register Purview Resource Provider", + "description": "Register the subscription for Purview Resource Provider" + } + }, + { + "name": "Microsoft.Purview/unregister/action", + "display": { + "provider": "Microsoft Purview", + "resource": "Purview Resource Provider", + "operation": "Unregister Purview Resource Provider", + "description": "Unregister the subscription for Purview Resource Provider" + } + }, + { + "name": "Microsoft.Purview/accounts/read", + "display": { + "provider": "Microsoft Purview", + "resource": "Account", + "operation": "Read account resource", + "description": "Read account resource for Purview Resource Provider." + } + }, + { + "name": "Microsoft.Purview/accounts/write", + "display": { + "provider": "Microsoft Purview", + "resource": "Account", + "operation": "Write account resource", + "description": "Write account resource for Purview Resource Provider." + } + }, + { + "name": "Microsoft.Purview/accounts/delete", + "display": { + "provider": "Microsoft Purview", + "resource": "Account", + "operation": "Delete account resource", + "description": "Delete account resource for Purview Resource Provider." + } + } + ] + } + } + } +} diff --git a/commands/testdata/TestGenerateCommand_fromSwagger/examples/PrivateEndpointConnections_CreateOrUpdate.json b/commands/testdata/TestGenerateCommand_fromSwagger/examples/PrivateEndpointConnections_CreateOrUpdate.json new file mode 100644 index 00000000..47b44f56 --- /dev/null +++ b/commands/testdata/TestGenerateCommand_fromSwagger/examples/PrivateEndpointConnections_CreateOrUpdate.json @@ -0,0 +1,69 @@ +{ + "parameters": { + "subscriptionId": "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + "resourceGroupName": "SampleResourceGroup", + "accountName": "account1", + "privateEndpointConnectionName": "privateEndpointConnection1", + "api-version": "2021-12-01", + "request": { + "properties": { + "privateLinkServiceConnectionState": { + "status": "Approved", + "description": "Approved by johndoe@company.com" + } + } + } + }, + "responses": { + "201": { + "headers": { + "Date": "Wed, 13 Sep 2017 18:04:32 GMT", + "x-ms-request-id": "d5496da4-9c52-402f-b067-83cc9ddea888", + "X-Content-Type-Options": "nosniff", + "x-ms-ratelimit-remaining-tenant-reads": "14999", + "x-ms-correlation-request-id": "25c78f97-0b0a-4fe9-ad39-883a482265cd", + "x-ms-long-running-operation": true, + "Azure-AsyncOperation": "https://management.azure.com/subscriptions34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account1/privateEndpointConnections/privateEndpointConnection1?api-version=2021-12-01" + }, + "body": { + "name": "privateEndpointConnection1", + "id": "/subscriptions/12345678-1234-1234-12345678abc/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account1/privateEndpointConnections/privateEndpointConnection1", + "type": "Microsoft.Purview/accounts/privateEndpointConnections", + "properties": { + "provisioningState": "Succeeded", + "privateEndpoint": { + "id": "/subscriptions/12345678-1234-1234-12345678abc/resourceGroups/SampleResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint" + }, + "privateLinkServiceConnectionState": { + "status": "Approved", + "description": "Approved by johndoe@company.com" + } + } + } + }, + "200": { + "headers": { + "Date": "Wed, 13 Sep 2017 18:04:32 GMT", + "x-ms-request-id": "d5496da4-9c52-402f-b067-83cc9ddea888", + "X-Content-Type-Options": "nosniff", + "x-ms-ratelimit-remaining-tenant-reads": "14999", + "x-ms-correlation-request-id": "25c78f97-0b0a-4fe9-ad39-883a482265cd" + }, + "body": { + "name": "privateEndpointConnection1", + "id": "/subscriptions/12345678-1234-1234-12345678abc/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account1/privateEndpointConnections/privateEndpointConnection1", + "type": "Microsoft.Purview/accounts/privateEndpointConnections", + "properties": { + "provisioningState": "Succeeded", + "privateEndpoint": { + "id": "/subscriptions/12345678-1234-1234-12345678abc/resourceGroups/SampleResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint" + }, + "privateLinkServiceConnectionState": { + "status": "Approved", + "description": "Approved by johndoe@company.com" + } + } + } + } + } +} diff --git a/commands/testdata/TestGenerateCommand_fromSwagger/examples/PrivateEndpointConnections_Delete.json b/commands/testdata/TestGenerateCommand_fromSwagger/examples/PrivateEndpointConnections_Delete.json new file mode 100644 index 00000000..490c0d98 --- /dev/null +++ b/commands/testdata/TestGenerateCommand_fromSwagger/examples/PrivateEndpointConnections_Delete.json @@ -0,0 +1,40 @@ +{ + "parameters": { + "subscriptionId": "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + "resourceGroupName": "SampleResourceGroup", + "accountName": "account1", + "privateEndpointConnectionName": "privateEndpointConnection1", + "api-version": "2021-12-01" + }, + "responses": { + "200": { + "headers": { + "Date": "Wed, 13 Sep 2017 18:04:32 GMT", + "x-ms-request-id": "d5496da4-9c52-402f-b067-83cc9ddea888", + "X-Content-Type-Options": "nosniff", + "x-ms-ratelimit-remaining-tenant-reads": "14999", + "x-ms-correlation-request-id": "25c78f97-0b0a-4fe9-ad39-883a482265cd" + } + }, + "202": { + "headers": { + "Date": "Wed, 13 Sep 2017 18:04:32 GMT", + "x-ms-request-id": "d5496da4-9c52-402f-b067-83cc9ddea888", + "X-Content-Type-Options": "nosniff", + "x-ms-ratelimit-remaining-tenant-reads": "14999", + "x-ms-correlation-request-id": "25c78f97-0b0a-4fe9-ad39-883a482265cd", + "x-ms-long-running-operation": true, + "Azure-AsyncOperation": "https://management.azure.com/subscriptions34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account1/privateEndpointConnections/privateEndpointConnection1?api-version=2021-07-01" + } + }, + "204": { + "headers": { + "Date": "Wed, 13 Sep 2017 18:04:32 GMT", + "x-ms-request-id": "d5496da4-9c52-402f-b067-83cc9ddea888", + "X-Content-Type-Options": "nosniff", + "x-ms-ratelimit-remaining-tenant-reads": "14999", + "x-ms-correlation-request-id": "25c78f97-0b0a-4fe9-ad39-883a482265cd" + } + } + } +} diff --git a/commands/testdata/TestGenerateCommand_fromSwagger/examples/PrivateEndpointConnections_Get.json b/commands/testdata/TestGenerateCommand_fromSwagger/examples/PrivateEndpointConnections_Get.json new file mode 100644 index 00000000..a72d967c --- /dev/null +++ b/commands/testdata/TestGenerateCommand_fromSwagger/examples/PrivateEndpointConnections_Get.json @@ -0,0 +1,35 @@ +{ + "parameters": { + "subscriptionId": "12345678-1234-1234-12345678abc", + "resourceGroupName": "SampleResourceGroup", + "accountName": "account1", + "privateEndpointConnectionName": "privateEndpointConnection1", + "api-version": "2021-12-01" + }, + "responses": { + "200": { + "headers": { + "Date": "Wed, 13 Sep 2017 18:04:32 GMT", + "x-ms-request-id": "d5496da4-9c52-402f-b067-83cc9ddea888", + "X-Content-Type-Options": "nosniff", + "x-ms-ratelimit-remaining-tenant-reads": "14999", + "x-ms-correlation-request-id": "25c78f97-0b0a-4fe9-ad39-883a482265cd" + }, + "body": { + "name": "privateEndpointConnection1", + "id": "/subscriptions/12345678-1234-1234-12345678abc/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account1/privateEndpointConnections/privateEndpointConnection1", + "type": "Microsoft.Purview/accounts/privateEndpointConnections", + "properties": { + "provisioningState": "Succeeded", + "privateEndpoint": { + "id": "/subscriptions/12345678-1234-1234-12345678abc/resourceGroups/SampleResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint" + }, + "privateLinkServiceConnectionState": { + "status": "Approved", + "description": "Approved by johndoe@company.com" + } + } + } + } + } +} diff --git a/commands/testdata/TestGenerateCommand_fromSwagger/examples/PrivateEndpointConnections_ListByAccount.json b/commands/testdata/TestGenerateCommand_fromSwagger/examples/PrivateEndpointConnections_ListByAccount.json new file mode 100644 index 00000000..6284921f --- /dev/null +++ b/commands/testdata/TestGenerateCommand_fromSwagger/examples/PrivateEndpointConnections_ListByAccount.json @@ -0,0 +1,53 @@ +{ + "parameters": { + "subscriptionId": "12345678-1234-1234-12345678abc", + "resourceGroupName": "SampleResourceGroup", + "accountName": "account1", + "api-version": "2021-12-01" + }, + "responses": { + "200": { + "headers": { + "Date": "Wed, 13 Sep 2017 17:33:55 GMT", + "x-ms-request-id": "8e58266a-de42-40d5-b3c4-c6a7e159cfba", + "X-Content-Type-Options": "nosniff", + "x-ms-ratelimit-remaining-subscription-reads": "14993", + "x-ms-correlation-request-id": "5d862c55-4de9-4a46-969d-cf1ed3e235ed" + }, + "body": { + "value": [ + { + "name": "privateEndpointConnection1", + "id": "/subscriptions/12345678-1234-1234-12345678abc/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account1/privateEndpointConnections/privateEndpointConnection1", + "type": "Microsoft.Purview/accounts/privateEndpointConnections", + "properties": { + "provisioningState": "Succeeded", + "privateEndpoint": { + "id": "/subscriptions/12345678-1234-1234-12345678abc/resourceGroups/SampleResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint1" + }, + "privateLinkServiceConnectionState": { + "status": "Approved", + "description": "Approved by johndoe@company.com" + } + } + }, + { + "name": "privateEndpointConnection2", + "id": "/subscriptions/12345678-1234-1234-12345678abc/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account1/privateEndpointConnections/privateEndpointConnection2", + "type": "Microsoft.Purview/accounts/privateEndpointConnections", + "properties": { + "provisioningState": "Deleting", + "privateEndpoint": { + "id": "/subscriptions/12345678-1234-1234-12345678abc/resourceGroups/SampleResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint" + }, + "privateLinkServiceConnectionState": { + "status": "Rejected", + "description": "Rejected by johndoe@company.com" + } + } + } + ] + } + } + } +} diff --git a/commands/testdata/TestGenerateCommand_fromSwagger/examples/PrivateLinkResources_GetByGroupId.json b/commands/testdata/TestGenerateCommand_fromSwagger/examples/PrivateLinkResources_GetByGroupId.json new file mode 100644 index 00000000..7c94d89e --- /dev/null +++ b/commands/testdata/TestGenerateCommand_fromSwagger/examples/PrivateLinkResources_GetByGroupId.json @@ -0,0 +1,34 @@ +{ + "parameters": { + "subscriptionId": "12345678-1234-1234-12345678abc", + "resourceGroupName": "SampleResourceGroup", + "accountName": "account1", + "groupId": "group1", + "api-version": "2021-12-01" + }, + "responses": { + "200": { + "headers": { + "Date": "Wed, 13 Sep 2017 18:04:32 GMT", + "x-ms-request-id": "d5496da4-9c52-402f-b067-83cc9ddea888", + "X-Content-Type-Options": "nosniff", + "x-ms-ratelimit-remaining-tenant-reads": "14999", + "x-ms-correlation-request-id": "25c78f97-0b0a-4fe9-ad39-883a482265cd" + }, + "body": { + "id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account1/privateLinkResources/plr1", + "name": "plr1", + "type": "Microsoft.Purview/accounts/privateLinkResources", + "properties": { + "groupId": "group1", + "requiredMembers": [ + "group1" + ], + "requiredZoneNames": [ + "privatelinkzone1.service.azure.com" + ] + } + } + } + } +} diff --git a/commands/testdata/TestGenerateCommand_fromSwagger/examples/PrivateLinkResources_ListByAccount.json b/commands/testdata/TestGenerateCommand_fromSwagger/examples/PrivateLinkResources_ListByAccount.json new file mode 100644 index 00000000..20cd871f --- /dev/null +++ b/commands/testdata/TestGenerateCommand_fromSwagger/examples/PrivateLinkResources_ListByAccount.json @@ -0,0 +1,51 @@ +{ + "parameters": { + "subscriptionId": "12345678-1234-1234-12345678abc", + "resourceGroupName": "SampleResourceGroup", + "accountName": "account1", + "api-version": "2021-12-01" + }, + "responses": { + "200": { + "headers": { + "Date": "Wed, 13 Sep 2017 18:04:32 GMT", + "x-ms-request-id": "d5496da4-9c52-402f-b067-83cc9ddea888", + "X-Content-Type-Options": "nosniff", + "x-ms-ratelimit-remaining-tenant-reads": "14999", + "x-ms-correlation-request-id": "25c78f97-0b0a-4fe9-ad39-883a482265cd" + }, + "body": { + "value": [ + { + "id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account1/privateLinkResources/plr1", + "name": "plr1", + "type": "Microsoft.Purview/accounts/privateLinkResources", + "properties": { + "groupId": "account1", + "requiredMembers": [ + "account1" + ], + "requiredZoneNames": [ + "privatelinkzone1.service.azure.com" + ] + } + }, + { + "id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account1/privateLinkResources/plr2", + "name": "plr2", + "type": "Microsoft.Purview/accounts/privateLinkResources", + "properties": { + "groupId": "account2", + "requiredMembers": [ + "account2" + ], + "requiredZoneNames": [ + "privatelinkzone2.service.azure.com" + ] + } + } + ] + } + } + } +} diff --git a/commands/testdata/TestGenerateCommand_fromSwagger/examples/Usages_Get.json b/commands/testdata/TestGenerateCommand_fromSwagger/examples/Usages_Get.json new file mode 100644 index 00000000..7b94f4c2 --- /dev/null +++ b/commands/testdata/TestGenerateCommand_fromSwagger/examples/Usages_Get.json @@ -0,0 +1,42 @@ +{ + "parameters": { + "subscriptionId": "12345678-1234-1234-12345678abc", + "location": "West US 2", + "api-version": "2021-12-01" + }, + "responses": { + "200": { + "headers": { + "Date": "Wed, 13 Sep 2017 18:04:32 GMT", + "x-ms-request-id": "d5496da4-9c52-402f-b067-83cc9ddea888", + "X-Content-Type-Options": "nosniff", + "x-ms-ratelimit-remaining-tenant-reads": "14999", + "x-ms-correlation-request-id": "25c78f97-0b0a-4fe9-ad39-883a482265cd" + }, + "body": { + "value": [ + { + "unit": "Count", + "currentValue": 1, + "limit": 3, + "id": "", + "name": { + "value": "Purview-Account-Subscription", + "localizedValue": "Purview-Account-Subscription" + } + }, + { + "unit": "Count", + "currentValue": 2, + "limit": 3, + "id": "", + "name": { + "value": "Purview-Account-Tenant", + "localizedValue": "Purview-Account-Tenant" + } + } + ] + } + } + } +} diff --git a/commands/testdata/TestGenerateCommand_fromSwagger/expect/Microsoft.Purview/main.tf b/commands/testdata/TestGenerateCommand_fromSwagger/expect/Microsoft.Purview/main.tf new file mode 100644 index 00000000..1c2cfead --- /dev/null +++ b/commands/testdata/TestGenerateCommand_fromSwagger/expect/Microsoft.Purview/main.tf @@ -0,0 +1,94 @@ +terraform { + required_providers { + azapi = { + source = "Azure/azapi" + } + } +} + +provider "azurerm" { + features { + resource_group { + prevent_deletion_if_contains_resources = false + } + key_vault { + purge_soft_delete_on_destroy = false + purge_soft_deleted_keys_on_destroy = false + } + } + skip_provider_registration = true +} + +provider "azapi" { + skip_provider_registration = false +} + +variable "resource_name" { + type = string + default = "acctest3274" +} + +variable "location" { + type = string + default = "westeurope" +} + +// OperationId: DefaultAccounts_Get +// GET /providers/Microsoft.Purview/getDefaultAccount +data "azapi_resource_action" "getDefaultAccount" { + type = "Microsoft.Purview@2021-12-01" + resource_id = "/providers/Microsoft.Purview" + action = "getDefaultAccount" + method = "GET" +} + +// OperationId: DefaultAccounts_Remove +// POST /providers/Microsoft.Purview/removeDefaultAccount +resource "azapi_resource_action" "removeDefaultAccount" { + type = "Microsoft.Purview@2021-12-01" + resource_id = "/providers/Microsoft.Purview" + action = "removeDefaultAccount" + method = "POST" +} + +// OperationId: DefaultAccounts_Set +// POST /providers/Microsoft.Purview/setDefaultAccount +resource "azapi_resource_action" "setDefaultAccount" { + type = "Microsoft.Purview@2021-12-01" + resource_id = "/providers/Microsoft.Purview" + action = "setDefaultAccount" + method = "POST" + body = { + accountName = "myDefaultAccount" + resourceGroupName = "rg-1" + scope = "12345678-1234-1234-1234-12345678abcd" + scopeTenantId = "12345678-1234-1234-1234-12345678abcd" + scopeType = "Tenant" + subscriptionId = "12345678-1234-1234-1234-12345678aaaa" + } +} + +data "azapi_resource" "subscription" { + type = "Microsoft.Resources/subscriptions@2020-06-01" + response_export_values = ["*"] +} + +data "azapi_resource_id" "subscriptionScopeProvider" { + type = "Microsoft.Resources/providers@2020-06-01" + parent_id = data.azapi_resource.subscription.id + name = "Microsoft.Purview" +} + +// OperationId: Accounts_CheckNameAvailability +// POST /subscriptions/{subscriptionId}/providers/Microsoft.Purview/checkNameAvailability +resource "azapi_resource_action" "checkNameAvailability" { + type = "Microsoft.Purview@2021-12-01" + resource_id = data.azapi_resource_id.subscriptionScopeProvider.id + action = "checkNameAvailability" + method = "POST" + body = { + name = "account1" + type = "Microsoft.Purview/accounts" + } +} + diff --git a/commands/testdata/TestGenerateCommand_fromSwagger/expect/Microsoft.Purview_accounts/main.tf b/commands/testdata/TestGenerateCommand_fromSwagger/expect/Microsoft.Purview_accounts/main.tf new file mode 100644 index 00000000..92c76b4d --- /dev/null +++ b/commands/testdata/TestGenerateCommand_fromSwagger/expect/Microsoft.Purview_accounts/main.tf @@ -0,0 +1,136 @@ +terraform { + required_providers { + azapi = { + source = "Azure/azapi" + } + } +} + +provider "azurerm" { + features { + resource_group { + prevent_deletion_if_contains_resources = false + } + key_vault { + purge_soft_delete_on_destroy = false + purge_soft_deleted_keys_on_destroy = false + } + } + skip_provider_registration = true +} + +provider "azapi" { + skip_provider_registration = false +} + +variable "resource_name" { + type = string + default = "acctest8514" +} + +variable "location" { + type = string + default = "West US 2" +} + +resource "azapi_resource" "resourceGroup" { + type = "Microsoft.Resources/resourceGroups@2020-06-01" + name = var.resource_name + location = var.location +} + +// OperationId: Accounts_CreateOrUpdate, Accounts_Get, Accounts_Delete +// PUT GET DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName} +resource "azapi_resource" "account" { + type = "Microsoft.Purview/accounts@2021-12-01" + parent_id = azapi_resource.resourceGroup.id + name = var.resource_name + location = var.location + body = { + properties = { + managedResourceGroupName = "custom-rgname" + managedResourcesPublicNetworkAccess = "Enabled" + } + } + schema_validation_enabled = false +} + +// OperationId: Accounts_Update +// PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName} +resource "azapi_resource_action" "patch_account" { + type = "Microsoft.Purview/accounts@2021-12-01" + resource_id = azapi_resource.account.id + action = "" + method = "PATCH" + body = { + properties = { + cloudConnectors = { + } + managedResourceGroupName = "aaaaaaaaaaaaaaaaaaaaaaaaaaaa" + managedResourcesPublicNetworkAccess = "Disabled" + publicNetworkAccess = "NotSpecified" + } + tags = { + newTag = "New tag value." + } + } +} + +// OperationId: Accounts_AddRootCollectionAdmin +// POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/addRootCollectionAdmin +resource "azapi_resource_action" "addRootCollectionAdmin" { + type = "Microsoft.Purview/accounts@2021-12-01" + resource_id = azapi_resource.account.id + action = "addRootCollectionAdmin" + method = "POST" + body = { + objectId = "7e8de0e7-2bfc-4e1f-9659-2a5785e4356f" + } +} + +// OperationId: Features_AccountGet +// POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/listFeatures +resource "azapi_resource_action" "listFeatures" { + type = "Microsoft.Purview/accounts@2021-12-01" + resource_id = azapi_resource.account.id + action = "listFeatures" + method = "POST" + body = { + features = [ + "Feature1", + "Feature2", + "FeatureThatDoesntExist", + ] + } +} + +// OperationId: Accounts_ListKeys +// POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/listkeys +resource "azapi_resource_action" "listkeys" { + type = "Microsoft.Purview/accounts@2021-12-01" + resource_id = azapi_resource.account.id + action = "listkeys" + method = "POST" +} + +data "azapi_resource" "subscription" { + type = "Microsoft.Resources/subscriptions@2020-06-01" + response_export_values = ["*"] +} + +// OperationId: Accounts_ListBySubscription +// GET /subscriptions/{subscriptionId}/providers/Microsoft.Purview/accounts +data "azapi_resource_list" "listAccountsBySubscription" { + type = "Microsoft.Purview/accounts@2021-12-01" + parent_id = data.azapi_resource.subscription.id + depends_on = [azapi_resource.account] +} + +// OperationId: Accounts_ListByResourceGroup +// GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts +data "azapi_resource_list" "listAccountsByResourceGroup" { + type = "Microsoft.Purview/accounts@2021-12-01" + parent_id = azapi_resource.resourceGroup.id + depends_on = [azapi_resource.account] +} + diff --git a/commands/testdata/TestGenerateCommand_fromSwagger/expect/Microsoft.Purview_accounts_kafkaConfigurations/main.tf b/commands/testdata/TestGenerateCommand_fromSwagger/expect/Microsoft.Purview_accounts_kafkaConfigurations/main.tf new file mode 100644 index 00000000..479470c7 --- /dev/null +++ b/commands/testdata/TestGenerateCommand_fromSwagger/expect/Microsoft.Purview_accounts_kafkaConfigurations/main.tf @@ -0,0 +1,108 @@ +terraform { + required_providers { + azapi = { + source = "Azure/azapi" + } + } +} + +provider "azurerm" { + features { + resource_group { + prevent_deletion_if_contains_resources = false + } + key_vault { + purge_soft_delete_on_destroy = false + purge_soft_deleted_keys_on_destroy = false + } + } + skip_provider_registration = true +} + +provider "azapi" { + skip_provider_registration = false +} + +variable "resource_name" { + type = string + default = "acctest5353" +} + +variable "location" { + type = string + default = "westeurope" +} + +resource "azapi_resource" "resourceGroup" { + type = "Microsoft.Resources/resourceGroups@2020-06-01" + name = var.resource_name + location = var.location +} + +resource "azapi_resource" "account" { + type = "Microsoft.Purview/accounts@2021-07-01" + parent_id = azapi_resource.resourceGroup.id + name = var.resource_name + location = var.location + identity { + type = "SystemAssigned" + identity_ids = [] + } + body = { + properties = { + publicNetworkAccess = "Enabled" + } + } + schema_validation_enabled = false + response_export_values = ["*"] +} + +resource "azapi_resource" "namespace" { + type = "Microsoft.EventHub/namespaces@2022-01-01-preview" + parent_id = azapi_resource.resourceGroup.id + name = var.resource_name + location = var.location + body = { + properties = { + disableLocalAuth = false + isAutoInflateEnabled = false + publicNetworkAccess = "Enabled" + zoneRedundant = false + } + sku = { + capacity = 1 + name = "Standard" + tier = "Standard" + } + } + schema_validation_enabled = false + response_export_values = ["*"] +} + +// OperationId: KafkaConfigurations_CreateOrUpdate, KafkaConfigurations_Get, KafkaConfigurations_Delete +// PUT GET DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/kafkaConfigurations/{kafkaConfigurationName} +resource "azapi_resource" "kafkaConfiguration" { + type = "Microsoft.Purview/accounts/kafkaConfigurations@2021-12-01" + parent_id = azapi_resource.account.id + name = var.resource_name + body = { + properties = { + consumerGroup = "consumerGroup" + eventHubPartitionId = "partitionId" + eventHubResourceId = azapi_resource.namespace.id + eventHubType = "Notification" + eventStreamingState = "Enabled" + eventStreamingType = "Azure" + } + } + schema_validation_enabled = false +} + +// OperationId: KafkaConfigurations_ListByAccount +// GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/kafkaConfigurations +data "azapi_resource_list" "listKafkaConfigurationsByAccount" { + type = "Microsoft.Purview/accounts/kafkaConfigurations@2021-12-01" + parent_id = azapi_resource.account.id + depends_on = [azapi_resource.kafkaConfiguration] +} + diff --git a/commands/testdata/TestGenerateCommand_fromSwagger/expect/Microsoft.Purview_accounts_privateEndpointConnections/main.tf b/commands/testdata/TestGenerateCommand_fromSwagger/expect/Microsoft.Purview_accounts_privateEndpointConnections/main.tf new file mode 100644 index 00000000..97ff6413 --- /dev/null +++ b/commands/testdata/TestGenerateCommand_fromSwagger/expect/Microsoft.Purview_accounts_privateEndpointConnections/main.tf @@ -0,0 +1,84 @@ +terraform { + required_providers { + azapi = { + source = "Azure/azapi" + } + } +} + +provider "azurerm" { + features { + resource_group { + prevent_deletion_if_contains_resources = false + } + key_vault { + purge_soft_delete_on_destroy = false + purge_soft_deleted_keys_on_destroy = false + } + } + skip_provider_registration = true +} + +provider "azapi" { + skip_provider_registration = false +} + +variable "resource_name" { + type = string + default = "acctest2506" +} + +variable "location" { + type = string + default = "westeurope" +} + +resource "azapi_resource" "resourceGroup" { + type = "Microsoft.Resources/resourceGroups@2020-06-01" + name = var.resource_name + location = var.location +} + +resource "azapi_resource" "account" { + type = "Microsoft.Purview/accounts@2021-07-01" + parent_id = azapi_resource.resourceGroup.id + name = var.resource_name + location = var.location + identity { + type = "SystemAssigned" + identity_ids = [] + } + body = { + properties = { + publicNetworkAccess = "Enabled" + } + } + schema_validation_enabled = false + response_export_values = ["*"] +} + +// OperationId: PrivateEndpointConnections_CreateOrUpdate, PrivateEndpointConnections_Get, PrivateEndpointConnections_Delete +// PUT GET DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName} +resource "azapi_resource" "privateEndpointConnection" { + type = "Microsoft.Purview/accounts/privateEndpointConnections@2021-12-01" + parent_id = azapi_resource.account.id + name = var.resource_name + body = { + properties = { + privateLinkServiceConnectionState = { + description = "Approved by johndoe@company.com" + status = "Approved" + } + } + } + schema_validation_enabled = false +} + +// OperationId: PrivateEndpointConnections_ListByAccount +// GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/privateEndpointConnections +data "azapi_resource_list" "listPrivateEndpointConnectionsByAccount" { + type = "Microsoft.Purview/accounts/privateEndpointConnections@2021-12-01" + parent_id = azapi_resource.account.id + depends_on = [azapi_resource.privateEndpointConnection] +} + diff --git a/commands/testdata/TestGenerateCommand_fromSwagger/expect/Microsoft.Purview_accounts_privateLinkResources/main.tf b/commands/testdata/TestGenerateCommand_fromSwagger/expect/Microsoft.Purview_accounts_privateLinkResources/main.tf new file mode 100644 index 00000000..2c06f5de --- /dev/null +++ b/commands/testdata/TestGenerateCommand_fromSwagger/expect/Microsoft.Purview_accounts_privateLinkResources/main.tf @@ -0,0 +1,75 @@ +terraform { + required_providers { + azapi = { + source = "Azure/azapi" + } + } +} + +provider "azurerm" { + features { + resource_group { + prevent_deletion_if_contains_resources = false + } + key_vault { + purge_soft_delete_on_destroy = false + purge_soft_deleted_keys_on_destroy = false + } + } + skip_provider_registration = true +} + +provider "azapi" { + skip_provider_registration = false +} + +variable "resource_name" { + type = string + default = "acctest7515" +} + +variable "location" { + type = string + default = "westeurope" +} + +resource "azapi_resource" "resourceGroup" { + type = "Microsoft.Resources/resourceGroups@2020-06-01" + name = var.resource_name + location = var.location +} + +resource "azapi_resource" "account" { + type = "Microsoft.Purview/accounts@2021-07-01" + parent_id = azapi_resource.resourceGroup.id + name = var.resource_name + location = var.location + identity { + type = "SystemAssigned" + identity_ids = [] + } + body = { + properties = { + publicNetworkAccess = "Enabled" + } + } + schema_validation_enabled = false + response_export_values = ["*"] +} + +// OperationId: PrivateLinkResources_GetByGroupId +// GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/privateLinkResources/{groupId} +data "azapi_resource" "privateLinkResource" { + type = "Microsoft.Purview/accounts/privateLinkResources@2021-12-01" + parent_id = azapi_resource.account.id + name = var.resource_name +} + +// OperationId: PrivateLinkResources_ListByAccount +// GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/privateLinkResources +data "azapi_resource_list" "listPrivateLinkResourcesByAccount" { + type = "Microsoft.Purview/accounts/privateLinkResources@2021-12-01" + parent_id = azapi_resource.account.id + depends_on = [data.azapi_resource.privateLinkResource] +} + diff --git a/commands/testdata/TestGenerateCommand_fromSwagger/expect/Microsoft.Purview_locations/main.tf b/commands/testdata/TestGenerateCommand_fromSwagger/expect/Microsoft.Purview_locations/main.tf new file mode 100644 index 00000000..a628e04c --- /dev/null +++ b/commands/testdata/TestGenerateCommand_fromSwagger/expect/Microsoft.Purview_locations/main.tf @@ -0,0 +1,71 @@ +terraform { + required_providers { + azapi = { + source = "Azure/azapi" + } + } +} + +provider "azurerm" { + features { + resource_group { + prevent_deletion_if_contains_resources = false + } + key_vault { + purge_soft_delete_on_destroy = false + purge_soft_deleted_keys_on_destroy = false + } + } + skip_provider_registration = true +} + +provider "azapi" { + skip_provider_registration = false +} + +variable "resource_name" { + type = string + default = "acctest4496" +} + +variable "location" { + type = string + default = "westeurope" +} + +data "azapi_resource" "subscription" { + type = "Microsoft.Resources/subscriptions@2020-06-01" + response_export_values = ["*"] +} + +data "azapi_resource_id" "location" { + type = "Microsoft.Purview/locations@2023-12-12" + parent_id = data.azapi_resource.subscription.id + name = var.location +} + +// OperationId: Features_SubscriptionGet +// POST /subscriptions/{subscriptionId}/providers/Microsoft.Purview/locations/{locations}/listFeatures +resource "azapi_resource_action" "listFeatures" { + type = "Microsoft.Purview/locations@2021-12-01" + resource_id = data.azapi_resource_id.location.id + action = "listFeatures" + method = "POST" + body = { + features = [ + "Feature1", + "Feature2", + "FeatureThatDoesntExist", + ] + } +} + +// OperationId: Usages_Get +// GET /subscriptions/{subscriptionId}/providers/Microsoft.Purview/locations/{location}/usages +data "azapi_resource_action" "usages" { + type = "Microsoft.Purview/locations@2021-12-01" + resource_id = data.azapi_resource_id.location.id + action = "usages" + method = "GET" +} + diff --git a/commands/testdata/TestGenerateCommand_fromSwagger/expect/Microsoft.Purview_operations/main.tf b/commands/testdata/TestGenerateCommand_fromSwagger/expect/Microsoft.Purview_operations/main.tf new file mode 100644 index 00000000..85d5907e --- /dev/null +++ b/commands/testdata/TestGenerateCommand_fromSwagger/expect/Microsoft.Purview_operations/main.tf @@ -0,0 +1,42 @@ +terraform { + required_providers { + azapi = { + source = "Azure/azapi" + } + } +} + +provider "azurerm" { + features { + resource_group { + prevent_deletion_if_contains_resources = false + } + key_vault { + purge_soft_delete_on_destroy = false + purge_soft_deleted_keys_on_destroy = false + } + } + skip_provider_registration = true +} + +provider "azapi" { + skip_provider_registration = false +} + +variable "resource_name" { + type = string + default = "acctest8767" +} + +variable "location" { + type = string + default = "westeurope" +} + +// OperationId: Operations_List +// GET /providers/Microsoft.Purview/operations +data "azapi_resource_list" "listOperationsByTenant" { + type = "Microsoft.Purview/operations@2021-12-01" + parent_id = "/" +} + diff --git a/commands/testdata/TestGenerateCommand_fromSwagger/purview.json b/commands/testdata/TestGenerateCommand_fromSwagger/purview.json new file mode 100644 index 00000000..41346bd8 --- /dev/null +++ b/commands/testdata/TestGenerateCommand_fromSwagger/purview.json @@ -0,0 +1,2685 @@ +{ + "swagger": "2.0", + "info": { + "version": "2021-12-01", + "title": "PurviewManagementClient", + "description": "Creates a Microsoft.Purview management client." + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts": { + "get": { + "tags": [ + "Account" + ], + "summary": "Gets the accounts resources by resource group.", + "description": "List accounts in ResourceGroup", + "operationId": "Accounts_ListByResourceGroup", + "parameters": [ + { + "$ref": "#/parameters/subscriptionId" + }, + { + "$ref": "#/parameters/resourceGroupName" + }, + { + "$ref": "#/parameters/api-version" + }, + { + "name": "$skipToken", + "in": "query", + "description": "The skip token.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/AccountList" + } + }, + "default": { + "description": "An error response received from the provider.", + "schema": { + "$ref": "#/definitions/ErrorResponseModel" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "Accounts_ListByResourceGroup": { + "$ref": "./examples/Accounts_ListByResourceGroup.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.Purview/accounts": { + "get": { + "tags": [ + "Account" + ], + "summary": "Gets the accounts resources by subscription.", + "description": "List accounts in Subscription", + "operationId": "Accounts_ListBySubscription", + "parameters": [ + { + "$ref": "#/parameters/subscriptionId" + }, + { + "$ref": "#/parameters/api-version" + }, + { + "name": "$skipToken", + "in": "query", + "description": "The skip token.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/AccountList" + } + }, + "default": { + "description": "An error response received from the provider.", + "schema": { + "$ref": "#/definitions/ErrorResponseModel" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "Accounts_ListBySubscription": { + "$ref": "./examples/Accounts_ListBySubscription.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}": { + "get": { + "tags": [ + "Account" + ], + "summary": "Gets the account resource.", + "description": "Get an account", + "operationId": "Accounts_Get", + "parameters": [ + { + "$ref": "#/parameters/subscriptionId" + }, + { + "$ref": "#/parameters/resourceGroupName" + }, + { + "$ref": "#/parameters/accountName" + }, + { + "$ref": "#/parameters/api-version" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/Account" + } + }, + "default": { + "description": "An error response received from the provider.", + "schema": { + "$ref": "#/definitions/ErrorResponseModel" + } + } + }, + "x-ms-examples": { + "Accounts_Get": { + "$ref": "./examples/Accounts_Get.json" + } + } + }, + "put": { + "tags": [ + "Account" + ], + "summary": "Create or update an account resource", + "description": "Creates or updates an account", + "operationId": "Accounts_CreateOrUpdate", + "parameters": [ + { + "$ref": "#/parameters/subscriptionId" + }, + { + "$ref": "#/parameters/resourceGroupName" + }, + { + "$ref": "#/parameters/accountName" + }, + { + "name": "account", + "in": "body", + "description": "The account.", + "required": true, + "schema": { + "$ref": "#/definitions/Account" + } + }, + { + "$ref": "#/parameters/api-version" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/Account" + } + }, + "201": { + "description": "Success", + "schema": { + "$ref": "#/definitions/Account" + } + }, + "default": { + "description": "An error response received from the provider.", + "schema": { + "$ref": "#/definitions/ErrorResponseModel" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "Accounts_CreateOrUpdate": { + "$ref": "./examples/Accounts_CreateOrUpdate.json" + } + } + }, + "delete": { + "tags": [ + "Account" + ], + "summary": "Deletes the account resource.", + "description": "Deletes an account resource", + "operationId": "Accounts_Delete", + "parameters": [ + { + "$ref": "#/parameters/subscriptionId" + }, + { + "$ref": "#/parameters/resourceGroupName" + }, + { + "$ref": "#/parameters/accountName" + }, + { + "$ref": "#/parameters/api-version" + } + ], + "responses": { + "200": { + "description": "Success" + }, + "202": { + "description": "Accepted" + }, + "204": { + "description": "Success" + }, + "default": { + "description": "An error response received from the provider.", + "schema": { + "$ref": "#/definitions/ErrorResponseModel" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "Accounts_Delete": { + "$ref": "./examples/Accounts_Delete.json" + } + } + }, + "patch": { + "tags": [ + "Account" + ], + "summary": "Patches the account resource.", + "description": "Updates an account", + "operationId": "Accounts_Update", + "parameters": [ + { + "$ref": "#/parameters/subscriptionId" + }, + { + "$ref": "#/parameters/resourceGroupName" + }, + { + "$ref": "#/parameters/accountName" + }, + { + "name": "accountUpdateParameters", + "in": "body", + "description": "The account update parameters.", + "required": true, + "schema": { + "$ref": "#/definitions/AccountUpdateParameters" + } + }, + { + "$ref": "#/parameters/api-version" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/Account" + } + }, + "202": { + "description": "Accepted", + "schema": { + "$ref": "#/definitions/Account" + } + }, + "default": { + "description": "An error response received from the provider.", + "schema": { + "$ref": "#/definitions/ErrorResponseModel" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "Accounts_Update": { + "$ref": "./examples/Accounts_Update.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/listkeys": { + "post": { + "tags": [ + "Account" + ], + "summary": "Lists the keys asynchronous.", + "description": "List the authorization keys associated with this account.", + "operationId": "Accounts_ListKeys", + "parameters": [ + { + "$ref": "#/parameters/subscriptionId" + }, + { + "$ref": "#/parameters/resourceGroupName" + }, + { + "$ref": "#/parameters/accountName" + }, + { + "$ref": "#/parameters/api-version" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/AccessKeys" + } + }, + "default": { + "description": "An error response received from the provider.", + "schema": { + "$ref": "#/definitions/ErrorResponseModel" + } + } + }, + "x-ms-examples": { + "Accounts_ListKeys": { + "$ref": "./examples/Accounts_ListKeys.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/addRootCollectionAdmin": { + "post": { + "tags": [ + "Account" + ], + "summary": "Add the administrator for root collection.", + "description": "Add the administrator for root collection associated with this account.", + "operationId": "Accounts_AddRootCollectionAdmin", + "parameters": [ + { + "$ref": "#/parameters/subscriptionId" + }, + { + "$ref": "#/parameters/resourceGroupName" + }, + { + "$ref": "#/parameters/accountName" + }, + { + "name": "collectionAdminUpdate", + "in": "body", + "description": "The collection admin update payload.", + "required": true, + "schema": { + "$ref": "#/definitions/CollectionAdminUpdate" + } + }, + { + "$ref": "#/parameters/api-version" + } + ], + "responses": { + "200": { + "description": "Success" + }, + "default": { + "description": "An error response received from the provider.", + "schema": { + "$ref": "#/definitions/ErrorResponseModel" + } + } + }, + "x-ms-examples": { + "Accounts_AddRootCollectionAdmin": { + "$ref": "./examples/Accounts_AddRootCollectionAdmin.json" + } + } + } + }, + "/providers/Microsoft.Purview/getDefaultAccount": { + "get": { + "tags": [ + "DefaultAccount" + ], + "summary": "Gets the default account information set for the scope.", + "description": "Get the default account for the scope.", + "operationId": "DefaultAccounts_Get", + "parameters": [ + { + "name": "scopeTenantId", + "in": "query", + "description": "The tenant ID.", + "required": true, + "type": "string", + "format": "uuid" + }, + { + "name": "scopeType", + "in": "query", + "description": "The scope for the default account.", + "required": true, + "type": "string", + "enum": [ + "Tenant", + "Subscription" + ], + "x-ms-enum": { + "name": "ScopeType", + "modelAsString": true + } + }, + { + "name": "scope", + "in": "query", + "description": "The Id of the scope object, for example if the scope is \"Subscription\" then it is the ID of that subscription.", + "required": false, + "type": "string" + }, + { + "$ref": "#/parameters/api-version" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/DefaultAccountPayload" + } + }, + "default": { + "description": "An error response received from the provider.", + "schema": { + "$ref": "#/definitions/ErrorResponseModel" + } + } + }, + "x-ms-examples": { + "DefaultAccounts_Get": { + "$ref": "./examples/DefaultAccounts_Get.json" + } + } + } + }, + "/providers/Microsoft.Purview/setDefaultAccount": { + "post": { + "tags": [ + "DefaultAccount" + ], + "summary": "Sets the default account for the scope.", + "description": "Sets the default account for the scope.", + "operationId": "DefaultAccounts_Set", + "parameters": [ + { + "name": "defaultAccountPayload", + "in": "body", + "description": "The payload containing the default account information and the scope.", + "required": true, + "schema": { + "$ref": "#/definitions/DefaultAccountPayload" + } + }, + { + "$ref": "#/parameters/api-version" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/DefaultAccountPayload" + } + }, + "default": { + "description": "An error response received from the provider.", + "schema": { + "$ref": "#/definitions/ErrorResponseModel" + } + } + }, + "x-ms-examples": { + "DefaultAccounts_Set": { + "$ref": "./examples/DefaultAccounts_Set.json" + } + } + } + }, + "/providers/Microsoft.Purview/removeDefaultAccount": { + "post": { + "tags": [ + "DefaultAccount" + ], + "summary": "Removes the default account from the scope.", + "description": "Removes the default account from the scope.", + "operationId": "DefaultAccounts_Remove", + "parameters": [ + { + "name": "scopeTenantId", + "in": "query", + "description": "The tenant ID.", + "required": true, + "type": "string", + "format": "uuid" + }, + { + "name": "scopeType", + "in": "query", + "description": "The scope for the default account.", + "required": true, + "type": "string", + "enum": [ + "Tenant", + "Subscription" + ], + "x-ms-enum": { + "name": "ScopeType", + "modelAsString": true + } + }, + { + "name": "scope", + "in": "query", + "description": "The Id of the scope object, for example if the scope is \"Subscription\" then it is the ID of that subscription.", + "required": false, + "type": "string" + }, + { + "$ref": "#/parameters/api-version" + } + ], + "responses": { + "200": { + "description": "Success" + }, + "204": { + "description": "Success" + }, + "default": { + "description": "An error response received from the provider.", + "schema": { + "$ref": "#/definitions/ErrorResponseModel" + } + } + }, + "x-ms-examples": { + "DefaultAccounts_Remove": { + "$ref": "./examples/DefaultAccounts_Remove.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/listFeatures": { + "post": { + "tags": [ + "Feature" + ], + "summary": "Gets a list of features and their status for the account.\r\nStatus of enabled features will be true. Status of disabled features will be false.\r\nFeatures that don't exist will be excluded from the results.", + "description": "Gets details from a list of feature names.", + "operationId": "Features_AccountGet", + "parameters": [ + { + "$ref": "#/parameters/subscriptionId" + }, + { + "$ref": "#/parameters/resourceGroupName" + }, + { + "$ref": "#/parameters/accountName" + }, + { + "name": "featureRequest", + "in": "body", + "description": "Request body with feature names.", + "required": true, + "schema": { + "$ref": "#/definitions/BatchFeatureRequest" + } + }, + { + "$ref": "#/parameters/api-version" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/BatchFeatureStatus" + } + }, + "default": { + "description": "An error response received from the provider.", + "schema": { + "$ref": "#/definitions/ErrorResponseModel" + } + } + }, + "x-ms-examples": { + "Features_AccountGet": { + "$ref": "./examples/Features_AccountGet.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.Purview/locations/{locations}/listFeatures": { + "post": { + "tags": [ + "Feature" + ], + "summary": "Gets a list of features and their status for the location and subscription.\r\nStatus of enabled features will be true. Status of disabled features will be false.\r\nFeatures that don't exist will be excluded from the results.", + "description": "Gets details from a list of feature names.", + "operationId": "Features_SubscriptionGet", + "parameters": [ + { + "$ref": "#/parameters/subscriptionId" + }, + { + "name": "locations", + "in": "path", + "description": "Location of feature.", + "required": true, + "type": "string" + }, + { + "name": "featureRequest", + "in": "body", + "description": "Request body with feature names.", + "required": true, + "schema": { + "$ref": "#/definitions/BatchFeatureRequest" + } + }, + { + "$ref": "#/parameters/api-version" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/BatchFeatureStatus" + } + }, + "default": { + "description": "An error response received from the provider.", + "schema": { + "$ref": "#/definitions/ErrorResponseModel" + } + } + }, + "x-ms-examples": { + "Features_SubscriptionGet": { + "$ref": "./examples/Features_SubscriptionGet.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/kafkaConfigurations/{kafkaConfigurationName}": { + "get": { + "tags": [ + "KafkaConfiguration" + ], + "summary": "Gets the kafka configuration.", + "description": "Gets the kafka configuration for the account", + "operationId": "KafkaConfigurations_Get", + "parameters": [ + { + "$ref": "#/parameters/subscriptionId" + }, + { + "$ref": "#/parameters/resourceGroupName" + }, + { + "$ref": "#/parameters/accountName" + }, + { + "name": "kafkaConfigurationName", + "in": "path", + "description": "Name of kafka configuration.", + "required": true, + "type": "string", + "maxLength": 63, + "minLength": 3, + "pattern": "^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$" + }, + { + "$ref": "#/parameters/api-version" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/KafkaConfiguration" + } + }, + "default": { + "description": "An error response received from the provider.", + "schema": { + "$ref": "#/definitions/ErrorResponseModel" + } + } + }, + "x-ms-examples": { + "KafkaConfigurations_Get": { + "$ref": "./examples/KafkaConfigurations_Get.json" + } + } + }, + "put": { + "tags": [ + "KafkaConfiguration" + ], + "summary": "Create or update the kafka configuration.", + "description": "Create or update Kafka Configuration", + "operationId": "KafkaConfigurations_CreateOrUpdate", + "parameters": [ + { + "$ref": "#/parameters/subscriptionId" + }, + { + "$ref": "#/parameters/resourceGroupName" + }, + { + "$ref": "#/parameters/accountName" + }, + { + "name": "kafkaConfigurationName", + "in": "path", + "description": "The kafka configuration name.", + "required": true, + "type": "string", + "maxLength": 63, + "minLength": 3, + "pattern": "^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$" + }, + { + "name": "kafkaConfiguration", + "in": "body", + "description": "The kafka configuration of the account.", + "required": true, + "schema": { + "$ref": "#/definitions/KafkaConfiguration" + } + }, + { + "$ref": "#/parameters/api-version" + } + ], + "responses": { + "200": { + "description": "Create or Update Successful", + "schema": { + "$ref": "#/definitions/KafkaConfiguration" + } + }, + "201": { + "description": "Create or Update Successful", + "schema": { + "$ref": "#/definitions/KafkaConfiguration" + } + }, + "default": { + "description": "An error response received from the provider.", + "schema": { + "$ref": "#/definitions/ErrorResponseModel" + } + } + }, + "x-ms-examples": { + "KafkaConfigurations_CreateOrUpdate": { + "$ref": "./examples/KafkaConfigurations_CreateOrUpdate.json" + } + } + }, + "delete": { + "tags": [ + "KafkaConfiguration" + ], + "summary": "Deletes the kafka configuration on the account.", + "description": "Deletes a KafkaConfiguration resource.", + "operationId": "KafkaConfigurations_Delete", + "parameters": [ + { + "$ref": "#/parameters/subscriptionId" + }, + { + "$ref": "#/parameters/resourceGroupName" + }, + { + "$ref": "#/parameters/accountName" + }, + { + "name": "kafkaConfigurationName", + "in": "path", + "description": "Name of kafka configuration.", + "required": true, + "type": "string", + "maxLength": 63, + "minLength": 3, + "pattern": "^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$" + }, + { + "$ref": "#/parameters/api-version" + } + ], + "responses": { + "200": { + "description": "Success" + }, + "204": { + "description": "Success" + }, + "default": { + "description": "An error response received from the provider.", + "schema": { + "$ref": "#/definitions/ErrorResponseModel" + } + } + }, + "x-ms-examples": { + "KafkaConfigurations_Delete": { + "$ref": "./examples/KafkaConfigurations_Delete.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/kafkaConfigurations": { + "get": { + "tags": [ + "KafkaConfiguration" + ], + "summary": "Gets the list of Kafka configurations for the account.", + "description": "Lists the Kafka configurations in the Account", + "operationId": "KafkaConfigurations_ListByAccount", + "parameters": [ + { + "$ref": "#/parameters/subscriptionId" + }, + { + "$ref": "#/parameters/resourceGroupName" + }, + { + "$ref": "#/parameters/accountName" + }, + { + "$ref": "#/parameters/api-version" + }, + { + "name": "$skipToken", + "in": "query", + "description": "The skip token.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/KafkaConfigurationList" + } + }, + "default": { + "description": "An error response received from the provider.", + "schema": { + "$ref": "#/definitions/ErrorResponseModel" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "KafkaConfigurations_ListByAccount": { + "$ref": "./examples/KafkaConfigurations_ListByAccount.json" + } + } + } + }, + "/providers/Microsoft.Purview/operations": { + "get": { + "tags": [ + "Operation" + ], + "summary": "Lists the available operations", + "description": "List of available operations", + "operationId": "Operations_List", + "parameters": [ + { + "$ref": "#/parameters/api-version" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/OperationList" + } + }, + "default": { + "description": "An error response received from the provider.", + "schema": { + "$ref": "#/definitions/ErrorResponseModel" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "Operations_List": { + "$ref": "./examples/Operations_List.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/privateEndpointConnections": { + "get": { + "tags": [ + "PrivateEndpointConnection" + ], + "summary": "Gets private endpoint connections.", + "description": "Get private endpoint connections for account", + "operationId": "PrivateEndpointConnections_ListByAccount", + "parameters": [ + { + "$ref": "#/parameters/subscriptionId" + }, + { + "$ref": "#/parameters/resourceGroupName" + }, + { + "$ref": "#/parameters/accountName" + }, + { + "$ref": "#/parameters/api-version" + }, + { + "name": "$skipToken", + "in": "query", + "description": "The skip token.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/PrivateEndpointConnectionList" + } + }, + "default": { + "description": "An error response received from the provider.", + "schema": { + "$ref": "#/definitions/ErrorResponseModel" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "PrivateEndpointConnections_ListByAccount": { + "$ref": "./examples/PrivateEndpointConnections_ListByAccount.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}": { + "get": { + "tags": [ + "PrivateEndpointConnection" + ], + "summary": "Gets private endpoint connection information.", + "description": "Get a private endpoint connection", + "operationId": "PrivateEndpointConnections_Get", + "parameters": [ + { + "$ref": "#/parameters/subscriptionId" + }, + { + "$ref": "#/parameters/resourceGroupName" + }, + { + "$ref": "#/parameters/accountName" + }, + { + "name": "privateEndpointConnectionName", + "in": "path", + "description": "Name of the private endpoint connection.", + "required": true, + "type": "string" + }, + { + "$ref": "#/parameters/api-version" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/PrivateEndpointConnection" + } + }, + "default": { + "description": "An error response received from the provider.", + "schema": { + "$ref": "#/definitions/ErrorResponseModel" + } + } + }, + "x-ms-examples": { + "PrivateEndpointConnections_Get": { + "$ref": "./examples/PrivateEndpointConnections_Get.json" + } + } + }, + "put": { + "tags": [ + "PrivateEndpointConnection" + ], + "summary": "Approves/Rejects private endpoint connection request.", + "description": "Create or update a private endpoint connection", + "operationId": "PrivateEndpointConnections_CreateOrUpdate", + "parameters": [ + { + "$ref": "#/parameters/subscriptionId" + }, + { + "$ref": "#/parameters/resourceGroupName" + }, + { + "$ref": "#/parameters/accountName" + }, + { + "name": "privateEndpointConnectionName", + "in": "path", + "description": "Name of the private endpoint connection.", + "required": true, + "type": "string" + }, + { + "name": "request", + "in": "body", + "description": "The request.", + "required": true, + "schema": { + "$ref": "#/definitions/PrivateEndpointConnection" + } + }, + { + "$ref": "#/parameters/api-version" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/PrivateEndpointConnection" + } + }, + "201": { + "description": "Success", + "schema": { + "$ref": "#/definitions/PrivateEndpointConnection" + } + }, + "default": { + "description": "An error response received from the provider.", + "schema": { + "$ref": "#/definitions/ErrorResponseModel" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "PrivateEndpointConnections_CreateOrUpdate": { + "$ref": "./examples/PrivateEndpointConnections_CreateOrUpdate.json" + } + } + }, + "delete": { + "tags": [ + "PrivateEndpointConnection" + ], + "summary": "Deletes private endpoint connection.", + "description": "Delete a private endpoint connection", + "operationId": "PrivateEndpointConnections_Delete", + "parameters": [ + { + "$ref": "#/parameters/subscriptionId" + }, + { + "$ref": "#/parameters/resourceGroupName" + }, + { + "$ref": "#/parameters/accountName" + }, + { + "name": "privateEndpointConnectionName", + "in": "path", + "description": "Name of the private endpoint connection.", + "required": true, + "type": "string" + }, + { + "$ref": "#/parameters/api-version" + } + ], + "responses": { + "200": { + "description": "Success" + }, + "202": { + "description": "Accepted" + }, + "204": { + "description": "Success" + }, + "default": { + "description": "An error response received from the provider.", + "schema": { + "$ref": "#/definitions/ErrorResponseModel" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "PrivateEndpointConnections_Delete": { + "$ref": "./examples/PrivateEndpointConnections_Delete.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/privateLinkResources": { + "get": { + "tags": [ + "PrivateLinkResource" + ], + "summary": "Gets a list of privately linkable resources for an account.", + "description": "Gets a list of privately linkable resources for an account", + "operationId": "PrivateLinkResources_ListByAccount", + "parameters": [ + { + "$ref": "#/parameters/subscriptionId" + }, + { + "$ref": "#/parameters/resourceGroupName" + }, + { + "$ref": "#/parameters/accountName" + }, + { + "$ref": "#/parameters/api-version" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/PrivateLinkResourceList" + } + }, + "default": { + "description": "An error response received from the provider.", + "schema": { + "$ref": "#/definitions/ErrorResponseModel" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "PrivateLinkResources_ListByAccount": { + "$ref": "./examples/PrivateLinkResources_ListByAccount.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/privateLinkResources/{groupId}": { + "get": { + "tags": [ + "PrivateLinkResource" + ], + "summary": "Gets a privately linkable resources for an account with given group identifier.", + "description": "Gets a privately linkable resources for an account with given group identifier", + "operationId": "PrivateLinkResources_GetByGroupId", + "parameters": [ + { + "$ref": "#/parameters/subscriptionId" + }, + { + "$ref": "#/parameters/resourceGroupName" + }, + { + "$ref": "#/parameters/accountName" + }, + { + "name": "groupId", + "in": "path", + "description": "The group identifier.", + "required": true, + "type": "string" + }, + { + "$ref": "#/parameters/api-version" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/PrivateLinkResource" + } + }, + "default": { + "description": "An error response received from the provider.", + "schema": { + "$ref": "#/definitions/ErrorResponseModel" + } + } + }, + "x-ms-examples": { + "PrivateLinkResources_GetByGroupId": { + "$ref": "./examples/PrivateLinkResources_GetByGroupId.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.Purview/checkNameAvailability": { + "post": { + "tags": [ + "Provider" + ], + "summary": "Checks the account name availability.", + "description": "Checks if account name is available.", + "operationId": "Accounts_CheckNameAvailability", + "parameters": [ + { + "$ref": "#/parameters/subscriptionId" + }, + { + "name": "checkNameAvailabilityRequest", + "in": "body", + "description": "The check name availability request.", + "required": true, + "schema": { + "$ref": "#/definitions/CheckNameAvailabilityRequest" + } + }, + { + "$ref": "#/parameters/api-version" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/CheckNameAvailabilityResult" + } + }, + "default": { + "description": "An error response received from the provider.", + "schema": { + "$ref": "#/definitions/ErrorResponseModel" + } + } + }, + "x-ms-examples": { + "Accounts_CheckNameAvailability": { + "$ref": "./examples/Accounts_CheckNameAvailability.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.Purview/locations/{location}/usages": { + "get": { + "tags": [ + "Usages" + ], + "summary": "Gets the Usage quota configuration.", + "description": "Get the usage quota configuration", + "operationId": "Usages_Get", + "parameters": [ + { + "$ref": "#/parameters/subscriptionId" + }, + { + "name": "location", + "in": "path", + "description": "The region.", + "required": true, + "type": "string" + }, + { + "$ref": "#/parameters/api-version" + }, + { + "name": "$filter", + "in": "query", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/UsageList" + } + }, + "default": { + "description": "An error response received from the provider.", + "schema": { + "$ref": "#/definitions/ErrorResponseModel" + } + } + }, + "x-ms-examples": { + "Usages_Get": { + "$ref": "./examples/Usages_Get.json" + } + } + } + } + }, + "definitions": { + "AccountList": { + "description": "Paged list of Account resources", + "required": [ + "value" + ], + "type": "object", + "properties": { + "count": { + "format": "int64", + "description": "Total item count.", + "type": "integer" + }, + "nextLink": { + "description": "The Url of next result page.", + "type": "string" + }, + "value": { + "description": "Collection of items of type results.", + "uniqueItems": false, + "type": "array", + "items": { + "$ref": "#/definitions/Account" + } + } + } + }, + "Account": { + "description": "Account resource", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/TrackedResource" + } + ], + "properties": { + "properties": { + "$ref": "#/definitions/AccountProperties", + "description": "Gets or sets the properties.", + "x-ms-client-flatten": true + }, + "sku": { + "description": "Gets or sets the Sku.", + "allOf": [ + { + "$ref": "#/definitions/AccountSku" + } + ], + "readOnly": true + } + } + }, + "AccountSku": { + "description": "The Sku", + "type": "object", + "properties": { + "capacity": { + "format": "int32", + "description": "Gets or sets the sku capacity.", + "type": "integer" + }, + "name": { + "description": "Gets or sets the sku name.", + "enum": [ + "Standard" + ], + "type": "string", + "x-ms-enum": { + "name": "name", + "modelAsString": true + } + } + } + }, + "AccountProperties": { + "description": "The account properties", + "type": "object", + "properties": { + "accountStatus": { + "description": "Gets or sets the status of the account.", + "allOf": [ + { + "$ref": "#/definitions/AccountStatus" + } + ], + "readOnly": true + }, + "cloudConnectors": { + "$ref": "#/definitions/CloudConnectors", + "description": "Cloud connectors.\r\nExternal cloud identifier used as part of scanning configuration." + }, + "createdAt": { + "format": "date-time", + "description": "Gets the time at which the entity was created.", + "type": "string", + "readOnly": true + }, + "createdBy": { + "description": "Gets the creator of the entity.", + "type": "string", + "readOnly": true + }, + "createdByObjectId": { + "description": "Gets the creators of the entity's object id.", + "type": "string", + "readOnly": true + }, + "endpoints": { + "description": "The URIs that are the public endpoints of the account.", + "allOf": [ + { + "$ref": "#/definitions/AccountEndpoints" + } + ], + "readOnly": true + }, + "friendlyName": { + "description": "Gets or sets the friendly name.", + "type": "string", + "readOnly": true + }, + "managedEventHubState": { + "description": " Gets or sets the state of managed eventhub. If enabled managed eventhub will be created, if disabled the managed eventhub will be removed.", + "default": "NotSpecified", + "enum": [ + "NotSpecified", + "Disabled", + "Enabled" + ], + "type": "string", + "x-ms-enum": { + "name": "managedEventHubState", + "modelAsString": true + } + }, + "managedResourceGroupName": { + "description": "Gets or sets the managed resource group name", + "type": "string", + "x-ms-mutability": [ + "read", + "create" + ] + }, + "managedResources": { + "description": "Gets the resource identifiers of the managed resources.", + "allOf": [ + { + "$ref": "#/definitions/ManagedResources" + } + ], + "readOnly": true + }, + "managedResourcesPublicNetworkAccess": { + "description": "Gets or sets the public network access for managed resources.", + "default": "NotSpecified", + "enum": [ + "NotSpecified", + "Enabled", + "Disabled" + ], + "type": "string", + "x-ms-enum": { + "name": "managedResourcesPublicNetworkAccess", + "modelAsString": true + } + }, + "privateEndpointConnections": { + "description": "Gets the private endpoint connections information.", + "uniqueItems": false, + "type": "array", + "items": { + "$ref": "#/definitions/PrivateEndpointConnection" + }, + "readOnly": true + }, + "provisioningState": { + "description": "Gets or sets the state of the provisioning.", + "enum": [ + "Unknown", + "Creating", + "Moving", + "Deleting", + "SoftDeleting", + "SoftDeleted", + "Failed", + "Succeeded", + "Canceled" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "provisioningState", + "modelAsString": true + } + }, + "publicNetworkAccess": { + "description": "Gets or sets the public network access.", + "default": "Enabled", + "enum": [ + "NotSpecified", + "Enabled", + "Disabled" + ], + "type": "string", + "x-ms-enum": { + "name": "publicNetworkAccess", + "modelAsString": true + } + } + } + }, + "Identity": { + "description": "The Managed Identity of the resource", + "type": "object", + "properties": { + "principalId": { + "description": "Service principal object Id", + "type": "string", + "readOnly": true + }, + "tenantId": { + "description": "Tenant Id", + "type": "string", + "readOnly": true + }, + "type": { + "description": "Identity Type", + "enum": [ + "None", + "SystemAssigned", + "UserAssigned" + ], + "type": "string", + "x-ms-enum": { + "name": "type", + "modelAsString": true + } + }, + "userAssignedIdentities": { + "description": "User Assigned Identities", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/UserAssignedIdentity" + } + } + } + }, + "SystemData": { + "description": "Metadata pertaining to creation and last modification of the resource.", + "type": "object", + "properties": { + "createdAt": { + "format": "date-time", + "description": "The timestamp of resource creation (UTC).", + "type": "string", + "readOnly": true + }, + "createdBy": { + "description": "The identity that created the resource.", + "type": "string", + "readOnly": true + }, + "createdByType": { + "description": "The type of identity that created the resource.", + "enum": [ + "User", + "Application", + "ManagedIdentity", + "Key" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "createdByType", + "modelAsString": true + } + }, + "lastModifiedAt": { + "format": "date-time", + "description": "The timestamp of the last modification the resource (UTC).", + "type": "string", + "readOnly": true + }, + "lastModifiedBy": { + "description": "The identity that last modified the resource.", + "type": "string", + "readOnly": true + }, + "lastModifiedByType": { + "description": "The type of identity that last modified the resource.", + "enum": [ + "User", + "Application", + "ManagedIdentity", + "Key" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "lastModifiedByType", + "modelAsString": true + } + } + } + }, + "CloudConnectors": { + "description": "External Cloud Service connectors", + "type": "object", + "properties": { + "awsExternalId": { + "description": "AWS external identifier.\r\nConfigured in AWS to allow use of the role arn used for scanning", + "type": "string", + "readOnly": true + } + } + }, + "AccountEndpoints": { + "description": "The account endpoints", + "type": "object", + "properties": { + "catalog": { + "description": "Gets the catalog endpoint.", + "type": "string", + "readOnly": true + }, + "guardian": { + "description": "Gets the guardian endpoint.", + "type": "string", + "readOnly": true + }, + "scan": { + "description": "Gets the scan endpoint.", + "type": "string", + "readOnly": true + } + } + }, + "AccountStatus": { + "description": "The account status.", + "type": "object", + "properties": { + "accountProvisioningState": { + "description": "Gets the account status code.", + "enum": [ + "Unknown", + "Creating", + "Updating", + "Moving", + "Deleting", + "SoftDeleting", + "SoftDeleted", + "Failed", + "Succeeded", + "Canceled" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "accountProvisioningState", + "modelAsString": true + } + }, + "errorDetails": { + "description": "Gets the account error details.", + "allOf": [ + { + "$ref": "#/definitions/ErrorModel" + } + ], + "readOnly": true + } + } + }, + "PrivateEndpointConnection": { + "description": "A private endpoint connection class.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ProxyResource" + } + ], + "properties": { + "properties": { + "$ref": "#/definitions/PrivateEndpointConnectionProperties", + "description": "The connection identifier.", + "x-ms-client-flatten": true + } + } + }, + "ManagedResources": { + "description": "The managed resources in customer subscription.", + "type": "object", + "properties": { + "eventHubNamespace": { + "description": "Gets the managed event hub namespace resource identifier.", + "type": "string", + "readOnly": true + }, + "resourceGroup": { + "description": "Gets the managed resource group resource identifier. This resource group will host resource dependencies for the account.", + "type": "string", + "readOnly": true + }, + "storageAccount": { + "description": "Gets the managed storage account resource identifier.", + "type": "string", + "readOnly": true + } + } + }, + "UserAssignedIdentity": { + "description": "Uses client ID and Principal ID", + "type": "object", + "properties": { + "clientId": { + "description": "Gets or Sets Client ID", + "type": "string", + "readOnly": true + }, + "principalId": { + "description": "Gets or Sets Principal ID", + "type": "string", + "readOnly": true + } + } + }, + "ErrorModel": { + "description": "Default error model", + "type": "object", + "properties": { + "code": { + "description": "Gets or sets the code.", + "type": "string", + "readOnly": true + }, + "details": { + "description": "Gets or sets the details.", + "uniqueItems": false, + "type": "array", + "items": { + "$ref": "#/definitions/ErrorModel" + }, + "x-ms-identifiers": [ + "code" + ], + "readOnly": true + }, + "message": { + "description": "Gets or sets the messages.", + "type": "string", + "readOnly": true + }, + "target": { + "description": "Gets or sets the target.", + "type": "string", + "readOnly": true + } + } + }, + "PrivateEndpointConnectionProperties": { + "description": "A private endpoint connection properties class.", + "type": "object", + "properties": { + "privateEndpoint": { + "$ref": "#/definitions/PrivateEndpoint", + "description": "The private endpoint information." + }, + "privateLinkServiceConnectionState": { + "$ref": "#/definitions/PrivateLinkServiceConnectionState", + "description": "The private link service connection state." + }, + "provisioningState": { + "description": "The provisioning state.", + "type": "string", + "readOnly": true + } + } + }, + "PrivateEndpoint": { + "description": "A private endpoint class.", + "type": "object", + "properties": { + "id": { + "description": "The private endpoint identifier.", + "type": "string" + } + } + }, + "PrivateLinkServiceConnectionState": { + "description": "The private link service connection state.", + "type": "object", + "properties": { + "actionsRequired": { + "description": "The required actions.", + "type": "string" + }, + "description": { + "description": "The description.", + "type": "string" + }, + "status": { + "description": "The status.", + "enum": [ + "Unknown", + "Pending", + "Approved", + "Rejected", + "Disconnected" + ], + "type": "string", + "x-ms-enum": { + "name": "status", + "modelAsString": true + } + } + } + }, + "ErrorResponseModel": { + "description": "Default error response model", + "type": "object", + "properties": { + "error": { + "description": "Gets or sets the error.", + "allOf": [ + { + "$ref": "#/definitions/ErrorModel" + } + ], + "readOnly": true + } + } + }, + "AccountUpdateParameters": { + "description": "The account update properties.", + "type": "object", + "properties": { + "identity": { + "$ref": "#/definitions/Identity", + "description": "Identity related info to add/remove userAssignedIdentities." + }, + "properties": { + "$ref": "#/definitions/AccountProperties", + "description": "The account properties." + }, + "tags": { + "description": "Tags on the azure resource.", + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + }, + "AccessKeys": { + "description": "The Account access keys.", + "type": "object", + "properties": { + "atlasKafkaPrimaryEndpoint": { + "description": "Gets or sets the primary connection string.", + "type": "string" + }, + "atlasKafkaSecondaryEndpoint": { + "description": "Gets or sets the secondary connection string.", + "type": "string" + } + } + }, + "CollectionAdminUpdate": { + "description": "Collection administrator update.", + "type": "object", + "properties": { + "objectId": { + "description": "Gets or sets the object identifier of the admin.", + "type": "string" + } + } + }, + "DefaultAccountPayload": { + "description": "Payload to get and set the default account in the given scope", + "type": "object", + "properties": { + "accountName": { + "description": "The name of the account that is set as the default.", + "type": "string" + }, + "resourceGroupName": { + "description": "The resource group name of the account that is set as the default.", + "type": "string" + }, + "scope": { + "description": "The scope object ID. For example, sub ID or tenant ID.", + "type": "string" + }, + "scopeTenantId": { + "description": "The scope tenant in which the default account is set.", + "type": "string" + }, + "scopeType": { + "description": "The scope where the default account is set.", + "enum": [ + "Tenant", + "Subscription" + ], + "type": "string", + "x-ms-enum": { + "name": "scopeType", + "modelAsString": true + } + }, + "subscriptionId": { + "description": "The subscription ID of the account that is set as the default.", + "type": "string" + } + } + }, + "BatchFeatureRequest": { + "description": "Feature request model", + "type": "object", + "properties": { + "features": { + "description": "Set of features", + "uniqueItems": true, + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "BatchFeatureStatus": { + "description": "List of features with enabled status", + "type": "object", + "properties": { + "features": { + "description": "Features with enabled status", + "type": "object", + "additionalProperties": { + "type": "boolean" + } + } + } + }, + "KafkaConfiguration": { + "description": "The configuration of the event streaming service resource attached to the Purview account for kafka notifications.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ProxyResource" + } + ], + "properties": { + "properties": { + "$ref": "#/definitions/KafkaConfigurationProperties", + "description": "Gets or sets the kafka configuration properties.", + "x-ms-client-flatten": true + } + } + }, + "KafkaConfigurationProperties": { + "description": "The kafka configuration properties of the event streaming service attached to the Purview account for kafka notifications.", + "type": "object", + "properties": { + "consumerGroup": { + "description": "Consumer group for hook event hub.", + "type": "string" + }, + "credentials": { + "$ref": "#/definitions/Credentials", + "description": "Credentials to access event hub." + }, + "eventHubResourceId": { + "type": "string", + "format": "arm-id", + "x-ms-arm-id-details": { + "allowedResources": [ + { + "type": "Microsoft.EventHub/namespaces/eventHubs" + } + ] + } + }, + "eventHubType": { + "description": "The event hub type.", + "enum": [ + "Notification", + "Hook" + ], + "type": "string", + "x-ms-enum": { + "name": "eventHubType", + "modelAsString": true + } + }, + "eventStreamingState": { + "description": "The state of the event streaming service", + "default": "Enabled", + "enum": [ + "Disabled", + "Enabled" + ], + "type": "string", + "x-ms-enum": { + "name": "eventStreamingState", + "modelAsString": true + } + }, + "eventStreamingType": { + "description": "The event streaming service type", + "default": "None", + "enum": [ + "None", + "Managed", + "Azure" + ], + "type": "string", + "x-ms-enum": { + "name": "eventStreamingType", + "modelAsString": true + } + }, + "eventHubPartitionId": { + "description": "Optional partition Id for notification event hub. If not set, all partitions will be leveraged.", + "type": "string" + } + } + }, + "Credentials": { + "description": "Credentials to access the event streaming service attached to the purview account.", + "type": "object", + "properties": { + "identityId": { + "description": "Identity identifier for UserAssign type.", + "type": "string" + }, + "type": { + "description": "Identity Type.", + "enum": [ + "None", + "SystemAssigned", + "UserAssigned" + ], + "type": "string", + "x-ms-enum": { + "name": "CredentialsType", + "modelAsString": true + } + } + } + }, + "KafkaConfigurationList": { + "description": "Paged list of kafka configuration resources", + "required": [ + "value" + ], + "type": "object", + "properties": { + "nextLink": { + "description": "The Url of next result page.", + "type": "string" + }, + "value": { + "description": "Collection of items of type results.", + "uniqueItems": false, + "type": "array", + "items": { + "$ref": "#/definitions/KafkaConfiguration" + } + } + } + }, + "OperationList": { + "description": "Paged list of operation resources", + "required": [ + "value" + ], + "type": "object", + "properties": { + "nextLink": { + "description": "The Url of next result page.", + "type": "string" + }, + "value": { + "description": "Collection of items of type results.", + "uniqueItems": false, + "type": "array", + "items": { + "$ref": "#/definitions/Operation" + }, + "x-ms-identifiers": [ + "name" + ] + } + } + }, + "Operation": { + "description": "Operation resource", + "type": "object", + "properties": { + "display": { + "$ref": "#/definitions/OperationDisplay", + "description": "Properties on the operation" + }, + "isDataAction": { + "description": "Whether operation is a data action", + "type": "boolean" + }, + "name": { + "description": "Operation name for display purposes", + "type": "string" + }, + "origin": { + "description": "origin of the operation", + "type": "string" + }, + "properties": { + "$ref": "#/definitions/OperationProperties", + "description": "properties for the operation meta info", + "x-ms-client-flatten": true + } + } + }, + "OperationDisplay": { + "description": "The response model for get operation properties", + "type": "object", + "properties": { + "description": { + "description": "Description of the operation for display purposes", + "type": "string" + }, + "operation": { + "description": "Name of the operation for display purposes", + "type": "string" + }, + "provider": { + "description": "Name of the provider for display purposes", + "type": "string" + }, + "resource": { + "description": "Name of the resource type for display purposes", + "type": "string" + } + } + }, + "OperationProperties": { + "description": "properties on meta info", + "type": "object", + "properties": { + "serviceSpecification": { + "$ref": "#/definitions/OperationMetaServiceSpecification", + "description": "meta service specification" + } + } + }, + "OperationMetaServiceSpecification": { + "description": "The operation meta service specification", + "type": "object", + "properties": { + "logSpecifications": { + "description": "log specifications for the operation", + "uniqueItems": false, + "type": "array", + "items": { + "$ref": "#/definitions/OperationMetaLogSpecification" + }, + "x-ms-identifiers": [ + "name" + ] + }, + "metricSpecifications": { + "description": "metric specifications for the operation", + "uniqueItems": false, + "type": "array", + "items": { + "$ref": "#/definitions/OperationMetaMetricSpecification" + }, + "x-ms-identifiers": [ + "name" + ] + } + } + }, + "OperationMetaMetricSpecification": { + "description": "metric specifications for the operation", + "type": "object", + "properties": { + "aggregationType": { + "description": "aggregation type of metric", + "type": "string" + }, + "dimensions": { + "description": "properties for dimension", + "uniqueItems": false, + "type": "array", + "items": { + "$ref": "#/definitions/DimensionProperties" + }, + "x-ms-identifiers": [ + "name" + ] + }, + "displayDescription": { + "description": "description of the metric", + "type": "string" + }, + "displayName": { + "description": "localized name of the metric", + "type": "string" + }, + "enableRegionalMdmAccount": { + "description": "enable regional mdm account", + "type": "string" + }, + "internalMetricName": { + "description": "internal metric name", + "type": "string" + }, + "name": { + "description": "name of the metric", + "type": "string" + }, + "resourceIdDimensionNameOverride": { + "description": "dimension name use to replace resource id if specified", + "type": "string" + }, + "sourceMdmNamespace": { + "description": "Metric namespace.\r\nOnly set the namespace if different from the default value, \r\nleaving it empty makes it use the value from the ARM manifest.", + "type": "string" + }, + "supportedAggregationTypes": { + "description": "supported aggregation types", + "uniqueItems": false, + "type": "array", + "items": { + "type": "string" + } + }, + "supportedTimeGrainTypes": { + "description": "supported time grain types", + "uniqueItems": false, + "type": "array", + "items": { + "type": "string" + } + }, + "unit": { + "description": "units for the metric", + "type": "string" + } + } + }, + "OperationMetaLogSpecification": { + "description": "log specifications for operation api", + "type": "object", + "properties": { + "blobDuration": { + "description": "blob duration of the log", + "type": "string" + }, + "displayName": { + "description": "localized name of the log category", + "type": "string" + }, + "name": { + "description": "name of the log category", + "type": "string" + } + } + }, + "DimensionProperties": { + "description": "properties for dimension", + "type": "object", + "properties": { + "displayName": { + "description": "localized display name of the dimension to customer", + "type": "string" + }, + "name": { + "description": "dimension name", + "type": "string" + }, + "toBeExportedForCustomer": { + "description": "flag indicating whether this dimension should be included to the customer in Azure Monitor logs (aka Shoebox)", + "type": "boolean" + } + } + }, + "PrivateEndpointConnectionList": { + "description": "Paged list of private endpoint connections", + "required": [ + "value" + ], + "type": "object", + "properties": { + "nextLink": { + "description": "The Url of next result page.", + "type": "string" + }, + "value": { + "description": "Collection of items of type results.", + "uniqueItems": false, + "type": "array", + "items": { + "$ref": "#/definitions/PrivateEndpointConnection" + }, + "x-ms-identifiers": [ + "name" + ] + } + } + }, + "PrivateLinkResourceList": { + "description": "Paged list of private link resources", + "required": [ + "value" + ], + "type": "object", + "properties": { + "nextLink": { + "description": "The Url of next result page.", + "type": "string" + }, + "value": { + "description": "Collection of items of type results.", + "uniqueItems": false, + "type": "array", + "items": { + "$ref": "#/definitions/PrivateLinkResource" + } + } + } + }, + "PrivateLinkResource": { + "description": "A privately linkable resource.", + "type": "object", + "properties": { + "id": { + "description": "The private link resource identifier.", + "type": "string", + "readOnly": true + }, + "name": { + "description": "The private link resource name.", + "type": "string", + "readOnly": true + }, + "properties": { + "$ref": "#/definitions/PrivateLinkResourceProperties", + "description": "The private link resource properties.", + "readOnly": true + }, + "type": { + "description": "The private link resource type.", + "type": "string", + "readOnly": true + } + } + }, + "PrivateLinkResourceProperties": { + "description": "A privately linkable resource properties.", + "type": "object", + "properties": { + "groupId": { + "description": "The private link resource group identifier.", + "type": "string", + "readOnly": true + }, + "requiredMembers": { + "description": "This translates to how many Private IPs should be created for each privately linkable resource.", + "uniqueItems": false, + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "requiredZoneNames": { + "description": "The required zone names for private link resource.", + "uniqueItems": false, + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + } + } + }, + "CheckNameAvailabilityRequest": { + "description": "The request payload for CheckNameAvailability API", + "type": "object", + "properties": { + "name": { + "description": "Resource name to verify for availability", + "type": "string" + }, + "type": { + "description": "Fully qualified resource type which includes provider namespace", + "type": "string" + } + } + }, + "CheckNameAvailabilityResult": { + "description": "The response payload for CheckNameAvailability API", + "type": "object", + "properties": { + "message": { + "description": "Error message", + "type": "string" + }, + "nameAvailable": { + "description": "Indicates if name is valid and available.", + "type": "boolean" + }, + "reason": { + "description": "The reason the name is not available.", + "enum": [ + "Invalid", + "AlreadyExists" + ], + "type": "string", + "x-ms-enum": { + "name": "reason", + "modelAsString": true + } + } + } + }, + "UsageList": { + "description": "Response for usage get request", + "type": "object", + "properties": { + "value": { + "description": "Collection of usage values.", + "uniqueItems": false, + "type": "array", + "items": { + "$ref": "#/definitions/Usage" + } + }, + "nextLink": { + "description": "The Url of next result page.", + "type": "string" + } + } + }, + "Usage": { + "description": "Response for usage information", + "type": "object", + "properties": { + "currentValue": { + "format": "int32", + "description": "Current usage quota value", + "type": "integer", + "readOnly": true + }, + "id": { + "description": "Fully qualified ARM resource Id", + "type": "string", + "readOnly": true + }, + "limit": { + "format": "int32", + "description": "Usage quota limit", + "type": "integer", + "readOnly": true + }, + "name": { + "description": "Quota name", + "allOf": [ + { + "$ref": "#/definitions/QuotaName" + } + ], + "readOnly": true + }, + "unit": { + "description": "Quota usage unit.", + "type": "string", + "readOnly": true + } + } + }, + "QuotaName": { + "description": "Quota name", + "type": "object", + "properties": { + "localizedValue": { + "description": "Gets or sets the localized name value.", + "type": "string" + }, + "value": { + "description": "Gets or sets the name value.", + "type": "string" + } + } + }, + "TrackedResource": { + "description": "Azure ARM Tracked Resource", + "type": "object", + "properties": { + "id": { + "description": "Gets or sets the identifier.", + "type": "string", + "readOnly": true + }, + "identity": { + "$ref": "#/definitions/Identity", + "description": "Identity Info on the tracked resource" + }, + "location": { + "description": "Gets or sets the location.", + "type": "string" + }, + "name": { + "description": "Gets or sets the name.", + "type": "string", + "readOnly": true + }, + "systemData": { + "description": "Metadata pertaining to creation and last modification of the resource.", + "allOf": [ + { + "$ref": "#/definitions/SystemData" + } + ], + "readOnly": true + }, + "tags": { + "description": "Tags on the azure resource.", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "type": { + "description": "Gets or sets the type.", + "type": "string", + "readOnly": true + } + }, + "x-ms-azure-resource": true + }, + "ProxyResource": { + "description": "Proxy Azure Resource", + "type": "object", + "properties": { + "id": { + "description": "Gets or sets the identifier.", + "type": "string", + "readOnly": true + }, + "name": { + "description": "Gets or sets the name.", + "type": "string", + "readOnly": true + }, + "systemData": { + "description": "Metadata pertaining to creation and last modification of the resource.", + "allOf": [ + { + "$ref": "#/definitions/SystemData" + } + ], + "readOnly": true + }, + "type": { + "description": "Gets or sets the type.", + "type": "string", + "readOnly": true + } + }, + "x-ms-azure-resource": true + } + }, + "parameters": { + "subscriptionId": { + "name": "subscriptionId", + "in": "path", + "description": "The subscription identifier", + "required": true, + "type": "string" + }, + "api-version": { + "name": "api-version", + "in": "query", + "description": "The api version to use.", + "required": true, + "type": "string" + }, + "accountName": { + "name": "accountName", + "in": "path", + "description": "The name of the account.", + "required": true, + "type": "string", + "maxLength": 63, + "minLength": 3, + "pattern": "^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$", + "x-ms-parameter-location": "method" + }, + "resourceGroupName": { + "name": "resourceGroupName", + "in": "path", + "description": "The resource group name.", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + } + }, + "securityDefinitions": { + "azure_auth": { + "flow": "implicit", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "scopes": { + "user_impersonation": "impersonate your user account" + }, + "type": "oauth2", + "description": "Azure Active Directory OAuth2 Flow." + } + }, + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "tags": [] +} diff --git a/commands/testdata/case1/ConfigurationStoresCreateWithIdentity.json b/commands/testdata/TestGenerateCommand_identity/ConfigurationStoresCreateWithIdentity.json similarity index 100% rename from commands/testdata/case1/ConfigurationStoresCreateWithIdentity.json rename to commands/testdata/TestGenerateCommand_identity/ConfigurationStoresCreateWithIdentity.json diff --git a/commands/testdata/TestGenerateCommand_identity/expect/dependency.tf b/commands/testdata/TestGenerateCommand_identity/expect/dependency.tf new file mode 100644 index 00000000..f75aecdd --- /dev/null +++ b/commands/testdata/TestGenerateCommand_identity/expect/dependency.tf @@ -0,0 +1,15 @@ + +resource "azapi_resource" "resourceGroup" { + type = "Microsoft.Resources/resourceGroups@2020-06-01" + name = var.resource_name + location = var.location +} + +resource "azapi_resource" "userAssignedIdentity" { + type = "Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31" + parent_id = azapi_resource.resourceGroup.id + name = var.resource_name + location = var.location + schema_validation_enabled = false + response_export_values = ["*"] +} diff --git a/commands/testdata/TestGenerateCommand_identity/expect/provider.tf b/commands/testdata/TestGenerateCommand_identity/expect/provider.tf new file mode 100644 index 00000000..f490bc8d --- /dev/null +++ b/commands/testdata/TestGenerateCommand_identity/expect/provider.tf @@ -0,0 +1,35 @@ +terraform { + required_providers { + azapi = { + source = "Azure/azapi" + } + } +} + +provider "azurerm" { + features { + resource_group { + prevent_deletion_if_contains_resources = false + } + key_vault { + purge_soft_delete_on_destroy = false + purge_soft_deleted_keys_on_destroy = false + } + } + skip_provider_registration = true +} + +provider "azapi" { + skip_provider_registration = false +} + +variable "resource_name" { + type = string + default = "acctest2316" +} + +variable "location" { + type = string + default = "westeurope" +} + diff --git a/commands/testdata/TestGenerateCommand_identity/expect/testing.tf b/commands/testdata/TestGenerateCommand_identity/expect/testing.tf new file mode 100644 index 00000000..d0df71a9 --- /dev/null +++ b/commands/testdata/TestGenerateCommand_identity/expect/testing.tf @@ -0,0 +1,25 @@ + +resource "azapi_resource" "configurationStore" { + type = "Microsoft.AppConfiguration/configurationStores@2019-11-01-preview" + parent_id = azapi_resource.resourceGroup.id + name = var.resource_name + location = var.location + body = { + identity = { + type = "SystemAssigned, UserAssigned" + userAssignedIdentities = { + (azapi_resource.userAssignedIdentity.id) = { + } + } + } + sku = { + name = "Standard" + } + tags = { + myTag = "myTagValue" + } + } + schema_validation_enabled = false + ignore_casing = false + ignore_missing_property = false +} diff --git a/commands/testdata/case0/DatabaseSqlVulnerabilityAssessmentBaselineAdd.json b/commands/testdata/TestGenerateCommand_multiple/DatabaseSqlVulnerabilityAssessmentBaselineAdd.json similarity index 100% rename from commands/testdata/case0/DatabaseSqlVulnerabilityAssessmentBaselineAdd.json rename to commands/testdata/TestGenerateCommand_multiple/DatabaseSqlVulnerabilityAssessmentBaselineAdd.json diff --git a/commands/testdata/case0/DatabaseSqlVulnerabilityAssessmentGet.json b/commands/testdata/TestGenerateCommand_multiple/DatabaseSqlVulnerabilityAssessmentGet.json similarity index 100% rename from commands/testdata/case0/DatabaseSqlVulnerabilityAssessmentGet.json rename to commands/testdata/TestGenerateCommand_multiple/DatabaseSqlVulnerabilityAssessmentGet.json diff --git a/commands/testdata/TestGenerateCommand_multiple/expect/dependency.tf b/commands/testdata/TestGenerateCommand_multiple/expect/dependency.tf new file mode 100644 index 00000000..4c096c1e --- /dev/null +++ b/commands/testdata/TestGenerateCommand_multiple/expect/dependency.tf @@ -0,0 +1,41 @@ + +resource "azapi_resource" "resourceGroup" { + type = "Microsoft.Resources/resourceGroups@2020-06-01" + name = var.resource_name + location = var.location +} + +resource "azapi_resource" "server" { + type = "Microsoft.Sql/servers@2015-05-01-preview" + parent_id = azapi_resource.resourceGroup.id + name = var.resource_name + location = var.location + body = { + properties = { + administratorLogin = "acctestadmin" + administratorLoginPassword = "t2RX8A76GrnE4EKC" + version = "12.0" + } + } + schema_validation_enabled = false + response_export_values = ["*"] +} + +resource "azapi_resource" "database" { + type = "Microsoft.Sql/servers/databases@2014-04-01" + parent_id = azapi_resource.server.id + name = var.resource_name + location = var.location + body = { + properties = { + collation = "SQL_LATIN1_GENERAL_CP1_CI_AS" + createMode = "Default" + maxSizeBytes = "268435456000" + readScale = "Disabled" + requestedServiceObjectiveName = "S0" + zoneRedundant = false + } + } + schema_validation_enabled = false + response_export_values = ["*"] +} diff --git a/commands/testdata/TestGenerateCommand_multiple/expect/provider.tf b/commands/testdata/TestGenerateCommand_multiple/expect/provider.tf new file mode 100644 index 00000000..f490bc8d --- /dev/null +++ b/commands/testdata/TestGenerateCommand_multiple/expect/provider.tf @@ -0,0 +1,35 @@ +terraform { + required_providers { + azapi = { + source = "Azure/azapi" + } + } +} + +provider "azurerm" { + features { + resource_group { + prevent_deletion_if_contains_resources = false + } + key_vault { + purge_soft_delete_on_destroy = false + purge_soft_deleted_keys_on_destroy = false + } + } + skip_provider_registration = true +} + +provider "azapi" { + skip_provider_registration = false +} + +variable "resource_name" { + type = string + default = "acctest2316" +} + +variable "location" { + type = string + default = "westeurope" +} + diff --git a/commands/testdata/TestGenerateCommand_multiple/expect/testing.tf b/commands/testdata/TestGenerateCommand_multiple/expect/testing.tf new file mode 100644 index 00000000..6402d6ab --- /dev/null +++ b/commands/testdata/TestGenerateCommand_multiple/expect/testing.tf @@ -0,0 +1,37 @@ + +data "azapi_resource" "sqlVulnerabilityAssessment" { + type = "Microsoft.Sql/servers/databases/sqlVulnerabilityAssessments@2022-02-01-preview" + parent_id = azapi_resource.database.id + name = "default" +} + + +resource "azapi_resource" "baseline" { + type = "Microsoft.Sql/servers/databases/sqlVulnerabilityAssessments/baselines@2022-02-01-preview" + parent_id = data.azapi_resource.sqlVulnerabilityAssessment.id + name = var.resource_name + body = { + properties = { + latestScan = false + results = { + VA2063 = [ + [ + "AllowAll", + "0.0.0.0", + "255.255.255.255", + ], + ] + VA2065 = [ + [ + "AllowAll", + "0.0.0.0", + "255.255.255.255", + ], + ] + } + } + } + schema_validation_enabled = false + ignore_casing = false + ignore_missing_property = false +} diff --git a/commands/testdata/TestTestCommand_AllPass/main.tf b/commands/testdata/TestTestCommand_AllPass/main.tf new file mode 100644 index 00000000..e9db08a8 --- /dev/null +++ b/commands/testdata/TestTestCommand_AllPass/main.tf @@ -0,0 +1,44 @@ +terraform { + required_providers { + azapi = { + source = "Azure/azapi" + } + } +} + +provider "azapi" { + skip_provider_registration = false +} + +variable "resource_name" { + type = string + default = "acctest2030" +} + +variable "location" { + type = string + default = "westeurope" +} + +resource "azapi_resource" "resourceGroup" { + type = "Microsoft.Resources/resourceGroups@2020-06-01" + name = var.resource_name + location = var.location +} + +resource "azapi_resource" "automationAccount" { + type = "Microsoft.Automation/automationAccounts@2023-11-01" + parent_id = azapi_resource.resourceGroup.id + name = var.resource_name + location = var.location + body = { + properties = { + sku = { + name = "Basic" + } + } + } + schema_validation_enabled = false + ignore_casing = false + ignore_missing_property = false +} diff --git a/commands/testdata/TestTestCommand_BadRequest/main.tf b/commands/testdata/TestTestCommand_BadRequest/main.tf new file mode 100644 index 00000000..87a3bbad --- /dev/null +++ b/commands/testdata/TestTestCommand_BadRequest/main.tf @@ -0,0 +1,44 @@ +terraform { + required_providers { + azapi = { + source = "Azure/azapi" + } + } +} + +provider "azapi" { + skip_provider_registration = false +} + +variable "resource_name" { + type = string + default = "acctest2041" +} + +variable "location" { + type = string + default = "westeurope" +} + +resource "azapi_resource" "resourceGroup" { + type = "Microsoft.Resources/resourceGroups@2020-06-01" + name = var.resource_name + location = var.location +} + +resource "azapi_resource" "automationAccount" { + type = "Microsoft.Automation/automationAccounts@2023-11-01" + parent_id = azapi_resource.resourceGroup.id + name = "^^^" + location = var.location + body = { + properties = { + sku = { + name = "Basic" + } + } + } + schema_validation_enabled = false + ignore_casing = false + ignore_missing_property = false +} diff --git a/commands/testdata/TestTestCommand_Diff/main.tf b/commands/testdata/TestTestCommand_Diff/main.tf new file mode 100644 index 00000000..d1ba5091 --- /dev/null +++ b/commands/testdata/TestTestCommand_Diff/main.tf @@ -0,0 +1,44 @@ +terraform { + required_providers { + azapi = { + source = "Azure/azapi" + } + } +} + +provider "azapi" { + skip_provider_registration = false +} + +variable "resource_name" { + type = string + default = "acctest2033" +} + +variable "location" { + type = string + default = "westeurope" +} + +resource "azapi_resource" "resourceGroup" { + type = "Microsoft.Resources/resourceGroups@2020-06-01" + name = var.resource_name + location = var.location +} + +resource "azapi_resource" "automationAccount" { + type = "Microsoft.Automation/automationAccounts@2023-11-01" + parent_id = azapi_resource.resourceGroup.id + name = var.resource_name + location = var.location + body = { + properties = { + sku = { + name = "Free" + } + } + } + schema_validation_enabled = false + ignore_casing = false + ignore_missing_property = false +} diff --git a/commands/testdata/TestTestCommand_MissingProperties/main.tf b/commands/testdata/TestTestCommand_MissingProperties/main.tf new file mode 100644 index 00000000..0e10cf5f --- /dev/null +++ b/commands/testdata/TestTestCommand_MissingProperties/main.tf @@ -0,0 +1,45 @@ +terraform { + required_providers { + azapi = { + source = "Azure/azapi" + } + } +} + +provider "azapi" { + skip_provider_registration = false +} + +variable "resource_name" { + type = string + default = "acctest2039" +} + +variable "location" { + type = string + default = "westeurope" +} + +resource "azapi_resource" "resourceGroup" { + type = "Microsoft.Resources/resourceGroups@2020-06-01" + name = var.resource_name + location = var.location +} + +resource "azapi_resource" "automationAccount" { + type = "Microsoft.Automation/automationAccounts@2023-11-01" + parent_id = azapi_resource.resourceGroup.id + name = var.resource_name + location = var.location + body = { + properties = { + sku = { + family = "bar" + name = "Basic" + } + } + } + schema_validation_enabled = false + ignore_casing = false + ignore_missing_property = false +} diff --git a/resource/context.go b/resource/context.go index 23e510b8..853f5619 100644 --- a/resource/context.go +++ b/resource/context.go @@ -82,7 +82,7 @@ func NewContext(referenceResolvers []resolver.ReferenceResolver) *Context { return &c } -var r = rand.New(rand.NewSource(time.Now().UnixNano())) +var R = rand.New(rand.NewSource(time.Now().UnixNano())) func (c *Context) InitFile(content string) error { file, diags := hclwrite.ParseConfig([]byte(content), "", hcl.InitialPos) @@ -98,7 +98,7 @@ func (c *Context) InitFile(content string) error { case "location": locationVarBlock = block case "resource_name": - block.Body().SetAttributeValue("default", cty.StringVal(fmt.Sprintf("acctest%04d", r.Intn(10000)))) + block.Body().SetAttributeValue("default", cty.StringVal(fmt.Sprintf("acctest%04d", R.Intn(10000)))) } case "terraform": terraformBlock = block diff --git a/tf/terraform.go b/tf/terraform.go index c60569e7..58602a9a 100644 --- a/tf/terraform.go +++ b/tf/terraform.go @@ -20,6 +20,8 @@ type Terraform struct { const planfile = "tfplan" func NewTerraform(workingDirectory string, logEnabled bool) (*Terraform, error) { + os.Setenv("ARM_PROVIDER_ENHANCED_VALIDATION", "false") + os.Setenv("ARM_SKIP_PROVIDER_REGISTRATION", "true") execPath, err := FindTerraform(context.TODO()) if err != nil { return nil, err