From bbcd694da9660882bcc3c3dec285331872825b62 Mon Sep 17 00:00:00 2001 From: Heng Lu Date: Wed, 29 Nov 2023 15:49:46 +0800 Subject: [PATCH 1/7] New Resource: generating Kubernetes Fleet Member --- config/resources/containerservice.hcl | 13 ++++++++++++ .../components/testing/dependencies.go | 10 ++++++++++ .../testing/dependencies_template.go | 13 ++++++++++++ .../testing/dependencies_template_test.go | 20 +++++++++++++++++++ 4 files changed, 56 insertions(+) diff --git a/config/resources/containerservice.hcl b/config/resources/containerservice.hcl index 4fb708a8f2a..c5286bd4954 100644 --- a/config/resources/containerservice.hcl +++ b/config/resources/containerservice.hcl @@ -50,4 +50,17 @@ HERE } } } + + api "2023-10-15" { + package "FleetMembers" { + definition "kubernetes_fleet_member" { + id = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{memberName}" + display_name = "Kubernetes Fleet Member" + website_subcategory = "Container" + description = < Date: Wed, 29 Nov 2023 15:56:46 +0800 Subject: [PATCH 2/7] update --- config/resources/containerservice.hcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/resources/containerservice.hcl b/config/resources/containerservice.hcl index c5286bd4954..e1e705fa6fa 100644 --- a/config/resources/containerservice.hcl +++ b/config/resources/containerservice.hcl @@ -59,7 +59,7 @@ HERE website_subcategory = "Container" description = < Date: Thu, 1 Feb 2024 14:54:12 +0800 Subject: [PATCH 3/7] update --- config/resources/containerservice.hcl | 7 ++++--- .../components/testing/dependencies.go | 3 +-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/config/resources/containerservice.hcl b/config/resources/containerservice.hcl index e1e705fa6fa..f74d95034cd 100644 --- a/config/resources/containerservice.hcl +++ b/config/resources/containerservice.hcl @@ -57,9 +57,10 @@ HERE id = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{memberName}" display_name = "Kubernetes Fleet Member" website_subcategory = "Container" - description = < Date: Thu, 1 Feb 2024 15:05:21 +0800 Subject: [PATCH 4/7] add overrides for fleet_id --- config/resources/containerservice.hcl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/resources/containerservice.hcl b/config/resources/containerservice.hcl index 0d22f2ef1bc..0ba0a3e4ec3 100644 --- a/config/resources/containerservice.hcl +++ b/config/resources/containerservice.hcl @@ -57,6 +57,9 @@ HERE overrides "cluster_resource_id" { updated_name = "kubernetes_cluster_id" } + overrides "fleet_id" { + updated_name = "kubernetes_fleet_id" + } } } } From bfc6f2a7570a28565e7132c3e9a7bbf600b5c608 Mon Sep 17 00:00:00 2001 From: Heng Lu Date: Thu, 1 Feb 2024 15:06:58 +0800 Subject: [PATCH 5/7] update order --- .../importer-rest-api-specs/components/testing/dependencies.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/importer-rest-api-specs/components/testing/dependencies.go b/tools/importer-rest-api-specs/components/testing/dependencies.go index 9ca5bddfc3f..bb6386cec74 100644 --- a/tools/importer-rest-api-specs/components/testing/dependencies.go +++ b/tools/importer-rest-api-specs/components/testing/dependencies.go @@ -168,11 +168,11 @@ func DetermineDependencies(field, providerPrefix string, dependencies *testDepen dependencyMapping := map[string]dependencyDefinition{ "application_insights_id": {dependencies.setNeedsApplicationInsights, fmt.Sprintf("%s_application_insights.test.id", providerPrefix)}, "dev_center_id": {dependencies.setNeedsDevCenter, fmt.Sprintf("azurerm_dev_center.test.id")}, - "kubernetes_fleet_id": {dependencies.setNeedsKubernetesFleetManager, fmt.Sprintf("%s_kubernetes_fleet_manager.test.id", providerPrefix)}, "key_vault_id": {dependencies.setNeedsKeyVault, fmt.Sprintf("%s_key_vault.test.id", providerPrefix)}, "key_vault_access_policy_id": {dependencies.setNeedsKeyVaultAccessPolicy, fmt.Sprintf("%s_key_vault_access_policy.test.id", providerPrefix)}, "key_vault_key_id": {dependencies.setNeedsKeyVaultKey, fmt.Sprintf("%s_key_vault_key.test.id", providerPrefix)}, "kubernetes_cluster_id": {dependencies.setNeedsKubernetesCluster, fmt.Sprintf("%s_kubernetes_cluster.test.id", providerPrefix)}, + "kubernetes_fleet_id": {dependencies.setNeedsKubernetesFleetManager, fmt.Sprintf("%s_kubernetes_fleet_manager.test.id", providerPrefix)}, "machine_learning_workspace_id": {dependencies.setNeedsMachineLearningWorkspace, fmt.Sprintf("%s_machine_learning_workspace.test.id", providerPrefix)}, "network_interface_id": {dependencies.setNeedsNetworkInterface, fmt.Sprintf("%s_network_interface.test.id", providerPrefix)}, "storage_account_id": {dependencies.setNeedsStorageAccount, fmt.Sprintf("%s_storage_account.test.id", providerPrefix)}, From c880050ad2e87dbf5ae65527f2f3b04e02684732 Mon Sep 17 00:00:00 2001 From: Heng Lu Date: Fri, 2 Feb 2024 10:15:01 +0800 Subject: [PATCH 6/7] Empty-Commit From 898b29ec4f2cc74558481035c88d6bca97697813 Mon Sep 17 00:00:00 2001 From: Heng Lu Date: Tue, 6 Feb 2024 09:10:29 +0800 Subject: [PATCH 7/7] add common id --- .../resourceids/common_id_kubernetes_fleet.go | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tools/importer-rest-api-specs/components/parser/resourceids/common_id_kubernetes_fleet.go diff --git a/tools/importer-rest-api-specs/components/parser/resourceids/common_id_kubernetes_fleet.go b/tools/importer-rest-api-specs/components/parser/resourceids/common_id_kubernetes_fleet.go new file mode 100644 index 00000000000..72729ff23af --- /dev/null +++ b/tools/importer-rest-api-specs/components/parser/resourceids/common_id_kubernetes_fleet.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 = commonIdKubernetesFleet{} + +type commonIdKubernetesFleet struct{} + +func (c commonIdKubernetesFleet) id() models.ParsedResourceId { + name := "KubernetesFleet" + return models.ParsedResourceId{ + CommonAlias: &name, + Constants: map[string]resourcemanager.ConstantDetails{}, + Segments: []resourcemanager.ResourceIdSegment{ + models.StaticResourceIDSegment("subscriptions", "subscriptions"), + models.SubscriptionIDResourceIDSegment("subscriptionId"), + models.StaticResourceIDSegment("resourceGroups", "resourceGroups"), + models.ResourceGroupResourceIDSegment("resourceGroupName"), + models.StaticResourceIDSegment("providers", "providers"), + models.ResourceProviderResourceIDSegment("resourceProvider", "Microsoft.ContainerService"), + models.StaticResourceIDSegment("fleets", "fleets"), + models.UserSpecifiedResourceIDSegment("fleetName"), + }, + } +}