From 90f64989cef119e5d1be1c02e8234e84eaef01ab Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Mon, 16 Oct 2023 08:03:50 +0200 Subject: [PATCH] tools/importer-rest-api-specs: New Common IDs for Kusto Cluster and Kusto Database Dependent on https://github.com/hashicorp/go-azure-helpers/pull/186 --- .../resourceids/common_id_kusto_cluster.go | 28 +++++++++++++++++ .../resourceids/common_id_kusto_database.go | 30 +++++++++++++++++++ .../parser/resourceids/common_ids.go | 4 +++ 3 files changed, 62 insertions(+) create mode 100644 tools/importer-rest-api-specs/components/parser/resourceids/common_id_kusto_cluster.go create mode 100644 tools/importer-rest-api-specs/components/parser/resourceids/common_id_kusto_database.go diff --git a/tools/importer-rest-api-specs/components/parser/resourceids/common_id_kusto_cluster.go b/tools/importer-rest-api-specs/components/parser/resourceids/common_id_kusto_cluster.go new file mode 100644 index 00000000000..f6da8e0ca75 --- /dev/null +++ b/tools/importer-rest-api-specs/components/parser/resourceids/common_id_kusto_cluster.go @@ -0,0 +1,28 @@ +package resourceids + +import ( + "github.com/hashicorp/pandora/tools/importer-rest-api-specs/models" + "github.com/hashicorp/pandora/tools/sdk/resourcemanager" +) + +var _ commonIdMatcher = commonIdKustoCluster{} + +type commonIdKustoCluster struct{} + +func (c commonIdKustoCluster) id() models.ParsedResourceId { + name := "KustoCluster" + return models.ParsedResourceId{ + CommonAlias: &name, + Constants: map[string]resourcemanager.ConstantDetails{}, + Segments: []resourcemanager.ResourceIdSegment{ + models.StaticResourceIDSegment("staticSubscriptions", "subscriptions"), + models.SubscriptionIDResourceIDSegment("subscriptionId"), + models.StaticResourceIDSegment("staticResourceGroups", "resourceGroups"), + models.ResourceGroupResourceIDSegment("resourceGroupName"), + models.StaticResourceIDSegment("staticProviders", "providers"), + models.ResourceProviderResourceIDSegment("staticMicrosoftKusto", "Microsoft.Kusto"), + models.StaticResourceIDSegment("staticClusters", "clusters"), + models.UserSpecifiedResourceIDSegment("kustoClusterName"), + }, + } +} diff --git a/tools/importer-rest-api-specs/components/parser/resourceids/common_id_kusto_database.go b/tools/importer-rest-api-specs/components/parser/resourceids/common_id_kusto_database.go new file mode 100644 index 00000000000..238cc44b657 --- /dev/null +++ b/tools/importer-rest-api-specs/components/parser/resourceids/common_id_kusto_database.go @@ -0,0 +1,30 @@ +package resourceids + +import ( + "github.com/hashicorp/pandora/tools/importer-rest-api-specs/models" + "github.com/hashicorp/pandora/tools/sdk/resourcemanager" +) + +var _ commonIdMatcher = commonIdKustoDatabase{} + +type commonIdKustoDatabase struct{} + +func (c commonIdKustoDatabase) id() models.ParsedResourceId { + name := "KustoDatabase" + return models.ParsedResourceId{ + CommonAlias: &name, + Constants: map[string]resourcemanager.ConstantDetails{}, + Segments: []resourcemanager.ResourceIdSegment{ + models.StaticResourceIDSegment("staticSubscriptions", "subscriptions"), + models.SubscriptionIDResourceIDSegment("subscriptionId"), + models.StaticResourceIDSegment("staticResourceGroups", "resourceGroups"), + models.ResourceGroupResourceIDSegment("resourceGroupName"), + models.StaticResourceIDSegment("staticProviders", "providers"), + models.ResourceProviderResourceIDSegment("staticMicrosoftKusto", "Microsoft.Kusto"), + models.StaticResourceIDSegment("staticClusters", "clusters"), + models.UserSpecifiedResourceIDSegment("kustoClusterName"), + models.StaticResourceIDSegment("staticDatabases", "databases"), + models.UserSpecifiedResourceIDSegment("kustoDatabaseName"), + }, + } +} diff --git a/tools/importer-rest-api-specs/components/parser/resourceids/common_ids.go b/tools/importer-rest-api-specs/components/parser/resourceids/common_ids.go index 89ea374e884..39f34ee8794 100644 --- a/tools/importer-rest-api-specs/components/parser/resourceids/common_ids.go +++ b/tools/importer-rest-api-specs/components/parser/resourceids/common_ids.go @@ -24,6 +24,10 @@ var commonIdTypes = []commonIdMatcher{ commonIdVirtualNetwork{}, commonIdVPNConnection{}, + // Kusto + commonIdKustoCluster{}, + commonIdKustoDatabase{}, + // RP Specific commonIdCloudServicesIPConfiguration{}, commonIdCloudServicesPublicIPAddress{},