From f9165a4bfb4787e1c0a1e92872761de8282eed5c Mon Sep 17 00:00:00 2001 From: teowa <104055472+teowa@users.noreply.github.com> Date: Thu, 8 Aug 2024 09:17:44 +0000 Subject: [PATCH 01/17] wip --- ...kubernetes_provisioned_cluster_resource.go | 501 ++++++++++++++++++ ...netes_provisioned_cluster_resource_test.go | 1 + .../services/arckubernetes/client/client.go | 21 +- .../arckubernetes/testdata/readiness.ps1 | 61 +++ .../provisionedclusterinstances/README.md | 375 +++++++++++++ .../provisionedclusterinstances/client.go | 26 + .../provisionedclusterinstances/constants.go | 383 +++++++++++++ .../id_scopedagentpool.go | 122 +++++ .../method_agentpoolcreateorupdate.go | 75 +++ .../method_agentpooldelete.go | 70 +++ .../method_agentpoolget.go | 54 ++ ...ethod_agentpoollistbyprovisionedcluster.go | 106 ++++ .../method_deletekubernetesversions.go | 71 +++ .../method_deletevmskus.go | 71 +++ .../method_getkubernetesversions.go | 56 ++ .../method_getupgradeprofile.go | 56 ++ .../method_getvmskus.go | 56 ++ .../method_hybrididentitymetadatadelete.go | 71 +++ .../method_hybrididentitymetadataget.go | 56 ++ ...hod_hybrididentitymetadatalistbycluster.go | 106 ++++ .../method_hybrididentitymetadataput.go | 61 +++ .../method_kubernetesversionslist.go | 106 ++++ .../method_listadminkubeconfig.go | 72 +++ .../method_listuserkubeconfig.go | 72 +++ ...ovisionedclusterinstancescreateorupdate.go | 76 +++ ...ethod_provisionedclusterinstancesdelete.go | 71 +++ .../method_provisionedclusterinstancesget.go | 56 ++ .../method_provisionedclusterinstanceslist.go | 106 ++++ .../method_putkubernetesversions.go | 76 +++ .../method_putvmskus.go | 76 +++ .../method_vmskuslist.go | 106 ++++ .../model_addonstatusprofile.go | 11 + .../model_agentpool.go | 18 + .../model_agentpoolproperties.go | 20 + ...model_agentpoolprovisioningstatusstatus.go | 10 + .../model_agentpoolupdateprofile.go | 10 + .../model_cloudproviderprofile.go | 8 + ...cloudproviderprofileinfranetworkprofile.go | 8 + .../model_clustervmaccessprofile.go | 8 + .../model_controlplaneprofile.go | 10 + ...controlplaneprofilecontrolplaneendpoint.go | 8 + .../model_credentialresult.go | 9 + .../model_extendedlocation.go | 9 + .../model_hybrididentitymetadata.go | 16 + .../model_hybrididentitymetadataproperties.go | 10 + .../model_kubernetespatchversions.go | 9 + .../model_kubernetesversionprofile.go | 17 + ...odel_kubernetesversionprofileproperties.go | 9 + .../model_kubernetesversionproperties.go | 10 + .../model_kubernetesversionreadiness.go | 11 + .../model_linuxprofileproperties.go | 8 + .../model_linuxprofilepropertiesssh.go | 8 + ...uxprofilepropertiessshpublickeysinlined.go | 8 + .../model_listcredentialresponse.go | 13 + .../model_listcredentialresponseerror.go | 9 + .../model_listcredentialresponseproperties.go | 8 + .../model_namedagentpoolprofile.go | 19 + .../model_networkprofile.go | 10 + ...model_networkprofileloadbalancerprofile.go | 8 + .../model_provisionedcluster.go | 17 + .../model_provisionedclusterlicenseprofile.go | 8 + ...el_provisionedclusterpoolupgradeprofile.go | 10 + ...onedclusterpoolupgradeprofileproperties.go | 9 + .../model_provisionedclusterproperties.go | 19 + ...ionedclusterpropertiesautoscalerprofile.go | 24 + ...odel_provisionedclusterpropertiesstatus.go | 10 + .../model_provisionedclusterupgradeprofile.go | 16 + ...visionedclusterupgradeprofileproperties.go | 9 + .../model_storageprofile.go | 9 + .../model_storageprofilenfscsidriver.go | 8 + .../model_storageprofilesmbcsidriver.go | 8 + .../model_vmskucapabilities.go | 9 + .../model_vmskuprofile.go | 17 + .../model_vmskuprofileproperties.go | 9 + .../model_vmskuproperties.go | 12 + .../provisionedclusterinstances/predicates.go | 119 +++++ .../provisionedclusterinstances/version.go | 12 + vendor/modules.txt | 1 + 78 files changed, 3838 insertions(+), 6 deletions(-) create mode 100644 internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go create mode 100644 internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go create mode 100644 internal/services/arckubernetes/testdata/readiness.ps1 create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/id_scopedagentpool.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_agentpoolcreateorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_agentpooldelete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_agentpoolget.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_agentpoollistbyprovisionedcluster.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_deletekubernetesversions.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_deletevmskus.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_getkubernetesversions.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_getupgradeprofile.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_getvmskus.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_hybrididentitymetadatadelete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_hybrididentitymetadataget.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_hybrididentitymetadatalistbycluster.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_hybrididentitymetadataput.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_kubernetesversionslist.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_listadminkubeconfig.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_listuserkubeconfig.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_provisionedclusterinstancescreateorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_provisionedclusterinstancesdelete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_provisionedclusterinstancesget.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_provisionedclusterinstanceslist.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_putkubernetesversions.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_putvmskus.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_vmskuslist.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_addonstatusprofile.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_agentpool.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_agentpoolproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_agentpoolprovisioningstatusstatus.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_agentpoolupdateprofile.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_cloudproviderprofile.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_cloudproviderprofileinfranetworkprofile.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_clustervmaccessprofile.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_controlplaneprofile.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_controlplaneprofilecontrolplaneendpoint.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_credentialresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_extendedlocation.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_hybrididentitymetadata.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_hybrididentitymetadataproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_kubernetespatchversions.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_kubernetesversionprofile.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_kubernetesversionprofileproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_kubernetesversionproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_kubernetesversionreadiness.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_linuxprofileproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_linuxprofilepropertiesssh.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_linuxprofilepropertiessshpublickeysinlined.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_listcredentialresponse.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_listcredentialresponseerror.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_listcredentialresponseproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_namedagentpoolprofile.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_networkprofile.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_networkprofileloadbalancerprofile.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_provisionedcluster.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_provisionedclusterlicenseprofile.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_provisionedclusterpoolupgradeprofile.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_provisionedclusterpoolupgradeprofileproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_provisionedclusterproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_provisionedclusterpropertiesautoscalerprofile.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_provisionedclusterpropertiesstatus.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_provisionedclusterupgradeprofile.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_provisionedclusterupgradeprofileproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_storageprofile.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_storageprofilenfscsidriver.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_storageprofilesmbcsidriver.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_vmskucapabilities.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_vmskuprofile.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_vmskuprofileproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_vmskuproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/version.go diff --git a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go new file mode 100644 index 000000000000..de0e290c1eb6 --- /dev/null +++ b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go @@ -0,0 +1,501 @@ +package arckubernetes + +import ( + "context" + "fmt" + "regexp" + "strings" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2024-01-01/logicalnetworks" + "github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations" + "github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances" + "github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2024-01-01/connectedclusters" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" +) + +const ArcKubernetesProvisionedClusterInstanceResourceIdSuffix = "/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default" + +var ( + _ sdk.Resource = ArcKubernetesProvisionedClusterInstanceResource{} + _ sdk.ResourceWithUpdate = ArcKubernetesProvisionedClusterInstanceResource{} +) + +type ArcKubernetesProvisionedClusterInstanceResource struct{} + +func (ArcKubernetesProvisionedClusterInstanceResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return func(val interface{}, key string) (warns []string, errs []error) { + idRaw, ok := val.(string) + if !ok { + errs = append(errs, fmt.Errorf("expected `id` to be a string but got %+v", val)) + return + } + + scopeId := strings.TrimRight(idRaw, ArcKubernetesProvisionedClusterInstanceResourceIdSuffix) + if !strings.EqualFold(idRaw, scopeId+ArcKubernetesProvisionedClusterInstanceResourceIdSuffix) { + errs = append(errs, fmt.Errorf("expect `id` ends with %s, but got %s", ArcKubernetesProvisionedClusterInstanceResourceIdSuffix, idRaw)) + } + + if _, err := connectedclusters.ParseConnectedClusterID(scopeId); err != nil { + errs = append(errs, fmt.Errorf("parsing the scope of %q as a Connected Cluster ID: %+v", idRaw, err)) + return + } + + return + } +} + +func (ArcKubernetesProvisionedClusterInstanceResource) ResourceType() string { + return "azurerm_arc_kubernetes_provisioned_cluster_instance" +} + +func (ArcKubernetesProvisionedClusterInstanceResource) ModelObject() interface{} { + return &ArcKubernetesProvisionedClusterInstanceResourceModel{} +} + +type ArcKubernetesProvisionedClusterInstanceResourceModel struct { + Name string `tfschema:"name"` + ResourceGroupName string `tfschema:"resource_group_name"` + Location string `tfschema:"location"` + CustomLocationId string `tfschema:"custom_location_id"` + AgentPoolProfile []ProvisionedClusterInstanceAgentPoolProfile `tfschema:"agent_pool_profile"` + AutoScalerProfile []ProvisionedClusterInstanceAutoScalerProfile `tfschema:"auto_scaler_profile"` + VirtualSwitchName string `tfschema:"virtual_switch_name"` + Tags map[string]interface{} `tfschema:"tags"` +} + +type ProvisionedClusterInstanceAgentPoolProfile struct { + Count string `tfschema:"count"` + AutoScalingEnabled string `tfschema:"auto_scaling_enabled"` + MaxCount int64 `tfschema:"max_count"` + MaxPods int64 `tfschema:"max_pods"` + MinCount int64 `tfschema:"min_count"` + Name string `tfschema:"name"` + NodeLabel map[string]interface{} `tfschema:"node_label"` + NodeTaint []string `tfschema:"node_taint"` + OsSku string `tfschema:"os_sku"` + OsType string `tfschema:"os_type"` + VmSize string `tfschema:"vm_size"` +} + +type ProvisionedClusterInstanceAutoScalerProfile struct { + Balan +} + +type StackHCIRouteModel struct { + Name string `tfschema:"name"` + AddressPrefix string `tfschema:"address_prefix"` + NextHopIpAddress string `tfschema:"next_hop_ip_address"` +} + +func (ArcKubernetesProvisionedClusterInstanceResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringMatch( + regexp.MustCompile(`^[a-zA-Z0-9][\-\.\_a-zA-Z0-9]{0,62}[a-zA-Z0-9]$`), + "name must be between 2 and 64 characters and can only contain alphanumberic characters, hyphen, dot and underline", + ), + }, + + "resource_group_name": commonschema.ResourceGroupName(), + + "location": commonschema.Location(), + + "custom_location_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: customlocations.ValidateCustomLocationID, + }, + + "virtual_switch_name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "dns_servers": { + Type: pluginsdk.TypeList, + Optional: true, + ForceNew: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.IsIPv4Address, + }, + }, + + "subnet": { + Type: pluginsdk.TypeList, + Required: true, + ForceNew: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "ip_allocation_method": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice(logicalnetworks.PossibleValuesForIPAllocationMethodEnum(), false), + }, + + "address_prefix": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.IsCIDR, + }, + + "ip_pool": { + Type: pluginsdk.TypeList, + Optional: true, + ForceNew: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "start": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.IsIPv4Address, + }, + "end": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.IsIPv4Address, + }, + }, + }, + }, + + "route": { + Type: pluginsdk.TypeList, + Optional: true, + ForceNew: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringMatch( + regexp.MustCompile(`^[a-zA-Z0-9][\-\.\_a-zA-Z0-9]{0,78}[a-zA-Z0-9]$`), + "name must be between 2 and 80 characters and can only contain alphanumberic characters, hyphen, dot and underline", + ), + }, + + "address_prefix": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.IsCIDR, + }, + + "next_hop_ip_address": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.IsIPv4Address, + }, + }, + }, + }, + + "vlan_id": { + Type: pluginsdk.TypeInt, + Optional: true, + ForceNew: true, + ValidateFunc: validation.IntAtLeast(0), + }, + }, + }, + }, + + "tags": commonschema.Tags(), + } +} + +func (ArcKubernetesProvisionedClusterInstanceResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{} +} + +func (r ArcKubernetesProvisionedClusterInstanceResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.AzureStackHCI.LogicalNetworks + + var config ArcKubernetesProvisionedClusterInstanceResourceModel + if err := metadata.Decode(&config); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + subscriptionId := metadata.Client.Account.SubscriptionId + id := logicalnetworks.NewLogicalNetworkID(subscriptionId, config.ResourceGroupName, config.Name) + + existing, err := client.Get(ctx, id) + if err != nil && !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) + } + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + payload := provisionedclusterinstances.ID{ + Name: pointer.To(config.Name), + Location: location.Normalize(config.Location), + Tags: tags.Expand(config.Tags), + ExtendedLocation: &logicalnetworks.ExtendedLocation{ + Name: pointer.To(config.CustomLocationId), + Type: pointer.To(logicalnetworks.ExtendedLocationTypesCustomLocation), + }, + } + + if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + return fmt.Errorf("performing create %s: %+v", id, err) + } + + metadata.SetID(id) + + return nil + }, + } +} + +func (r ArcKubernetesProvisionedClusterInstanceResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.AzureStackHCI.LogicalNetworks + + id, err := logicalnetworks.ParseLogicalNetworkID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return metadata.MarkAsGone(id) + } + + return fmt.Errorf("retrieving %s: %+v", id, err) + } + + schema := ArcKubernetesProvisionedClusterInstanceResourceModel{ + Name: id.LogicalNetworkName, + ResourceGroupName: id.ResourceGroupName, + } + + if model := resp.Model; model != nil { + schema.Location = location.Normalize(model.Location) + schema.Tags = tags.Flatten(model.Tags) + + if model.ExtendedLocation != nil && model.ExtendedLocation.Name != nil { + customLocationId, err := customlocations.ParseCustomLocationIDInsensitively(*model.ExtendedLocation.Name) + if err != nil { + return err + } + + schema.CustomLocationId = customLocationId.ID() + } + + if props := model.Properties; props != nil { + schema.Subnet = flattenStackHCILogicalNetworkSubnet(props.Subnets) + schema.VirtualSwitchName = pointer.From(props.VMSwitchName) + + if props.DhcpOptions != nil { + schema.DNSServers = pointer.From(props.DhcpOptions.DnsServers) + } + } + } + + return metadata.Encode(&schema) + }, + } +} + +func (r ArcKubernetesProvisionedClusterInstanceResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.AzureStackHCI.LogicalNetworks + + id, err := logicalnetworks.ParseLogicalNetworkID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var model ArcKubernetesProvisionedClusterInstanceResourceModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + resp, err := client.Get(ctx, *id) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + parameters := resp.Model + if parameters == nil { + return fmt.Errorf("retrieving %s: `model` was nil", *id) + } + + if metadata.ResourceData.HasChange("tags") { + parameters.Tags = tags.Expand(model.Tags) + } + + if err := client.CreateOrUpdateThenPoll(ctx, *id, *parameters); err != nil { + return fmt.Errorf("updating %s: %+v", id, err) + } + return nil + }, + } +} + +func (r ArcKubernetesProvisionedClusterInstanceResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.AzureStackHCI.LogicalNetworks + + id, err := logicalnetworks.ParseLogicalNetworkID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + if err := client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) + } + + return nil + }, + } +} + +func expandStackHCILogicalNetworkSubnet(input []StackHCISubnetModel) *[]logicalnetworks.Subnet { + if len(input) == 0 { + return nil + } + + results := make([]logicalnetworks.Subnet, 0) + for _, v := range input { + results = append(results, logicalnetworks.Subnet{ + Properties: &logicalnetworks.SubnetPropertiesFormat{ + AddressPrefix: pointer.To(v.AddressPrefix), + IPAllocationMethod: pointer.To(logicalnetworks.IPAllocationMethodEnum(v.IpAllocationMethod)), + IPPools: expandStackHCILogicalNetworkIPPool(v.IpPool), + RouteTable: expandStackHCILogicalNetworkRouteTable(v.Route), + Vlan: pointer.To(v.VlanId), + }, + }) + } + + return &results +} + +func flattenStackHCILogicalNetworkSubnet(input *[]logicalnetworks.Subnet) []StackHCISubnetModel { + if input == nil { + return make([]StackHCISubnetModel, 0) + } + + results := make([]StackHCISubnetModel, 0) + for _, v := range *input { + if v.Properties != nil { + results = append(results, StackHCISubnetModel{ + AddressPrefix: pointer.From(v.Properties.AddressPrefix), + IpAllocationMethod: string(pointer.From(v.Properties.IPAllocationMethod)), + IpPool: flattenStackHCILogicalNetworkIPPool(v.Properties.IPPools), + Route: flattenStackHCILogicalNetworkRouteTable(v.Properties.RouteTable), + VlanId: pointer.From(v.Properties.Vlan), + }) + } + } + + return results +} + +func expandStackHCILogicalNetworkIPPool(input []StackHCIIPPoolModel) *[]logicalnetworks.IPPool { + if len(input) == 0 { + return nil + } + + results := make([]logicalnetworks.IPPool, 0) + for _, v := range input { + results = append(results, logicalnetworks.IPPool{ + Start: pointer.To(v.Start), + End: pointer.To(v.End), + }) + } + + return &results +} + +func flattenStackHCILogicalNetworkIPPool(input *[]logicalnetworks.IPPool) []StackHCIIPPoolModel { + if input == nil { + return make([]StackHCIIPPoolModel, 0) + } + + results := make([]StackHCIIPPoolModel, 0) + for _, v := range *input { + results = append(results, StackHCIIPPoolModel{ + Start: pointer.From(v.Start), + End: pointer.From(v.End), + }) + } + + return results +} + +func expandStackHCILogicalNetworkRouteTable(input []StackHCIRouteModel) *logicalnetworks.RouteTable { + if len(input) == 0 { + return nil + } + + routes := make([]logicalnetworks.Route, 0) + for _, v := range input { + routes = append(routes, logicalnetworks.Route{ + Name: pointer.To(v.Name), + Properties: &logicalnetworks.RoutePropertiesFormat{ + AddressPrefix: pointer.To(v.AddressPrefix), + NextHopIPAddress: pointer.To(v.NextHopIpAddress), + }, + }) + } + + return &logicalnetworks.RouteTable{ + Properties: &logicalnetworks.RouteTablePropertiesFormat{ + Routes: pointer.To(routes), + }, + } +} + +func flattenStackHCILogicalNetworkRouteTable(input *logicalnetworks.RouteTable) []StackHCIRouteModel { + if input == nil || input.Properties == nil || input.Properties.Routes == nil { + return make([]StackHCIRouteModel, 0) + } + + results := make([]StackHCIRouteModel, 0) + for _, v := range *input.Properties.Routes { + route := StackHCIRouteModel{ + Name: pointer.From(v.Name), + } + if v.Properties != nil { + route.AddressPrefix = pointer.From(v.Properties.AddressPrefix) + route.NextHopIpAddress = pointer.From(v.Properties.NextHopIPAddress) + } + results = append(results, route) + } + + return results +} diff --git a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go new file mode 100644 index 000000000000..8b137891791f --- /dev/null +++ b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go @@ -0,0 +1 @@ + diff --git a/internal/services/arckubernetes/client/client.go b/internal/services/arckubernetes/client/client.go index e9609c976da1..6ba9e4d9c817 100644 --- a/internal/services/arckubernetes/client/client.go +++ b/internal/services/arckubernetes/client/client.go @@ -6,6 +6,7 @@ package client import ( "fmt" + "github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances" "github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2024-01-01/connectedclusters" "github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/extensions" "github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration" @@ -13,9 +14,10 @@ import ( ) type Client struct { - ArcKubernetesClient *connectedclusters.ConnectedClustersClient - ExtensionsClient *extensions.ExtensionsClient - FluxConfigurationClient *fluxconfiguration.FluxConfigurationClient + ArcKubernetesClient *connectedclusters.ConnectedClustersClient + ExtensionsClient *extensions.ExtensionsClient + FluxConfigurationClient *fluxconfiguration.FluxConfigurationClient + ProvisionedClusterInstancesClient *provisionedclusterinstances.ProvisionedClusterInstancesClient } func NewClient(o *common.ClientOptions) (*Client, error) { @@ -37,9 +39,16 @@ func NewClient(o *common.ClientOptions) (*Client, error) { } o.Configure(fluxConfigurationClient.Client, o.Authorizers.ResourceManager) + provisionedClusterInstancesClientClient, err := provisionedclusterinstances.NewProvisionedClusterInstancesClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building ProvisionedClusterInstancesClient client: %+v", err) + } + o.Configure(provisionedClusterInstancesClientClient.Client, o.Authorizers.ResourceManager) + return &Client{ - ArcKubernetesClient: arcKubernetesClient, - ExtensionsClient: extensionsClient, - FluxConfigurationClient: fluxConfigurationClient, + ArcKubernetesClient: arcKubernetesClient, + ExtensionsClient: extensionsClient, + FluxConfigurationClient: fluxConfigurationClient, + ProvisionedClusterInstancesClient: provisionedClusterInstancesClientClient, }, nil } diff --git a/internal/services/arckubernetes/testdata/readiness.ps1 b/internal/services/arckubernetes/testdata/readiness.ps1 new file mode 100644 index 000000000000..5b844748f34a --- /dev/null +++ b/internal/services/arckubernetes/testdata/readiness.ps1 @@ -0,0 +1,61 @@ +# used in acctest for arc_kubernetes_provisioned_cluster_instance +# from https://github.com/Azure/Edge-infrastructure-quickstart-template/blob/main/modules/aks-arc/readiness.ps1 +param ( + [string] $customLocationResourceId, + [string] $kubernetesVersion, + [string] $osSku +) + +$ErrorActionPreference = "Stop" + +az extension add --name aksarc --yes + +while ($true) { + if ($env:ACTIONS_ID_TOKEN_REQUEST_TOKEN) { + $resp = Invoke-WebRequest -Uri "$env:ACTIONS_ID_TOKEN_REQUEST_URL&audience=api://AzureADTokenExchange" -Headers @{"Authorization" = "bearer $env:ACTIONS_ID_TOKEN_REQUEST_TOKEN"} + $token = (echo $resp.Content | ConvertFrom-Json).value + + az login --federated-token $token --tenant $env:ARM_TENANT_ID -u $env:ARM_CLIENT_ID --service-principal + az account set --subscription $env:ARM_SUBSCRIPTION_ID + } + + $state = az aksarc get-versions --custom-location $customLocationResourceId -o json --only-show-errors + $state = "$state".Replace("`n", "").Replace("`r", "").Replace("`t", "").Replace(" ", "") + echo $state + + $pos = $state.IndexOf("{") + $state = $state.Substring($pos) + $quotePos = $state.IndexOf('"') + + # Workaround for warning messages in the CLI + if ($quotePos -gt 1) { + echo "workaround for warning messages in the CLI" + $state = $state.Substring($quotePos) + $state = "{$state" + } + $ready = $false + + foreach ($version in (echo $state | ConvertFrom-Json).properties.values) { + if (!$kubernetesVersion.StartsWith($version.version)) { + continue + } + + if ($version.patchVersions.PSobject.Properties.name -notcontains $kubernetesVersion) { + break + } + + foreach ($readiness in $version.patchVersions.$kubernetesVersion.readiness) { + if ($readiness.osSku -eq $osSku) { + $ready = $readiness.ready + } + } + } + + if ($ready) { + echo "Kubernetes version $kubernetesVersion is ready for osSku $osSku." + break + } + + echo "Kubernetes version $kubernetesVersion is not ready yet for osSku $osSku. Retrying in 10 seconds." + sleep 10 +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/README.md new file mode 100644 index 000000000000..3d96beb4fe02 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/README.md @@ -0,0 +1,375 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances` Documentation + +The `provisionedclusterinstances` SDK allows for interaction with the Azure Resource Manager Service `hybridazurekubernetesservice` (API Version `2024-01-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +import "github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances" +``` + + +### Client Initialization + +```go +client := provisionedclusterinstances.NewProvisionedClusterInstancesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ProvisionedClusterInstancesClient.AgentPoolCreateOrUpdate` + +```go +ctx := context.TODO() +id := provisionedclusterinstances.NewScopedAgentPoolID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "agentPoolValue") + +payload := provisionedclusterinstances.AgentPool{ + // ... +} + + +if err := client.AgentPoolCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ProvisionedClusterInstancesClient.AgentPoolDelete` + +```go +ctx := context.TODO() +id := provisionedclusterinstances.NewScopedAgentPoolID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "agentPoolValue") + +if err := client.AgentPoolDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ProvisionedClusterInstancesClient.AgentPoolGet` + +```go +ctx := context.TODO() +id := provisionedclusterinstances.NewScopedAgentPoolID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "agentPoolValue") + +read, err := client.AgentPoolGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProvisionedClusterInstancesClient.AgentPoolListByProvisionedCluster` + +```go +ctx := context.TODO() +id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +// alternatively `client.AgentPoolListByProvisionedCluster(ctx, id)` can be used to do batched pagination +items, err := client.AgentPoolListByProvisionedClusterComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ProvisionedClusterInstancesClient.DeleteKubernetesVersions` + +```go +ctx := context.TODO() +id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +if err := client.DeleteKubernetesVersionsThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ProvisionedClusterInstancesClient.DeleteVMSkus` + +```go +ctx := context.TODO() +id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +if err := client.DeleteVMSkusThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ProvisionedClusterInstancesClient.GetKubernetesVersions` + +```go +ctx := context.TODO() +id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +read, err := client.GetKubernetesVersions(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProvisionedClusterInstancesClient.GetUpgradeProfile` + +```go +ctx := context.TODO() +id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +read, err := client.GetUpgradeProfile(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProvisionedClusterInstancesClient.GetVMSkus` + +```go +ctx := context.TODO() +id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +read, err := client.GetVMSkus(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProvisionedClusterInstancesClient.HybridIdentityMetadataDelete` + +```go +ctx := context.TODO() +id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +if err := client.HybridIdentityMetadataDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ProvisionedClusterInstancesClient.HybridIdentityMetadataGet` + +```go +ctx := context.TODO() +id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +read, err := client.HybridIdentityMetadataGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProvisionedClusterInstancesClient.HybridIdentityMetadataListByCluster` + +```go +ctx := context.TODO() +id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +// alternatively `client.HybridIdentityMetadataListByCluster(ctx, id)` can be used to do batched pagination +items, err := client.HybridIdentityMetadataListByClusterComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ProvisionedClusterInstancesClient.HybridIdentityMetadataPut` + +```go +ctx := context.TODO() +id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +payload := provisionedclusterinstances.HybridIdentityMetadata{ + // ... +} + + +read, err := client.HybridIdentityMetadataPut(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProvisionedClusterInstancesClient.KubernetesVersionsList` + +```go +ctx := context.TODO() +id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +// alternatively `client.KubernetesVersionsList(ctx, id)` can be used to do batched pagination +items, err := client.KubernetesVersionsListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ProvisionedClusterInstancesClient.ListAdminKubeconfig` + +```go +ctx := context.TODO() +id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +if err := client.ListAdminKubeconfigThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ProvisionedClusterInstancesClient.ListUserKubeconfig` + +```go +ctx := context.TODO() +id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +if err := client.ListUserKubeconfigThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ProvisionedClusterInstancesClient.ProvisionedClusterInstancesCreateOrUpdate` + +```go +ctx := context.TODO() +id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +payload := provisionedclusterinstances.ProvisionedCluster{ + // ... +} + + +if err := client.ProvisionedClusterInstancesCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ProvisionedClusterInstancesClient.ProvisionedClusterInstancesDelete` + +```go +ctx := context.TODO() +id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +if err := client.ProvisionedClusterInstancesDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ProvisionedClusterInstancesClient.ProvisionedClusterInstancesGet` + +```go +ctx := context.TODO() +id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +read, err := client.ProvisionedClusterInstancesGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProvisionedClusterInstancesClient.ProvisionedClusterInstancesList` + +```go +ctx := context.TODO() +id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +// alternatively `client.ProvisionedClusterInstancesList(ctx, id)` can be used to do batched pagination +items, err := client.ProvisionedClusterInstancesListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ProvisionedClusterInstancesClient.PutKubernetesVersions` + +```go +ctx := context.TODO() +id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +payload := provisionedclusterinstances.KubernetesVersionProfile{ + // ... +} + + +if err := client.PutKubernetesVersionsThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ProvisionedClusterInstancesClient.PutVMSkus` + +```go +ctx := context.TODO() +id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +payload := provisionedclusterinstances.VMSkuProfile{ + // ... +} + + +if err := client.PutVMSkusThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ProvisionedClusterInstancesClient.VMSkusList` + +```go +ctx := context.TODO() +id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +// alternatively `client.VMSkusList(ctx, id)` can be used to do batched pagination +items, err := client.VMSkusListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/client.go new file mode 100644 index 000000000000..6a00319ff27f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/client.go @@ -0,0 +1,26 @@ +package provisionedclusterinstances + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProvisionedClusterInstancesClient struct { + Client *resourcemanager.Client +} + +func NewProvisionedClusterInstancesClientWithBaseURI(sdkApi sdkEnv.Api) (*ProvisionedClusterInstancesClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "provisionedclusterinstances", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ProvisionedClusterInstancesClient: %+v", err) + } + + return &ProvisionedClusterInstancesClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/constants.go new file mode 100644 index 000000000000..a2569641fbf3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/constants.go @@ -0,0 +1,383 @@ +package provisionedclusterinstances + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AddonPhase string + +const ( + AddonPhaseDeleting AddonPhase = "deleting" + AddonPhaseFailed AddonPhase = "failed" + AddonPhasePending AddonPhase = "pending" + AddonPhaseProvisioned AddonPhase = "provisioned" + AddonPhaseProvisioning AddonPhase = "provisioning" + AddonPhaseProvisioningHelmChartInstalled AddonPhase = "provisioning {HelmChartInstalled}" + AddonPhaseProvisioningMSICertificateDownloaded AddonPhase = "provisioning {MSICertificateDownloaded}" + AddonPhaseUpgrading AddonPhase = "upgrading" +) + +func PossibleValuesForAddonPhase() []string { + return []string{ + string(AddonPhaseDeleting), + string(AddonPhaseFailed), + string(AddonPhasePending), + string(AddonPhaseProvisioned), + string(AddonPhaseProvisioning), + string(AddonPhaseProvisioningHelmChartInstalled), + string(AddonPhaseProvisioningMSICertificateDownloaded), + string(AddonPhaseUpgrading), + } +} + +func (s *AddonPhase) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAddonPhase(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAddonPhase(input string) (*AddonPhase, error) { + vals := map[string]AddonPhase{ + "deleting": AddonPhaseDeleting, + "failed": AddonPhaseFailed, + "pending": AddonPhasePending, + "provisioned": AddonPhaseProvisioned, + "provisioning": AddonPhaseProvisioning, + "provisioning {helmchartinstalled}": AddonPhaseProvisioningHelmChartInstalled, + "provisioning {msicertificatedownloaded}": AddonPhaseProvisioningMSICertificateDownloaded, + "upgrading": AddonPhaseUpgrading, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AddonPhase(input) + return &out, nil +} + +type AzureHybridBenefit string + +const ( + AzureHybridBenefitFalse AzureHybridBenefit = "False" + AzureHybridBenefitNotApplicable AzureHybridBenefit = "NotApplicable" + AzureHybridBenefitTrue AzureHybridBenefit = "True" +) + +func PossibleValuesForAzureHybridBenefit() []string { + return []string{ + string(AzureHybridBenefitFalse), + string(AzureHybridBenefitNotApplicable), + string(AzureHybridBenefitTrue), + } +} + +func (s *AzureHybridBenefit) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAzureHybridBenefit(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAzureHybridBenefit(input string) (*AzureHybridBenefit, error) { + vals := map[string]AzureHybridBenefit{ + "false": AzureHybridBenefitFalse, + "notapplicable": AzureHybridBenefitNotApplicable, + "true": AzureHybridBenefitTrue, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AzureHybridBenefit(input) + return &out, nil +} + +type Expander string + +const ( + ExpanderLeastNegativewaste Expander = "least-waste" + ExpanderMostNegativepods Expander = "most-pods" + ExpanderPriority Expander = "priority" + ExpanderRandom Expander = "random" +) + +func PossibleValuesForExpander() []string { + return []string{ + string(ExpanderLeastNegativewaste), + string(ExpanderMostNegativepods), + string(ExpanderPriority), + string(ExpanderRandom), + } +} + +func (s *Expander) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseExpander(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseExpander(input string) (*Expander, error) { + vals := map[string]Expander{ + "least-waste": ExpanderLeastNegativewaste, + "most-pods": ExpanderMostNegativepods, + "priority": ExpanderPriority, + "random": ExpanderRandom, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Expander(input) + return &out, nil +} + +type ExtendedLocationTypes string + +const ( + ExtendedLocationTypesCustomLocation ExtendedLocationTypes = "CustomLocation" +) + +func PossibleValuesForExtendedLocationTypes() []string { + return []string{ + string(ExtendedLocationTypesCustomLocation), + } +} + +func (s *ExtendedLocationTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseExtendedLocationTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseExtendedLocationTypes(input string) (*ExtendedLocationTypes, error) { + vals := map[string]ExtendedLocationTypes{ + "customlocation": ExtendedLocationTypesCustomLocation, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ExtendedLocationTypes(input) + return &out, nil +} + +type NetworkPolicy string + +const ( + NetworkPolicyCalico NetworkPolicy = "calico" +) + +func PossibleValuesForNetworkPolicy() []string { + return []string{ + string(NetworkPolicyCalico), + } +} + +func (s *NetworkPolicy) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkPolicy(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseNetworkPolicy(input string) (*NetworkPolicy, error) { + vals := map[string]NetworkPolicy{ + "calico": NetworkPolicyCalico, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NetworkPolicy(input) + return &out, nil +} + +type OSSKU string + +const ( + OSSKUCBLMariner OSSKU = "CBLMariner" + OSSKUWindowsTwoZeroOneNine OSSKU = "Windows2019" + OSSKUWindowsTwoZeroTwoTwo OSSKU = "Windows2022" +) + +func PossibleValuesForOSSKU() []string { + return []string{ + string(OSSKUCBLMariner), + string(OSSKUWindowsTwoZeroOneNine), + string(OSSKUWindowsTwoZeroTwoTwo), + } +} + +func (s *OSSKU) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOSSKU(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOSSKU(input string) (*OSSKU, error) { + vals := map[string]OSSKU{ + "cblmariner": OSSKUCBLMariner, + "windows2019": OSSKUWindowsTwoZeroOneNine, + "windows2022": OSSKUWindowsTwoZeroTwoTwo, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OSSKU(input) + return &out, nil +} + +type OsType string + +const ( + OsTypeLinux OsType = "Linux" + OsTypeWindows OsType = "Windows" +) + +func PossibleValuesForOsType() []string { + return []string{ + string(OsTypeLinux), + string(OsTypeWindows), + } +} + +func (s *OsType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOsType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOsType(input string) (*OsType, error) { + vals := map[string]OsType{ + "linux": OsTypeLinux, + "windows": OsTypeWindows, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OsType(input) + return &out, nil +} + +type ResourceProvisioningState string + +const ( + ResourceProvisioningStateAccepted ResourceProvisioningState = "Accepted" + ResourceProvisioningStateCanceled ResourceProvisioningState = "Canceled" + ResourceProvisioningStateCreating ResourceProvisioningState = "Creating" + ResourceProvisioningStateDeleting ResourceProvisioningState = "Deleting" + ResourceProvisioningStateFailed ResourceProvisioningState = "Failed" + ResourceProvisioningStatePending ResourceProvisioningState = "Pending" + ResourceProvisioningStateSucceeded ResourceProvisioningState = "Succeeded" + ResourceProvisioningStateUpdating ResourceProvisioningState = "Updating" + ResourceProvisioningStateUpgrading ResourceProvisioningState = "Upgrading" +) + +func PossibleValuesForResourceProvisioningState() []string { + return []string{ + string(ResourceProvisioningStateAccepted), + string(ResourceProvisioningStateCanceled), + string(ResourceProvisioningStateCreating), + string(ResourceProvisioningStateDeleting), + string(ResourceProvisioningStateFailed), + string(ResourceProvisioningStatePending), + string(ResourceProvisioningStateSucceeded), + string(ResourceProvisioningStateUpdating), + string(ResourceProvisioningStateUpgrading), + } +} + +func (s *ResourceProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseResourceProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseResourceProvisioningState(input string) (*ResourceProvisioningState, error) { + vals := map[string]ResourceProvisioningState{ + "accepted": ResourceProvisioningStateAccepted, + "canceled": ResourceProvisioningStateCanceled, + "creating": ResourceProvisioningStateCreating, + "deleting": ResourceProvisioningStateDeleting, + "failed": ResourceProvisioningStateFailed, + "pending": ResourceProvisioningStatePending, + "succeeded": ResourceProvisioningStateSucceeded, + "updating": ResourceProvisioningStateUpdating, + "upgrading": ResourceProvisioningStateUpgrading, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ResourceProvisioningState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/id_scopedagentpool.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/id_scopedagentpool.go new file mode 100644 index 000000000000..f999b2720cae --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/id_scopedagentpool.go @@ -0,0 +1,122 @@ +package provisionedclusterinstances + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&ScopedAgentPoolId{}) +} + +var _ resourceids.ResourceId = &ScopedAgentPoolId{} + +// ScopedAgentPoolId is a struct representing the Resource ID for a Scoped Agent Pool +type ScopedAgentPoolId struct { + ConnectedClusterResourceUri string + AgentPoolName string +} + +// NewScopedAgentPoolID returns a new ScopedAgentPoolId struct +func NewScopedAgentPoolID(connectedClusterResourceUri string, agentPoolName string) ScopedAgentPoolId { + return ScopedAgentPoolId{ + ConnectedClusterResourceUri: connectedClusterResourceUri, + AgentPoolName: agentPoolName, + } +} + +// ParseScopedAgentPoolID parses 'input' into a ScopedAgentPoolId +func ParseScopedAgentPoolID(input string) (*ScopedAgentPoolId, error) { + parser := resourceids.NewParserFromResourceIdType(&ScopedAgentPoolId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ScopedAgentPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseScopedAgentPoolIDInsensitively parses 'input' case-insensitively into a ScopedAgentPoolId +// note: this method should only be used for API response data and not user input +func ParseScopedAgentPoolIDInsensitively(input string) (*ScopedAgentPoolId, error) { + parser := resourceids.NewParserFromResourceIdType(&ScopedAgentPoolId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ScopedAgentPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ScopedAgentPoolId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ConnectedClusterResourceUri, ok = input.Parsed["connectedClusterResourceUri"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectedClusterResourceUri", input) + } + + if id.AgentPoolName, ok = input.Parsed["agentPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "agentPoolName", input) + } + + return nil +} + +// ValidateScopedAgentPoolID checks that 'input' can be parsed as a Scoped Agent Pool ID +func ValidateScopedAgentPoolID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseScopedAgentPoolID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Scoped Agent Pool ID +func (id ScopedAgentPoolId) ID() string { + fmtString := "/%s/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/agentPools/%s" + return fmt.Sprintf(fmtString, strings.TrimPrefix(id.ConnectedClusterResourceUri, "/"), id.AgentPoolName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Scoped Agent Pool ID +func (id ScopedAgentPoolId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.ScopeSegment("connectedClusterResourceUri", "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftHybridContainerService", "Microsoft.HybridContainerService", "Microsoft.HybridContainerService"), + resourceids.StaticSegment("staticProvisionedClusterInstances", "provisionedClusterInstances", "provisionedClusterInstances"), + resourceids.StaticSegment("staticDefault", "default", "default"), + resourceids.StaticSegment("staticAgentPools", "agentPools", "agentPools"), + resourceids.UserSpecifiedSegment("agentPoolName", "agentPoolValue"), + } +} + +// String returns a human-readable description of this Scoped Agent Pool ID +func (id ScopedAgentPoolId) String() string { + components := []string{ + fmt.Sprintf("Connected Cluster Resource Uri: %q", id.ConnectedClusterResourceUri), + fmt.Sprintf("Agent Pool Name: %q", id.AgentPoolName), + } + return fmt.Sprintf("Scoped Agent Pool (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_agentpoolcreateorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_agentpoolcreateorupdate.go new file mode 100644 index 000000000000..c3c28ad2d81f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_agentpoolcreateorupdate.go @@ -0,0 +1,75 @@ +package provisionedclusterinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AgentPoolCreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *AgentPool +} + +// AgentPoolCreateOrUpdate ... +func (c ProvisionedClusterInstancesClient) AgentPoolCreateOrUpdate(ctx context.Context, id ScopedAgentPoolId, input AgentPool) (result AgentPoolCreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// AgentPoolCreateOrUpdateThenPoll performs AgentPoolCreateOrUpdate then polls until it's completed +func (c ProvisionedClusterInstancesClient) AgentPoolCreateOrUpdateThenPoll(ctx context.Context, id ScopedAgentPoolId, input AgentPool) error { + result, err := c.AgentPoolCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing AgentPoolCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after AgentPoolCreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_agentpooldelete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_agentpooldelete.go new file mode 100644 index 000000000000..a91b77fa5187 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_agentpooldelete.go @@ -0,0 +1,70 @@ +package provisionedclusterinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AgentPoolDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// AgentPoolDelete ... +func (c ProvisionedClusterInstancesClient) AgentPoolDelete(ctx context.Context, id ScopedAgentPoolId) (result AgentPoolDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// AgentPoolDeleteThenPoll performs AgentPoolDelete then polls until it's completed +func (c ProvisionedClusterInstancesClient) AgentPoolDeleteThenPoll(ctx context.Context, id ScopedAgentPoolId) error { + result, err := c.AgentPoolDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing AgentPoolDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after AgentPoolDelete: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_agentpoolget.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_agentpoolget.go new file mode 100644 index 000000000000..cbc387e3c213 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_agentpoolget.go @@ -0,0 +1,54 @@ +package provisionedclusterinstances + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AgentPoolGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AgentPool +} + +// AgentPoolGet ... +func (c ProvisionedClusterInstancesClient) AgentPoolGet(ctx context.Context, id ScopedAgentPoolId) (result AgentPoolGetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model AgentPool + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_agentpoollistbyprovisionedcluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_agentpoollistbyprovisionedcluster.go new file mode 100644 index 000000000000..a68a50ee246c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_agentpoollistbyprovisionedcluster.go @@ -0,0 +1,106 @@ +package provisionedclusterinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AgentPoolListByProvisionedClusterOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]AgentPool +} + +type AgentPoolListByProvisionedClusterCompleteResult struct { + LatestHttpResponse *http.Response + Items []AgentPool +} + +type AgentPoolListByProvisionedClusterCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *AgentPoolListByProvisionedClusterCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// AgentPoolListByProvisionedCluster ... +func (c ProvisionedClusterInstancesClient) AgentPoolListByProvisionedCluster(ctx context.Context, id commonids.ScopeId) (result AgentPoolListByProvisionedClusterOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &AgentPoolListByProvisionedClusterCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/agentPools", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]AgentPool `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// AgentPoolListByProvisionedClusterComplete retrieves all the results into a single object +func (c ProvisionedClusterInstancesClient) AgentPoolListByProvisionedClusterComplete(ctx context.Context, id commonids.ScopeId) (AgentPoolListByProvisionedClusterCompleteResult, error) { + return c.AgentPoolListByProvisionedClusterCompleteMatchingPredicate(ctx, id, AgentPoolOperationPredicate{}) +} + +// AgentPoolListByProvisionedClusterCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ProvisionedClusterInstancesClient) AgentPoolListByProvisionedClusterCompleteMatchingPredicate(ctx context.Context, id commonids.ScopeId, predicate AgentPoolOperationPredicate) (result AgentPoolListByProvisionedClusterCompleteResult, err error) { + items := make([]AgentPool, 0) + + resp, err := c.AgentPoolListByProvisionedCluster(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = AgentPoolListByProvisionedClusterCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_deletekubernetesversions.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_deletekubernetesversions.go new file mode 100644 index 000000000000..f2fe944848aa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_deletekubernetesversions.go @@ -0,0 +1,71 @@ +package provisionedclusterinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteKubernetesVersionsOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// DeleteKubernetesVersions ... +func (c ProvisionedClusterInstancesClient) DeleteKubernetesVersions(ctx context.Context, id commonids.ScopeId) (result DeleteKubernetesVersionsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + Path: fmt.Sprintf("%s/providers/Microsoft.HybridContainerService/kubernetesVersions/default", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteKubernetesVersionsThenPoll performs DeleteKubernetesVersions then polls until it's completed +func (c ProvisionedClusterInstancesClient) DeleteKubernetesVersionsThenPoll(ctx context.Context, id commonids.ScopeId) error { + result, err := c.DeleteKubernetesVersions(ctx, id) + if err != nil { + return fmt.Errorf("performing DeleteKubernetesVersions: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after DeleteKubernetesVersions: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_deletevmskus.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_deletevmskus.go new file mode 100644 index 000000000000..2092c810f005 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_deletevmskus.go @@ -0,0 +1,71 @@ +package provisionedclusterinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteVMSkusOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// DeleteVMSkus ... +func (c ProvisionedClusterInstancesClient) DeleteVMSkus(ctx context.Context, id commonids.ScopeId) (result DeleteVMSkusOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + Path: fmt.Sprintf("%s/providers/Microsoft.HybridContainerService/skus/default", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteVMSkusThenPoll performs DeleteVMSkus then polls until it's completed +func (c ProvisionedClusterInstancesClient) DeleteVMSkusThenPoll(ctx context.Context, id commonids.ScopeId) error { + result, err := c.DeleteVMSkus(ctx, id) + if err != nil { + return fmt.Errorf("performing DeleteVMSkus: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after DeleteVMSkus: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_getkubernetesversions.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_getkubernetesversions.go new file mode 100644 index 000000000000..b47cd7964274 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_getkubernetesversions.go @@ -0,0 +1,56 @@ +package provisionedclusterinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetKubernetesVersionsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *KubernetesVersionProfile +} + +// GetKubernetesVersions ... +func (c ProvisionedClusterInstancesClient) GetKubernetesVersions(ctx context.Context, id commonids.ScopeId) (result GetKubernetesVersionsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.HybridContainerService/kubernetesVersions/default", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model KubernetesVersionProfile + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_getupgradeprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_getupgradeprofile.go new file mode 100644 index 000000000000..2279556e2ece --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_getupgradeprofile.go @@ -0,0 +1,56 @@ +package provisionedclusterinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetUpgradeProfileOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ProvisionedClusterUpgradeProfile +} + +// GetUpgradeProfile ... +func (c ProvisionedClusterInstancesClient) GetUpgradeProfile(ctx context.Context, id commonids.ScopeId) (result GetUpgradeProfileOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/upgradeProfiles/default", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model ProvisionedClusterUpgradeProfile + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_getvmskus.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_getvmskus.go new file mode 100644 index 000000000000..16d298704b66 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_getvmskus.go @@ -0,0 +1,56 @@ +package provisionedclusterinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetVMSkusOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *VMSkuProfile +} + +// GetVMSkus ... +func (c ProvisionedClusterInstancesClient) GetVMSkus(ctx context.Context, id commonids.ScopeId) (result GetVMSkusOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.HybridContainerService/skus/default", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model VMSkuProfile + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_hybrididentitymetadatadelete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_hybrididentitymetadatadelete.go new file mode 100644 index 000000000000..8d6e9cdc7cae --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_hybrididentitymetadatadelete.go @@ -0,0 +1,71 @@ +package provisionedclusterinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HybridIdentityMetadataDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// HybridIdentityMetadataDelete ... +func (c ProvisionedClusterInstancesClient) HybridIdentityMetadataDelete(ctx context.Context, id commonids.ScopeId) (result HybridIdentityMetadataDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + Path: fmt.Sprintf("%s/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/hybridIdentityMetadata/default", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// HybridIdentityMetadataDeleteThenPoll performs HybridIdentityMetadataDelete then polls until it's completed +func (c ProvisionedClusterInstancesClient) HybridIdentityMetadataDeleteThenPoll(ctx context.Context, id commonids.ScopeId) error { + result, err := c.HybridIdentityMetadataDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing HybridIdentityMetadataDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after HybridIdentityMetadataDelete: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_hybrididentitymetadataget.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_hybrididentitymetadataget.go new file mode 100644 index 000000000000..fe29c34d4920 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_hybrididentitymetadataget.go @@ -0,0 +1,56 @@ +package provisionedclusterinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HybridIdentityMetadataGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *HybridIdentityMetadata +} + +// HybridIdentityMetadataGet ... +func (c ProvisionedClusterInstancesClient) HybridIdentityMetadataGet(ctx context.Context, id commonids.ScopeId) (result HybridIdentityMetadataGetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/hybridIdentityMetadata/default", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model HybridIdentityMetadata + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_hybrididentitymetadatalistbycluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_hybrididentitymetadatalistbycluster.go new file mode 100644 index 000000000000..173a87777413 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_hybrididentitymetadatalistbycluster.go @@ -0,0 +1,106 @@ +package provisionedclusterinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HybridIdentityMetadataListByClusterOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]HybridIdentityMetadata +} + +type HybridIdentityMetadataListByClusterCompleteResult struct { + LatestHttpResponse *http.Response + Items []HybridIdentityMetadata +} + +type HybridIdentityMetadataListByClusterCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *HybridIdentityMetadataListByClusterCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// HybridIdentityMetadataListByCluster ... +func (c ProvisionedClusterInstancesClient) HybridIdentityMetadataListByCluster(ctx context.Context, id commonids.ScopeId) (result HybridIdentityMetadataListByClusterOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &HybridIdentityMetadataListByClusterCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/hybridIdentityMetadata", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]HybridIdentityMetadata `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// HybridIdentityMetadataListByClusterComplete retrieves all the results into a single object +func (c ProvisionedClusterInstancesClient) HybridIdentityMetadataListByClusterComplete(ctx context.Context, id commonids.ScopeId) (HybridIdentityMetadataListByClusterCompleteResult, error) { + return c.HybridIdentityMetadataListByClusterCompleteMatchingPredicate(ctx, id, HybridIdentityMetadataOperationPredicate{}) +} + +// HybridIdentityMetadataListByClusterCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ProvisionedClusterInstancesClient) HybridIdentityMetadataListByClusterCompleteMatchingPredicate(ctx context.Context, id commonids.ScopeId, predicate HybridIdentityMetadataOperationPredicate) (result HybridIdentityMetadataListByClusterCompleteResult, err error) { + items := make([]HybridIdentityMetadata, 0) + + resp, err := c.HybridIdentityMetadataListByCluster(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = HybridIdentityMetadataListByClusterCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_hybrididentitymetadataput.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_hybrididentitymetadataput.go new file mode 100644 index 000000000000..10a89ea87df7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_hybrididentitymetadataput.go @@ -0,0 +1,61 @@ +package provisionedclusterinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HybridIdentityMetadataPutOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *HybridIdentityMetadata +} + +// HybridIdentityMetadataPut ... +func (c ProvisionedClusterInstancesClient) HybridIdentityMetadataPut(ctx context.Context, id commonids.ScopeId, input HybridIdentityMetadata) (result HybridIdentityMetadataPutOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/hybridIdentityMetadata/default", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model HybridIdentityMetadata + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_kubernetesversionslist.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_kubernetesversionslist.go new file mode 100644 index 000000000000..2f3de43b89a3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_kubernetesversionslist.go @@ -0,0 +1,106 @@ +package provisionedclusterinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KubernetesVersionsListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]KubernetesVersionProfile +} + +type KubernetesVersionsListCompleteResult struct { + LatestHttpResponse *http.Response + Items []KubernetesVersionProfile +} + +type KubernetesVersionsListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *KubernetesVersionsListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// KubernetesVersionsList ... +func (c ProvisionedClusterInstancesClient) KubernetesVersionsList(ctx context.Context, id commonids.ScopeId) (result KubernetesVersionsListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &KubernetesVersionsListCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.HybridContainerService/kubernetesVersions", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]KubernetesVersionProfile `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// KubernetesVersionsListComplete retrieves all the results into a single object +func (c ProvisionedClusterInstancesClient) KubernetesVersionsListComplete(ctx context.Context, id commonids.ScopeId) (KubernetesVersionsListCompleteResult, error) { + return c.KubernetesVersionsListCompleteMatchingPredicate(ctx, id, KubernetesVersionProfileOperationPredicate{}) +} + +// KubernetesVersionsListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ProvisionedClusterInstancesClient) KubernetesVersionsListCompleteMatchingPredicate(ctx context.Context, id commonids.ScopeId, predicate KubernetesVersionProfileOperationPredicate) (result KubernetesVersionsListCompleteResult, err error) { + items := make([]KubernetesVersionProfile, 0) + + resp, err := c.KubernetesVersionsList(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = KubernetesVersionsListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_listadminkubeconfig.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_listadminkubeconfig.go new file mode 100644 index 000000000000..50c24cc9973d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_listadminkubeconfig.go @@ -0,0 +1,72 @@ +package provisionedclusterinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListAdminKubeconfigOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *ListCredentialResponse +} + +// ListAdminKubeconfig ... +func (c ProvisionedClusterInstancesClient) ListAdminKubeconfig(ctx context.Context, id commonids.ScopeId) (result ListAdminKubeconfigOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/listAdminKubeconfig", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// ListAdminKubeconfigThenPoll performs ListAdminKubeconfig then polls until it's completed +func (c ProvisionedClusterInstancesClient) ListAdminKubeconfigThenPoll(ctx context.Context, id commonids.ScopeId) error { + result, err := c.ListAdminKubeconfig(ctx, id) + if err != nil { + return fmt.Errorf("performing ListAdminKubeconfig: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ListAdminKubeconfig: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_listuserkubeconfig.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_listuserkubeconfig.go new file mode 100644 index 000000000000..7def6ef1e2e0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_listuserkubeconfig.go @@ -0,0 +1,72 @@ +package provisionedclusterinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListUserKubeconfigOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *ListCredentialResponse +} + +// ListUserKubeconfig ... +func (c ProvisionedClusterInstancesClient) ListUserKubeconfig(ctx context.Context, id commonids.ScopeId) (result ListUserKubeconfigOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/listUserKubeconfig", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// ListUserKubeconfigThenPoll performs ListUserKubeconfig then polls until it's completed +func (c ProvisionedClusterInstancesClient) ListUserKubeconfigThenPoll(ctx context.Context, id commonids.ScopeId) error { + result, err := c.ListUserKubeconfig(ctx, id) + if err != nil { + return fmt.Errorf("performing ListUserKubeconfig: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ListUserKubeconfig: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_provisionedclusterinstancescreateorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_provisionedclusterinstancescreateorupdate.go new file mode 100644 index 000000000000..790d34434625 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_provisionedclusterinstancescreateorupdate.go @@ -0,0 +1,76 @@ +package provisionedclusterinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProvisionedClusterInstancesCreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *ProvisionedCluster +} + +// ProvisionedClusterInstancesCreateOrUpdate ... +func (c ProvisionedClusterInstancesClient) ProvisionedClusterInstancesCreateOrUpdate(ctx context.Context, id commonids.ScopeId, input ProvisionedCluster) (result ProvisionedClusterInstancesCreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// ProvisionedClusterInstancesCreateOrUpdateThenPoll performs ProvisionedClusterInstancesCreateOrUpdate then polls until it's completed +func (c ProvisionedClusterInstancesClient) ProvisionedClusterInstancesCreateOrUpdateThenPoll(ctx context.Context, id commonids.ScopeId, input ProvisionedCluster) error { + result, err := c.ProvisionedClusterInstancesCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ProvisionedClusterInstancesCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ProvisionedClusterInstancesCreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_provisionedclusterinstancesdelete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_provisionedclusterinstancesdelete.go new file mode 100644 index 000000000000..b37952d6590a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_provisionedclusterinstancesdelete.go @@ -0,0 +1,71 @@ +package provisionedclusterinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProvisionedClusterInstancesDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ProvisionedClusterInstancesDelete ... +func (c ProvisionedClusterInstancesClient) ProvisionedClusterInstancesDelete(ctx context.Context, id commonids.ScopeId) (result ProvisionedClusterInstancesDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + Path: fmt.Sprintf("%s/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// ProvisionedClusterInstancesDeleteThenPoll performs ProvisionedClusterInstancesDelete then polls until it's completed +func (c ProvisionedClusterInstancesClient) ProvisionedClusterInstancesDeleteThenPoll(ctx context.Context, id commonids.ScopeId) error { + result, err := c.ProvisionedClusterInstancesDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing ProvisionedClusterInstancesDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ProvisionedClusterInstancesDelete: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_provisionedclusterinstancesget.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_provisionedclusterinstancesget.go new file mode 100644 index 000000000000..816cc41d9d67 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_provisionedclusterinstancesget.go @@ -0,0 +1,56 @@ +package provisionedclusterinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProvisionedClusterInstancesGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ProvisionedCluster +} + +// ProvisionedClusterInstancesGet ... +func (c ProvisionedClusterInstancesClient) ProvisionedClusterInstancesGet(ctx context.Context, id commonids.ScopeId) (result ProvisionedClusterInstancesGetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model ProvisionedCluster + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_provisionedclusterinstanceslist.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_provisionedclusterinstanceslist.go new file mode 100644 index 000000000000..7f2aff66196b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_provisionedclusterinstanceslist.go @@ -0,0 +1,106 @@ +package provisionedclusterinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProvisionedClusterInstancesListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ProvisionedCluster +} + +type ProvisionedClusterInstancesListCompleteResult struct { + LatestHttpResponse *http.Response + Items []ProvisionedCluster +} + +type ProvisionedClusterInstancesListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ProvisionedClusterInstancesListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ProvisionedClusterInstancesList ... +func (c ProvisionedClusterInstancesClient) ProvisionedClusterInstancesList(ctx context.Context, id commonids.ScopeId) (result ProvisionedClusterInstancesListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ProvisionedClusterInstancesListCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.HybridContainerService/provisionedClusterInstances", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ProvisionedCluster `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ProvisionedClusterInstancesListComplete retrieves all the results into a single object +func (c ProvisionedClusterInstancesClient) ProvisionedClusterInstancesListComplete(ctx context.Context, id commonids.ScopeId) (ProvisionedClusterInstancesListCompleteResult, error) { + return c.ProvisionedClusterInstancesListCompleteMatchingPredicate(ctx, id, ProvisionedClusterOperationPredicate{}) +} + +// ProvisionedClusterInstancesListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ProvisionedClusterInstancesClient) ProvisionedClusterInstancesListCompleteMatchingPredicate(ctx context.Context, id commonids.ScopeId, predicate ProvisionedClusterOperationPredicate) (result ProvisionedClusterInstancesListCompleteResult, err error) { + items := make([]ProvisionedCluster, 0) + + resp, err := c.ProvisionedClusterInstancesList(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ProvisionedClusterInstancesListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_putkubernetesversions.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_putkubernetesversions.go new file mode 100644 index 000000000000..57aa50f3b12b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_putkubernetesversions.go @@ -0,0 +1,76 @@ +package provisionedclusterinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PutKubernetesVersionsOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *KubernetesVersionProfile +} + +// PutKubernetesVersions ... +func (c ProvisionedClusterInstancesClient) PutKubernetesVersions(ctx context.Context, id commonids.ScopeId, input KubernetesVersionProfile) (result PutKubernetesVersionsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/providers/Microsoft.HybridContainerService/kubernetesVersions/default", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// PutKubernetesVersionsThenPoll performs PutKubernetesVersions then polls until it's completed +func (c ProvisionedClusterInstancesClient) PutKubernetesVersionsThenPoll(ctx context.Context, id commonids.ScopeId, input KubernetesVersionProfile) error { + result, err := c.PutKubernetesVersions(ctx, id, input) + if err != nil { + return fmt.Errorf("performing PutKubernetesVersions: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after PutKubernetesVersions: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_putvmskus.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_putvmskus.go new file mode 100644 index 000000000000..18ca7ccedf5a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_putvmskus.go @@ -0,0 +1,76 @@ +package provisionedclusterinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PutVMSkusOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *VMSkuProfile +} + +// PutVMSkus ... +func (c ProvisionedClusterInstancesClient) PutVMSkus(ctx context.Context, id commonids.ScopeId, input VMSkuProfile) (result PutVMSkusOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/providers/Microsoft.HybridContainerService/skus/default", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// PutVMSkusThenPoll performs PutVMSkus then polls until it's completed +func (c ProvisionedClusterInstancesClient) PutVMSkusThenPoll(ctx context.Context, id commonids.ScopeId, input VMSkuProfile) error { + result, err := c.PutVMSkus(ctx, id, input) + if err != nil { + return fmt.Errorf("performing PutVMSkus: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after PutVMSkus: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_vmskuslist.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_vmskuslist.go new file mode 100644 index 000000000000..2739c8e7dcda --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_vmskuslist.go @@ -0,0 +1,106 @@ +package provisionedclusterinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMSkusListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VMSkuProfile +} + +type VMSkusListCompleteResult struct { + LatestHttpResponse *http.Response + Items []VMSkuProfile +} + +type VMSkusListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *VMSkusListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// VMSkusList ... +func (c ProvisionedClusterInstancesClient) VMSkusList(ctx context.Context, id commonids.ScopeId) (result VMSkusListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &VMSkusListCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.HybridContainerService/skus", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]VMSkuProfile `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// VMSkusListComplete retrieves all the results into a single object +func (c ProvisionedClusterInstancesClient) VMSkusListComplete(ctx context.Context, id commonids.ScopeId) (VMSkusListCompleteResult, error) { + return c.VMSkusListCompleteMatchingPredicate(ctx, id, VMSkuProfileOperationPredicate{}) +} + +// VMSkusListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ProvisionedClusterInstancesClient) VMSkusListCompleteMatchingPredicate(ctx context.Context, id commonids.ScopeId, predicate VMSkuProfileOperationPredicate) (result VMSkusListCompleteResult, err error) { + items := make([]VMSkuProfile, 0) + + resp, err := c.VMSkusList(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = VMSkusListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_addonstatusprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_addonstatusprofile.go new file mode 100644 index 000000000000..1248fbea3c4b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_addonstatusprofile.go @@ -0,0 +1,11 @@ +package provisionedclusterinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AddonStatusProfile struct { + ErrorMessage *string `json:"errorMessage,omitempty"` + Name *string `json:"name,omitempty"` + Phase *AddonPhase `json:"phase,omitempty"` + Ready *bool `json:"ready,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_agentpool.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_agentpool.go new file mode 100644 index 000000000000..4989e4e325f5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_agentpool.go @@ -0,0 +1,18 @@ +package provisionedclusterinstances + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AgentPool struct { + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *AgentPoolProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_agentpoolproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_agentpoolproperties.go new file mode 100644 index 000000000000..2dfc2e4608d8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_agentpoolproperties.go @@ -0,0 +1,20 @@ +package provisionedclusterinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AgentPoolProperties struct { + Count *int64 `json:"count,omitempty"` + EnableAutoScaling *bool `json:"enableAutoScaling,omitempty"` + KubernetesVersion *string `json:"kubernetesVersion,omitempty"` + MaxCount *int64 `json:"maxCount,omitempty"` + MaxPods *int64 `json:"maxPods,omitempty"` + MinCount *int64 `json:"minCount,omitempty"` + NodeLabels *map[string]string `json:"nodeLabels,omitempty"` + NodeTaints *[]string `json:"nodeTaints,omitempty"` + OsSKU *OSSKU `json:"osSKU,omitempty"` + OsType *OsType `json:"osType,omitempty"` + ProvisioningState *ResourceProvisioningState `json:"provisioningState,omitempty"` + Status *AgentPoolProvisioningStatusStatus `json:"status,omitempty"` + VMSize *string `json:"vmSize,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_agentpoolprovisioningstatusstatus.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_agentpoolprovisioningstatusstatus.go new file mode 100644 index 000000000000..032b4a091493 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_agentpoolprovisioningstatusstatus.go @@ -0,0 +1,10 @@ +package provisionedclusterinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AgentPoolProvisioningStatusStatus struct { + CurrentState *ResourceProvisioningState `json:"currentState,omitempty"` + ErrorMessage *string `json:"errorMessage,omitempty"` + ReadyReplicas *[]AgentPoolUpdateProfile `json:"readyReplicas,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_agentpoolupdateprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_agentpoolupdateprofile.go new file mode 100644 index 000000000000..9e34bda2b1c6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_agentpoolupdateprofile.go @@ -0,0 +1,10 @@ +package provisionedclusterinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AgentPoolUpdateProfile struct { + Count *int64 `json:"count,omitempty"` + KubernetesVersion *string `json:"kubernetesVersion,omitempty"` + VMSize *string `json:"vmSize,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_cloudproviderprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_cloudproviderprofile.go new file mode 100644 index 000000000000..15ef3afdf380 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_cloudproviderprofile.go @@ -0,0 +1,8 @@ +package provisionedclusterinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CloudProviderProfile struct { + InfraNetworkProfile *CloudProviderProfileInfraNetworkProfile `json:"infraNetworkProfile,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_cloudproviderprofileinfranetworkprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_cloudproviderprofileinfranetworkprofile.go new file mode 100644 index 000000000000..8dd110324860 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_cloudproviderprofileinfranetworkprofile.go @@ -0,0 +1,8 @@ +package provisionedclusterinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CloudProviderProfileInfraNetworkProfile struct { + VnetSubnetIds *[]string `json:"vnetSubnetIds,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_clustervmaccessprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_clustervmaccessprofile.go new file mode 100644 index 000000000000..3ca8479e173e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_clustervmaccessprofile.go @@ -0,0 +1,8 @@ +package provisionedclusterinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterVMAccessProfile struct { + AuthorizedIPRanges *string `json:"authorizedIPRanges,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_controlplaneprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_controlplaneprofile.go new file mode 100644 index 000000000000..356f71d0a389 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_controlplaneprofile.go @@ -0,0 +1,10 @@ +package provisionedclusterinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ControlPlaneProfile struct { + ControlPlaneEndpoint *ControlPlaneProfileControlPlaneEndpoint `json:"controlPlaneEndpoint,omitempty"` + Count *int64 `json:"count,omitempty"` + VMSize *string `json:"vmSize,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_controlplaneprofilecontrolplaneendpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_controlplaneprofilecontrolplaneendpoint.go new file mode 100644 index 000000000000..d8e6b22b8772 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_controlplaneprofilecontrolplaneendpoint.go @@ -0,0 +1,8 @@ +package provisionedclusterinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ControlPlaneProfileControlPlaneEndpoint struct { + HostIP *string `json:"hostIP,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_credentialresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_credentialresult.go new file mode 100644 index 000000000000..f53ff3e4730a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_credentialresult.go @@ -0,0 +1,9 @@ +package provisionedclusterinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CredentialResult struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_extendedlocation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_extendedlocation.go new file mode 100644 index 000000000000..df5c35f415df --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_extendedlocation.go @@ -0,0 +1,9 @@ +package provisionedclusterinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExtendedLocation struct { + Name *string `json:"name,omitempty"` + Type *ExtendedLocationTypes `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_hybrididentitymetadata.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_hybrididentitymetadata.go new file mode 100644 index 000000000000..ba1c943e5571 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_hybrididentitymetadata.go @@ -0,0 +1,16 @@ +package provisionedclusterinstances + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HybridIdentityMetadata struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties HybridIdentityMetadataProperties `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_hybrididentitymetadataproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_hybrididentitymetadataproperties.go new file mode 100644 index 000000000000..775c85af4984 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_hybrididentitymetadataproperties.go @@ -0,0 +1,10 @@ +package provisionedclusterinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HybridIdentityMetadataProperties struct { + ProvisioningState *ResourceProvisioningState `json:"provisioningState,omitempty"` + PublicKey *string `json:"publicKey,omitempty"` + ResourceUid *string `json:"resourceUid,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_kubernetespatchversions.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_kubernetespatchversions.go new file mode 100644 index 000000000000..a1a2681bf521 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_kubernetespatchversions.go @@ -0,0 +1,9 @@ +package provisionedclusterinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KubernetesPatchVersions struct { + Readiness *[]KubernetesVersionReadiness `json:"readiness,omitempty"` + Upgrades *[]string `json:"upgrades,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_kubernetesversionprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_kubernetesversionprofile.go new file mode 100644 index 000000000000..9e500cc683d7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_kubernetesversionprofile.go @@ -0,0 +1,17 @@ +package provisionedclusterinstances + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KubernetesVersionProfile struct { + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *KubernetesVersionProfileProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_kubernetesversionprofileproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_kubernetesversionprofileproperties.go new file mode 100644 index 000000000000..93c54b0a9ca2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_kubernetesversionprofileproperties.go @@ -0,0 +1,9 @@ +package provisionedclusterinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KubernetesVersionProfileProperties struct { + ProvisioningState *ResourceProvisioningState `json:"provisioningState,omitempty"` + Values *[]KubernetesVersionProperties `json:"values,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_kubernetesversionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_kubernetesversionproperties.go new file mode 100644 index 000000000000..595551b647ba --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_kubernetesversionproperties.go @@ -0,0 +1,10 @@ +package provisionedclusterinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KubernetesVersionProperties struct { + IsPreview *bool `json:"isPreview,omitempty"` + PatchVersions *map[string]KubernetesPatchVersions `json:"patchVersions,omitempty"` + Version *string `json:"version,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_kubernetesversionreadiness.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_kubernetesversionreadiness.go new file mode 100644 index 000000000000..54e2ba9b537a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_kubernetesversionreadiness.go @@ -0,0 +1,11 @@ +package provisionedclusterinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KubernetesVersionReadiness struct { + ErrorMessage *string `json:"errorMessage,omitempty"` + OsSku *OSSKU `json:"osSku,omitempty"` + OsType *OsType `json:"osType,omitempty"` + Ready *bool `json:"ready,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_linuxprofileproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_linuxprofileproperties.go new file mode 100644 index 000000000000..79cdda20ec99 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_linuxprofileproperties.go @@ -0,0 +1,8 @@ +package provisionedclusterinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinuxProfileProperties struct { + Ssh *LinuxProfilePropertiesSsh `json:"ssh,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_linuxprofilepropertiesssh.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_linuxprofilepropertiesssh.go new file mode 100644 index 000000000000..12a2d64608f0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_linuxprofilepropertiesssh.go @@ -0,0 +1,8 @@ +package provisionedclusterinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinuxProfilePropertiesSsh struct { + PublicKeys *[]LinuxProfilePropertiesSshPublicKeysInlined `json:"publicKeys,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_linuxprofilepropertiessshpublickeysinlined.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_linuxprofilepropertiessshpublickeysinlined.go new file mode 100644 index 000000000000..522a08e10ec1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_linuxprofilepropertiessshpublickeysinlined.go @@ -0,0 +1,8 @@ +package provisionedclusterinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinuxProfilePropertiesSshPublicKeysInlined struct { + KeyData *string `json:"keyData,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_listcredentialresponse.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_listcredentialresponse.go new file mode 100644 index 000000000000..2cf150dacb87 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_listcredentialresponse.go @@ -0,0 +1,13 @@ +package provisionedclusterinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListCredentialResponse struct { + Error *ListCredentialResponseError `json:"error,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ListCredentialResponseProperties `json:"properties,omitempty"` + ResourceId *string `json:"resourceId,omitempty"` + Status *ResourceProvisioningState `json:"status,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_listcredentialresponseerror.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_listcredentialresponseerror.go new file mode 100644 index 000000000000..65631706ff87 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_listcredentialresponseerror.go @@ -0,0 +1,9 @@ +package provisionedclusterinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListCredentialResponseError struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_listcredentialresponseproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_listcredentialresponseproperties.go new file mode 100644 index 000000000000..9993f067819c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_listcredentialresponseproperties.go @@ -0,0 +1,8 @@ +package provisionedclusterinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListCredentialResponseProperties struct { + Kubeconfigs *[]CredentialResult `json:"kubeconfigs,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_namedagentpoolprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_namedagentpoolprofile.go new file mode 100644 index 000000000000..ac5e4b41eb2e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_namedagentpoolprofile.go @@ -0,0 +1,19 @@ +package provisionedclusterinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NamedAgentPoolProfile struct { + Count *int64 `json:"count,omitempty"` + EnableAutoScaling *bool `json:"enableAutoScaling,omitempty"` + KubernetesVersion *string `json:"kubernetesVersion,omitempty"` + MaxCount *int64 `json:"maxCount,omitempty"` + MaxPods *int64 `json:"maxPods,omitempty"` + MinCount *int64 `json:"minCount,omitempty"` + Name *string `json:"name,omitempty"` + NodeLabels *map[string]string `json:"nodeLabels,omitempty"` + NodeTaints *[]string `json:"nodeTaints,omitempty"` + OsSKU *OSSKU `json:"osSKU,omitempty"` + OsType *OsType `json:"osType,omitempty"` + VMSize *string `json:"vmSize,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_networkprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_networkprofile.go new file mode 100644 index 000000000000..8f542600c3da --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_networkprofile.go @@ -0,0 +1,10 @@ +package provisionedclusterinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkProfile struct { + LoadBalancerProfile *NetworkProfileLoadBalancerProfile `json:"loadBalancerProfile,omitempty"` + NetworkPolicy *NetworkPolicy `json:"networkPolicy,omitempty"` + PodCidr *string `json:"podCidr,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_networkprofileloadbalancerprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_networkprofileloadbalancerprofile.go new file mode 100644 index 000000000000..6a9fa9a386cc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_networkprofileloadbalancerprofile.go @@ -0,0 +1,8 @@ +package provisionedclusterinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkProfileLoadBalancerProfile struct { + Count *int64 `json:"count,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_provisionedcluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_provisionedcluster.go new file mode 100644 index 000000000000..9093c96fc94f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_provisionedcluster.go @@ -0,0 +1,17 @@ +package provisionedclusterinstances + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProvisionedCluster struct { + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ProvisionedClusterProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_provisionedclusterlicenseprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_provisionedclusterlicenseprofile.go new file mode 100644 index 000000000000..bec6f9004f16 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_provisionedclusterlicenseprofile.go @@ -0,0 +1,8 @@ +package provisionedclusterinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProvisionedClusterLicenseProfile struct { + AzureHybridBenefit *AzureHybridBenefit `json:"azureHybridBenefit,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_provisionedclusterpoolupgradeprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_provisionedclusterpoolupgradeprofile.go new file mode 100644 index 000000000000..64afa5f5e965 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_provisionedclusterpoolupgradeprofile.go @@ -0,0 +1,10 @@ +package provisionedclusterinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProvisionedClusterPoolUpgradeProfile struct { + KubernetesVersion *string `json:"kubernetesVersion,omitempty"` + OsType *OsType `json:"osType,omitempty"` + Upgrades *[]ProvisionedClusterPoolUpgradeProfileProperties `json:"upgrades,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_provisionedclusterpoolupgradeprofileproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_provisionedclusterpoolupgradeprofileproperties.go new file mode 100644 index 000000000000..8bfed453df63 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_provisionedclusterpoolupgradeprofileproperties.go @@ -0,0 +1,9 @@ +package provisionedclusterinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProvisionedClusterPoolUpgradeProfileProperties struct { + IsPreview *bool `json:"isPreview,omitempty"` + KubernetesVersion *string `json:"kubernetesVersion,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_provisionedclusterproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_provisionedclusterproperties.go new file mode 100644 index 000000000000..fcb6073e7b22 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_provisionedclusterproperties.go @@ -0,0 +1,19 @@ +package provisionedclusterinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProvisionedClusterProperties struct { + AgentPoolProfiles *[]NamedAgentPoolProfile `json:"agentPoolProfiles,omitempty"` + AutoScalerProfile *ProvisionedClusterPropertiesAutoScalerProfile `json:"autoScalerProfile,omitempty"` + CloudProviderProfile *CloudProviderProfile `json:"cloudProviderProfile,omitempty"` + ClusterVMAccessProfile *ClusterVMAccessProfile `json:"clusterVMAccessProfile,omitempty"` + ControlPlane *ControlPlaneProfile `json:"controlPlane,omitempty"` + KubernetesVersion *string `json:"kubernetesVersion,omitempty"` + LicenseProfile *ProvisionedClusterLicenseProfile `json:"licenseProfile,omitempty"` + LinuxProfile *LinuxProfileProperties `json:"linuxProfile,omitempty"` + NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` + ProvisioningState *ResourceProvisioningState `json:"provisioningState,omitempty"` + Status *ProvisionedClusterPropertiesStatus `json:"status,omitempty"` + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_provisionedclusterpropertiesautoscalerprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_provisionedclusterpropertiesautoscalerprofile.go new file mode 100644 index 000000000000..59a043e44dd3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_provisionedclusterpropertiesautoscalerprofile.go @@ -0,0 +1,24 @@ +package provisionedclusterinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProvisionedClusterPropertiesAutoScalerProfile struct { + BalanceSimilarNodeGroups *string `json:"balance-similar-node-groups,omitempty"` + Expander *Expander `json:"expander,omitempty"` + MaxEmptyBulkDelete *string `json:"max-empty-bulk-delete,omitempty"` + MaxGracefulTerminationSec *string `json:"max-graceful-termination-sec,omitempty"` + MaxNodeProvisionTime *string `json:"max-node-provision-time,omitempty"` + MaxTotalUnreadyPercentage *string `json:"max-total-unready-percentage,omitempty"` + NewPodScaleUpDelay *string `json:"new-pod-scale-up-delay,omitempty"` + OkTotalUnreadyCount *string `json:"ok-total-unready-count,omitempty"` + ScaleDownDelayAfterAdd *string `json:"scale-down-delay-after-add,omitempty"` + ScaleDownDelayAfterDelete *string `json:"scale-down-delay-after-delete,omitempty"` + ScaleDownDelayAfterFailure *string `json:"scale-down-delay-after-failure,omitempty"` + ScaleDownUnneededTime *string `json:"scale-down-unneeded-time,omitempty"` + ScaleDownUnreadyTime *string `json:"scale-down-unready-time,omitempty"` + ScaleDownUtilizationThreshold *string `json:"scale-down-utilization-threshold,omitempty"` + ScanInterval *string `json:"scan-interval,omitempty"` + SkipNodesWithLocalStorage *string `json:"skip-nodes-with-local-storage,omitempty"` + SkipNodesWithSystemPods *string `json:"skip-nodes-with-system-pods,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_provisionedclusterpropertiesstatus.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_provisionedclusterpropertiesstatus.go new file mode 100644 index 000000000000..6c7d9e52430d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_provisionedclusterpropertiesstatus.go @@ -0,0 +1,10 @@ +package provisionedclusterinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProvisionedClusterPropertiesStatus struct { + ControlPlaneStatus *[]AddonStatusProfile `json:"controlPlaneStatus,omitempty"` + CurrentState *ResourceProvisioningState `json:"currentState,omitempty"` + ErrorMessage *string `json:"errorMessage,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_provisionedclusterupgradeprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_provisionedclusterupgradeprofile.go new file mode 100644 index 000000000000..7cbd0fe69da8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_provisionedclusterupgradeprofile.go @@ -0,0 +1,16 @@ +package provisionedclusterinstances + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProvisionedClusterUpgradeProfile struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties ProvisionedClusterUpgradeProfileProperties `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_provisionedclusterupgradeprofileproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_provisionedclusterupgradeprofileproperties.go new file mode 100644 index 000000000000..93bc41c63b02 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_provisionedclusterupgradeprofileproperties.go @@ -0,0 +1,9 @@ +package provisionedclusterinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProvisionedClusterUpgradeProfileProperties struct { + ControlPlaneProfile ProvisionedClusterPoolUpgradeProfile `json:"controlPlaneProfile"` + ProvisioningState *ResourceProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_storageprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_storageprofile.go new file mode 100644 index 000000000000..2a27029606c0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_storageprofile.go @@ -0,0 +1,9 @@ +package provisionedclusterinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StorageProfile struct { + NfsCsiDriver *StorageProfileNfsCSIDriver `json:"nfsCsiDriver,omitempty"` + SmbCsiDriver *StorageProfileSmbCSIDriver `json:"smbCsiDriver,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_storageprofilenfscsidriver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_storageprofilenfscsidriver.go new file mode 100644 index 000000000000..4064e020e57b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_storageprofilenfscsidriver.go @@ -0,0 +1,8 @@ +package provisionedclusterinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StorageProfileNfsCSIDriver struct { + Enabled *bool `json:"enabled,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_storageprofilesmbcsidriver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_storageprofilesmbcsidriver.go new file mode 100644 index 000000000000..f6eec4882849 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_storageprofilesmbcsidriver.go @@ -0,0 +1,8 @@ +package provisionedclusterinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StorageProfileSmbCSIDriver struct { + Enabled *bool `json:"enabled,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_vmskucapabilities.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_vmskucapabilities.go new file mode 100644 index 000000000000..905c81b29377 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_vmskucapabilities.go @@ -0,0 +1,9 @@ +package provisionedclusterinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMSkuCapabilities struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_vmskuprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_vmskuprofile.go new file mode 100644 index 000000000000..a7bdad2924d2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_vmskuprofile.go @@ -0,0 +1,17 @@ +package provisionedclusterinstances + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMSkuProfile struct { + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *VMSkuProfileProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_vmskuprofileproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_vmskuprofileproperties.go new file mode 100644 index 000000000000..fcdfdb3244b6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_vmskuprofileproperties.go @@ -0,0 +1,9 @@ +package provisionedclusterinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMSkuProfileProperties struct { + ProvisioningState *ResourceProvisioningState `json:"provisioningState,omitempty"` + Values *[]VMSkuProperties `json:"values,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_vmskuproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_vmskuproperties.go new file mode 100644 index 000000000000..fa2c904d575c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/model_vmskuproperties.go @@ -0,0 +1,12 @@ +package provisionedclusterinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMSkuProperties struct { + Capabilities *[]VMSkuCapabilities `json:"capabilities,omitempty"` + Name *string `json:"name,omitempty"` + ResourceType *string `json:"resourceType,omitempty"` + Size *string `json:"size,omitempty"` + Tier *string `json:"tier,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/predicates.go new file mode 100644 index 000000000000..d8296c2d72d9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/predicates.go @@ -0,0 +1,119 @@ +package provisionedclusterinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AgentPoolOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p AgentPoolOperationPredicate) Matches(input AgentPool) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} + +type HybridIdentityMetadataOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p HybridIdentityMetadataOperationPredicate) Matches(input HybridIdentityMetadata) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} + +type KubernetesVersionProfileOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p KubernetesVersionProfileOperationPredicate) Matches(input KubernetesVersionProfile) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} + +type ProvisionedClusterOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p ProvisionedClusterOperationPredicate) Matches(input ProvisionedCluster) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} + +type VMSkuProfileOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p VMSkuProfileOperationPredicate) Matches(input VMSkuProfile) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/version.go new file mode 100644 index 000000000000..0ebd18f17bfd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/version.go @@ -0,0 +1,12 @@ +package provisionedclusterinstances + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-01-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/provisionedclusterinstances/%s", defaultApiVersion) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index be8b1e1382ec..a51260d8ee74 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -560,6 +560,7 @@ github.com/hashicorp/go-azure-sdk/resource-manager/healthcareapis/2022-12-01/fhi github.com/hashicorp/go-azure-sdk/resource-manager/healthcareapis/2022-12-01/iotconnectors github.com/hashicorp/go-azure-sdk/resource-manager/healthcareapis/2022-12-01/resource github.com/hashicorp/go-azure-sdk/resource-manager/healthcareapis/2022-12-01/workspaces +github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privateendpointconnections From 7bd68f066e8d38e4334302819f6b57dade5ee855 Mon Sep 17 00:00:00 2001 From: teowa <104055472+teowa@users.noreply.github.com> Date: Tue, 13 Aug 2024 09:22:54 +0000 Subject: [PATCH 02/17] wip --- ...kubernetes_provisioned_cluster_resource.go | 131 ++++++++++++------ ...netes_provisioned_cluster_resource_test.go | 2 +- 2 files changed, 90 insertions(+), 43 deletions(-) diff --git a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go index de0e290c1eb6..94dc72363a9e 100644 --- a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go +++ b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" "github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2024-01-01/logicalnetworks" @@ -61,19 +61,23 @@ func (ArcKubernetesProvisionedClusterInstanceResource) ModelObject() interface{} } type ArcKubernetesProvisionedClusterInstanceResourceModel struct { - Name string `tfschema:"name"` - ResourceGroupName string `tfschema:"resource_group_name"` - Location string `tfschema:"location"` - CustomLocationId string `tfschema:"custom_location_id"` - AgentPoolProfile []ProvisionedClusterInstanceAgentPoolProfile `tfschema:"agent_pool_profile"` - AutoScalerProfile []ProvisionedClusterInstanceAutoScalerProfile `tfschema:"auto_scaler_profile"` - VirtualSwitchName string `tfschema:"virtual_switch_name"` - Tags map[string]interface{} `tfschema:"tags"` + AgentPoolProfile []ProvisionedClusterInstanceAgentPoolProfile `tfschema:"agent_pool_profile"` + AutoScalerProfile []ProvisionedClusterInstanceAutoScalerProfile `tfschema:"auto_scaler_profile"` + CloudProviderProfile []ProvisionedClusterInstanceCloudProviderProfile `tfschema:"cloud_provider_profile"` + ConnectedClusterID string `tfschema:"connected_cluster_id"` + ControlPlane []ProvisionedClusterInstanceControlPlane `tfschema:"control_plane"` + CustomLocationId string `tfschema:"custom_location_id"` + KubernetesVersion string `tfschema:"kubernetes_version"` + LinuxProfile []ProvisionedClusterInstanceLinuxProfile `tfschema:"linux_profile"` + LicenseProfile []ProvisionedClusterInstanceLicenseProfile `tfschema:"license_profile"` + NetworkProfile []ProvisionedClusterInstanceNetworkProfile `tfschema:"network_profile"` + StorageProfile []ProvisionedClusterInstanceStorageProfile `tfschema:"storage_profile"` + VnetSubnetIds []string `tfschema:"vnet_subnet_ids"` } type ProvisionedClusterInstanceAgentPoolProfile struct { - Count string `tfschema:"count"` - AutoScalingEnabled string `tfschema:"auto_scaling_enabled"` + AutoScalingEnabled bool `tfschema:"auto_scaling_enabled"` + Count int64 `tfschema:"count"` MaxCount int64 `tfschema:"max_count"` MaxPods int64 `tfschema:"max_pods"` MinCount int64 `tfschema:"min_count"` @@ -86,31 +90,75 @@ type ProvisionedClusterInstanceAgentPoolProfile struct { } type ProvisionedClusterInstanceAutoScalerProfile struct { - Balan + BalanceSimilarNodeGroups string `tfschema:"balance_similar_node_groups"` + Expander string `tfschema:"expander"` + MaxEmptyBulkDelete string `tfschema:"max_empty_bulk_delete"` + MaxGracefulTerminationSec string `tfschema:"max_graceful_termination_sec"` + MaxNodeProvisionTime string `tfschema:"max_node_provision_time"` + MaxTotalUnreadyPercentage string `tfschema:"max_total_unready_percentage"` + NewPodScaleUpDelay string `tfschema:"new_pod_scale_up_delay"` + OkTotalUnreadyCount string `tfschema:"ok_total_unready_count"` + ScanInterval string `tfschema:"scan_interval"` + ScaleDownDelayAfterAdd string `tfschema:"scale_down_delay_after_add"` + ScaleDownDelayAfterDelete string `tfschema:"scale_down_delay_after_delete"` + ScaleDownDelayAfterFailure string `tfschema:"scale_down_delay_after_failure"` + ScaleDownUnneededTime string `tfschema:"scale_down_unneeded_time"` + ScaleDownUnreadyTime string `tfschema:"scale_down_unready_time"` + ScaleDownUtilizationThreshold string `tfschema:"scale_down_utilization_threshold"` + SkipNodesWithLocalStorage string `tfschema:"skip_nodes_with_local_storage"` + SkipNodesWithSystemPods string `tfschema:"skip_nodes_with_system_pods"` } -type StackHCIRouteModel struct { - Name string `tfschema:"name"` - AddressPrefix string `tfschema:"address_prefix"` - NextHopIpAddress string `tfschema:"next_hop_ip_address"` +type ProvisionedClusterInstanceCloudProviderProfile struct { + InfraNetworkProfile []ProvisionedClusterInstanceInfraNetworkProfile `tfschema:"infra_network_profile"` +} + +type ProvisionedClusterInstanceInfraNetworkProfile struct { + VnetSubnetId []string `tfschema:"vnet_subnet_id"` +} + +type ProvisionedClusterInstanceControlPlane struct { + Count int64 `tfschema:"count"` + HostIp string `tfschema:"host_ip"` + VmSize string `tfschema:"vm_size"` +} + +type ProvisionedClusterInstanceLinuxProfile struct { + SshKey []ProvisionedClusterInstanceSshKey `tfschema:"ssh_key"` +} + +type ProvisionedClusterInstanceSshKey struct { + KeyData string `tfschema:"key_data"` +} + +type ProvisionedClusterInstanceLicenseProfile struct { + AzureHybridBenefit string `tfschema:"azure_hybrid_benefit"` +} + +type ProvisionedClusterInstanceNetworkProfile struct { + LoadBalancerProfile []ProvisionedClusterInstanceLoadBalancerProfile `tfschema:"load_balancer_profile"` + NetworkPolicy string `tfschema:"network_policy"` + PodCidr string `tfschema:"pod_cidr"` +} + +type ProvisionedClusterInstanceLoadBalancerProfile struct { + Count int64 `tfschema:"count"` +} + +type ProvisionedClusterInstanceStorageProfile struct { + SmbCsiDriverEnabled bool `tfschema:"smb_csi_driver_enabled"` + NfsCsiDriverEnabled bool `tfschema:"nfs_csi_driver_enabled"` } func (ArcKubernetesProvisionedClusterInstanceResource) Arguments() map[string]*pluginsdk.Schema { return map[string]*pluginsdk.Schema{ - "name": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringMatch( - regexp.MustCompile(`^[a-zA-Z0-9][\-\.\_a-zA-Z0-9]{0,62}[a-zA-Z0-9]$`), - "name must be between 2 and 64 characters and can only contain alphanumberic characters, hyphen, dot and underline", - ), + "connected_cluster_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: connectedclusters.ValidateConnectedClusterID, }, - "resource_group_name": commonschema.ResourceGroupName(), - - "location": commonschema.Location(), - "custom_location_id": { Type: pluginsdk.TypeString, Required: true, @@ -220,8 +268,6 @@ func (ArcKubernetesProvisionedClusterInstanceResource) Arguments() map[string]*p }, }, }, - - "tags": commonschema.Tags(), } } @@ -233,17 +279,21 @@ func (r ArcKubernetesProvisionedClusterInstanceResource) Create() sdk.ResourceFu return sdk.ResourceFunc{ Timeout: 30 * time.Minute, Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - client := metadata.Client.AzureStackHCI.LogicalNetworks + client := metadata.Client.ArcKubernetes.ProvisionedClusterInstancesClient var config ArcKubernetesProvisionedClusterInstanceResourceModel if err := metadata.Decode(&config); err != nil { return fmt.Errorf("decoding: %+v", err) } - subscriptionId := metadata.Client.Account.SubscriptionId - id := logicalnetworks.NewLogicalNetworkID(subscriptionId, config.ResourceGroupName, config.Name) + id, err := connectedclusters.ParseConnectedClusterID(config.ConnectedClusterID) + if err != nil { + return err + } + + scopeId := commonids.NewScopeID(id.ID()) - existing, err := client.Get(ctx, id) + existing, err := client.ProvisionedClusterInstancesGet(ctx, scopeId) if err != nil && !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } @@ -251,18 +301,15 @@ func (r ArcKubernetesProvisionedClusterInstanceResource) Create() sdk.ResourceFu return metadata.ResourceRequiresImport(r.ResourceType(), id) } - payload := provisionedclusterinstances.ID{ - Name: pointer.To(config.Name), - Location: location.Normalize(config.Location), - Tags: tags.Expand(config.Tags), - ExtendedLocation: &logicalnetworks.ExtendedLocation{ + payload := provisionedclusterinstances.ProvisionedCluster{ + ExtendedLocation: &provisionedclusterinstances.ExtendedLocation{ Name: pointer.To(config.CustomLocationId), - Type: pointer.To(logicalnetworks.ExtendedLocationTypesCustomLocation), + Type: pointer.To(provisionedclusterinstances.ExtendedLocationTypesCustomLocation), }, } - if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { - return fmt.Errorf("performing create %s: %+v", id, err) + if err := client.ProvisionedClusterInstancesCreateOrUpdateThenPoll(ctx, scopeId, payload); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) } metadata.SetID(id) diff --git a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go index 8b137891791f..ebd64ed2a8ec 100644 --- a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go +++ b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go @@ -1 +1 @@ - +package arckubernetes_test From 2fca4ae3e7e37a64170e847e94e6a2a96bec3429 Mon Sep 17 00:00:00 2001 From: teowa <104055472+teowa@users.noreply.github.com> Date: Thu, 15 Aug 2024 09:37:03 +0000 Subject: [PATCH 03/17] wip --- ...kubernetes_provisioned_cluster_resource.go | 404 +++++++++++++++--- .../2024-01-01/virtualnetworks/README.md | 117 +++++ .../2024-01-01/virtualnetworks/client.go | 26 ++ .../2024-01-01/virtualnetworks/constants.go | 107 +++++ .../virtualnetworks/id_virtualnetwork.go | 130 ++++++ .../virtualnetworks/method_createorupdate.go | 75 ++++ .../virtualnetworks/method_delete.go | 70 +++ .../method_listbyresourcegroup.go | 106 +++++ .../method_listbysubscription.go | 106 +++++ .../virtualnetworks/method_retrieve.go | 54 +++ .../virtualnetworks/method_update.go | 75 ++++ .../virtualnetworks/model_virtualnetwork.go | 19 + .../model_virtualnetworkextendedlocation.go | 9 + .../model_virtualnetworkproperties.go | 16 + ...irtualnetworkpropertiesinfravnetprofile.go | 8 + ...ualnetworkpropertiesinfravnetprofilehci.go | 10 + .../model_virtualnetworkpropertiesstatus.go | 8 + ...lnetworkpropertiesstatusoperationstatus.go | 10 + ...orkpropertiesstatusoperationstatuserror.go | 9 + ..._virtualnetworkpropertiesvippoolinlined.go | 9 + ...virtualnetworkpropertiesvmippoolinlined.go | 9 + .../model_virtualnetworkspatch.go | 8 + .../2024-01-01/virtualnetworks/predicates.go | 32 ++ .../2024-01-01/virtualnetworks/version.go | 12 + vendor/modules.txt | 1 + 25 files changed, 1364 insertions(+), 66 deletions(-) create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/id_virtualnetwork.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/method_listbyresourcegroup.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/method_listbysubscription.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/method_retrieve.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetwork.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetworkextendedlocation.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetworkproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetworkpropertiesinfravnetprofile.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetworkpropertiesinfravnetprofilehci.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetworkpropertiesstatus.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetworkpropertiesstatusoperationstatus.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetworkpropertiesstatusoperationstatuserror.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetworkpropertiesvippoolinlined.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetworkpropertiesvmippoolinlined.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetworkspatch.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/version.go diff --git a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go index 94dc72363a9e..65d00a664093 100644 --- a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go +++ b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go @@ -15,6 +15,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2024-01-01/logicalnetworks" "github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations" "github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances" + "github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks" "github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2024-01-01/connectedclusters" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -65,14 +66,13 @@ type ArcKubernetesProvisionedClusterInstanceResourceModel struct { AutoScalerProfile []ProvisionedClusterInstanceAutoScalerProfile `tfschema:"auto_scaler_profile"` CloudProviderProfile []ProvisionedClusterInstanceCloudProviderProfile `tfschema:"cloud_provider_profile"` ConnectedClusterID string `tfschema:"connected_cluster_id"` - ControlPlane []ProvisionedClusterInstanceControlPlane `tfschema:"control_plane"` + ControlPlaneProfile []ProvisionedClusterInstanceControlPlaneProfile `tfschema:"control_plane_profile"` CustomLocationId string `tfschema:"custom_location_id"` KubernetesVersion string `tfschema:"kubernetes_version"` LinuxProfile []ProvisionedClusterInstanceLinuxProfile `tfschema:"linux_profile"` LicenseProfile []ProvisionedClusterInstanceLicenseProfile `tfschema:"license_profile"` NetworkProfile []ProvisionedClusterInstanceNetworkProfile `tfschema:"network_profile"` StorageProfile []ProvisionedClusterInstanceStorageProfile `tfschema:"storage_profile"` - VnetSubnetIds []string `tfschema:"vnet_subnet_ids"` } type ProvisionedClusterInstanceAgentPoolProfile struct { @@ -82,8 +82,8 @@ type ProvisionedClusterInstanceAgentPoolProfile struct { MaxPods int64 `tfschema:"max_pods"` MinCount int64 `tfschema:"min_count"` Name string `tfschema:"name"` - NodeLabel map[string]interface{} `tfschema:"node_label"` - NodeTaint []string `tfschema:"node_taint"` + NodeLabels map[string]interface{} `tfschema:"node_labels"` + NodeTaints []string `tfschema:"node_taints"` OsSku string `tfschema:"os_sku"` OsType string `tfschema:"os_type"` VmSize string `tfschema:"vm_size"` @@ -114,10 +114,10 @@ type ProvisionedClusterInstanceCloudProviderProfile struct { } type ProvisionedClusterInstanceInfraNetworkProfile struct { - VnetSubnetId []string `tfschema:"vnet_subnet_id"` + VnetSubnetIds []string `tfschema:"vnet_subnet_ids"` } -type ProvisionedClusterInstanceControlPlane struct { +type ProvisionedClusterInstanceControlPlaneProfile struct { Count int64 `tfschema:"count"` HostIp string `tfschema:"host_ip"` VmSize string `tfschema:"vm_size"` @@ -166,104 +166,376 @@ func (ArcKubernetesProvisionedClusterInstanceResource) Arguments() map[string]*p ValidateFunc: customlocations.ValidateCustomLocationID, }, - "virtual_switch_name": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringIsNotEmpty, - }, - - "dns_servers": { + "auto_scaler_profile": { Type: pluginsdk.TypeList, - Optional: true, + Required: true, ForceNew: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - ValidateFunc: validation.IsIPv4Address, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "balance_similar_node_groups": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + "expander": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{ + string(provisionedclusterinstances.ExpanderLeastNegativewaste), + string(provisionedclusterinstances.ExpanderMostNegativepods), + string(provisionedclusterinstances.ExpanderPriority), + string(provisionedclusterinstances.ExpanderRandom), + }, false), + }, + "max_empty_bulk_delete": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + "max_graceful_termination_sec": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + "max_node_provision_time": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + "max_total_unready_percentage": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + "new_pod_scale_up_delay": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + "ok_total_unready_count": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + "scan_interval": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + "scale_down_delay_after_add": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + "scale_down_delay_after_delete": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + "scale_down_delay_after_failure": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + "scale_down_unneeded_time": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + "scale_down_unready_time": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + "scale_down_utilization_threshold": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + "skip_nodes_with_local_storage": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + "skip_nodes_with_system_pods": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, }, }, - "subnet": { + "agent_pool_profile": { Type: pluginsdk.TypeList, Required: true, ForceNew: true, MaxItems: 1, Elem: &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ - "ip_allocation_method": { + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringMatch( + regexp.MustCompile(`^[a-z][a-z0-9]{2,11}$`), + "`name` must start with lower cases characters and can only contains 3-12 lowercase alphanumberic characters"), + }, + "vm_size": { Type: pluginsdk.TypeString, Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + "auto_scaling_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + ForceNew: true, + Default: false, + }, + "count": { + Type: pluginsdk.TypeInt, + Optional: true, + ValidateFunc: validation.IntAtLeast(1), + Default: 1, + }, + "max_count": { + Type: pluginsdk.TypeInt, + Optional: true, ForceNew: true, - ValidateFunc: validation.StringInSlice(logicalnetworks.PossibleValuesForIPAllocationMethodEnum(), false), + ValidateFunc: validation.IntAtLeast(1), }, - - "address_prefix": { - Type: pluginsdk.TypeString, + "max_pods": { + Type: pluginsdk.TypeInt, Optional: true, ForceNew: true, - ValidateFunc: validation.IsCIDR, + ValidateFunc: validation.IntAtLeast(1), }, - - "ip_pool": { + "min_count": { + Type: pluginsdk.TypeInt, + Optional: true, + ForceNew: true, + ValidateFunc: validation.IntAtLeast(1), + }, + "node_labels": { + Type: pluginsdk.TypeMap, + ForceNew: true, + Optional: true, + }, + "node_taints": { Type: pluginsdk.TypeList, Optional: true, ForceNew: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.IsIPv4Address, + }, + }, + "os_sku": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{ + string(provisionedclusterinstances.OSSKUCBLMariner), + string(provisionedclusterinstances.OSSKUWindowsTwoZeroOneNine), + string(provisionedclusterinstances.OSSKUWindowsTwoZeroTwoTwo), + }, false), + }, + "os_type": { + Type: pluginsdk.TypeString, + Optional: true, + Default: string(provisionedclusterinstances.OsTypeLinux), + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{ + string(provisionedclusterinstances.OsTypeLinux), + string(provisionedclusterinstances.OsTypeWindows), + }, false), + }, + }, + }, + }, + + "cloud_provider_profile": { + Type: pluginsdk.TypeList, + Required: true, + ForceNew: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "infra_network_profile": { + Type: pluginsdk.TypeList, + Required: true, + ForceNew: true, + MaxItems: 1, Elem: &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ - "start": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.IsIPv4Address, - }, - "end": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.IsIPv4Address, + "vnet_subnet_ids": { + Required: true, + MinItems: 1, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.Any( + logicalnetworks.ValidateLogicalNetworkID, + virtualnetworks.ValidateVirtualNetworkID, + ), + }, }, }, }, }, + }, + }, + }, - "route": { + "control_plane_profile": { + Type: pluginsdk.TypeList, + Required: true, + ForceNew: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "host_ip": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.IsIPv4Address, + }, + "vm_size": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + "count": { + Type: pluginsdk.TypeInt, + Optional: true, + Default: 1, + ValidateFunc: validation.IntAtLeast(1), + }, + }, + }, + }, + + "kubernetes_version": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "linux_profile": { + Type: pluginsdk.TypeList, + Required: true, + ForceNew: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "ssh_key": { + Type: pluginsdk.TypeList, + Required: true, + MinItems: 1, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + }, + }, + }, + + "license_profile": { + Type: pluginsdk.TypeList, + Optional: true, + ForceNew: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "azure_hybrid_benefit": { + Type: pluginsdk.TypeString, + Optional: true, + Default: string(provisionedclusterinstances.AzureHybridBenefitNotApplicable), + ValidateFunc: validation.StringInSlice([]string{ + string(provisionedclusterinstances.AzureHybridBenefitNotApplicable), + string(provisionedclusterinstances.AzureHybridBenefitFalse), + string(provisionedclusterinstances.AzureHybridBenefitTrue), + }, false), + }, + }, + }, + }, + + "network_profile": { + Type: pluginsdk.TypeList, + Optional: true, + ForceNew: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "network_policy": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{ + string(provisionedclusterinstances.NetworkPolicyCalico), + }, false), + }, + "pod_cidr": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.IsCIDR, + }, + "load_balancer_profile": { Type: pluginsdk.TypeList, Optional: true, ForceNew: true, + MaxItems: 1, Elem: &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ - "name": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringMatch( - regexp.MustCompile(`^[a-zA-Z0-9][\-\.\_a-zA-Z0-9]{0,78}[a-zA-Z0-9]$`), - "name must be between 2 and 80 characters and can only contain alphanumberic characters, hyphen, dot and underline", - ), - }, - - "address_prefix": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.IsCIDR, - }, - - "next_hop_ip_address": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.IsIPv4Address, + "count": { + Type: pluginsdk.TypeInt, + Optional: true, + Default: 0, + ValidateFunc: validation.IntAtLeast(1), }, }, }, }, + }, + }, + }, - "vlan_id": { - Type: pluginsdk.TypeInt, - Optional: true, - ForceNew: true, - ValidateFunc: validation.IntAtLeast(0), + "storage_profile": { + Type: pluginsdk.TypeList, + Optional: true, + ForceNew: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "smb_csi_driver_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + ForceNew: true, + Default: true, + }, + "nfs_csi_driver_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + ForceNew: true, + Default: true, }, }, }, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/README.md new file mode 100644 index 000000000000..c84552405ffb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/README.md @@ -0,0 +1,117 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks` Documentation + +The `virtualnetworks` SDK allows for interaction with the Azure Resource Manager Service `hybridazurekubernetesservice` (API Version `2024-01-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +import "github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks" +``` + + +### Client Initialization + +```go +client := virtualnetworks.NewVirtualNetworksClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VirtualNetworksClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := virtualnetworks.NewVirtualNetworkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualNetworkValue") + +payload := virtualnetworks.VirtualNetwork{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualNetworksClient.Delete` + +```go +ctx := context.TODO() +id := virtualnetworks.NewVirtualNetworkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualNetworkValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualNetworksClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `VirtualNetworksClient.ListBySubscription` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `VirtualNetworksClient.Retrieve` + +```go +ctx := context.TODO() +id := virtualnetworks.NewVirtualNetworkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualNetworkValue") + +read, err := client.Retrieve(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualNetworksClient.Update` + +```go +ctx := context.TODO() +id := virtualnetworks.NewVirtualNetworkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualNetworkValue") + +payload := virtualnetworks.VirtualNetworksPatch{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/client.go new file mode 100644 index 000000000000..15c346279f67 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/client.go @@ -0,0 +1,26 @@ +package virtualnetworks + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetworksClient struct { + Client *resourcemanager.Client +} + +func NewVirtualNetworksClientWithBaseURI(sdkApi sdkEnv.Api) (*VirtualNetworksClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "virtualnetworks", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating VirtualNetworksClient: %+v", err) + } + + return &VirtualNetworksClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/constants.go new file mode 100644 index 000000000000..07fc4f0f3150 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/constants.go @@ -0,0 +1,107 @@ +package virtualnetworks + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExtendedLocationTypes string + +const ( + ExtendedLocationTypesCustomLocation ExtendedLocationTypes = "CustomLocation" +) + +func PossibleValuesForExtendedLocationTypes() []string { + return []string{ + string(ExtendedLocationTypesCustomLocation), + } +} + +func (s *ExtendedLocationTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseExtendedLocationTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseExtendedLocationTypes(input string) (*ExtendedLocationTypes, error) { + vals := map[string]ExtendedLocationTypes{ + "customlocation": ExtendedLocationTypesCustomLocation, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ExtendedLocationTypes(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStatePending ProvisioningState = "Pending" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateCreating), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStatePending), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "accepted": ProvisioningStateAccepted, + "canceled": ProvisioningStateCanceled, + "creating": ProvisioningStateCreating, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "pending": ProvisioningStatePending, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/id_virtualnetwork.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/id_virtualnetwork.go new file mode 100644 index 000000000000..b926754b94ab --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/id_virtualnetwork.go @@ -0,0 +1,130 @@ +package virtualnetworks + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&VirtualNetworkId{}) +} + +var _ resourceids.ResourceId = &VirtualNetworkId{} + +// VirtualNetworkId is a struct representing the Resource ID for a Virtual Network +type VirtualNetworkId struct { + SubscriptionId string + ResourceGroupName string + VirtualNetworkName string +} + +// NewVirtualNetworkID returns a new VirtualNetworkId struct +func NewVirtualNetworkID(subscriptionId string, resourceGroupName string, virtualNetworkName string) VirtualNetworkId { + return VirtualNetworkId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VirtualNetworkName: virtualNetworkName, + } +} + +// ParseVirtualNetworkID parses 'input' into a VirtualNetworkId +func ParseVirtualNetworkID(input string) (*VirtualNetworkId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualNetworkId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVirtualNetworkIDInsensitively parses 'input' case-insensitively into a VirtualNetworkId +// note: this method should only be used for API response data and not user input +func ParseVirtualNetworkIDInsensitively(input string) (*VirtualNetworkId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualNetworkId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualNetworkId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.VirtualNetworkName, ok = input.Parsed["virtualNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkName", input) + } + + return nil +} + +// ValidateVirtualNetworkID checks that 'input' can be parsed as a Virtual Network ID +func ValidateVirtualNetworkID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseVirtualNetworkID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Network ID +func (id VirtualNetworkId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.HybridContainerService/virtualNetworks/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VirtualNetworkName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Network ID +func (id VirtualNetworkId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftHybridContainerService", "Microsoft.HybridContainerService", "Microsoft.HybridContainerService"), + resourceids.StaticSegment("staticVirtualNetworks", "virtualNetworks", "virtualNetworks"), + resourceids.UserSpecifiedSegment("virtualNetworkName", "virtualNetworkValue"), + } +} + +// String returns a human-readable description of this Virtual Network ID +func (id VirtualNetworkId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Virtual Network Name: %q", id.VirtualNetworkName), + } + return fmt.Sprintf("Virtual Network (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/method_createorupdate.go new file mode 100644 index 000000000000..39163471a54a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/method_createorupdate.go @@ -0,0 +1,75 @@ +package virtualnetworks + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *VirtualNetwork +} + +// CreateOrUpdate ... +func (c VirtualNetworksClient) CreateOrUpdate(ctx context.Context, id VirtualNetworkId, input VirtualNetwork) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c VirtualNetworksClient) CreateOrUpdateThenPoll(ctx context.Context, id VirtualNetworkId, input VirtualNetwork) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/method_delete.go new file mode 100644 index 000000000000..2427ac447dfc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/method_delete.go @@ -0,0 +1,70 @@ +package virtualnetworks + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c VirtualNetworksClient) Delete(ctx context.Context, id VirtualNetworkId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c VirtualNetworksClient) DeleteThenPoll(ctx context.Context, id VirtualNetworkId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/method_listbyresourcegroup.go new file mode 100644 index 000000000000..6d4017ecf6ae --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/method_listbyresourcegroup.go @@ -0,0 +1,106 @@ +package virtualnetworks + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualNetwork +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []VirtualNetwork +} + +type ListByResourceGroupCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByResourceGroupCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByResourceGroup ... +func (c VirtualNetworksClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByResourceGroupCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.HybridContainerService/virtualNetworks", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]VirtualNetwork `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByResourceGroupComplete retrieves all the results into a single object +func (c VirtualNetworksClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, VirtualNetworkOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VirtualNetworksClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate VirtualNetworkOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]VirtualNetwork, 0) + + resp, err := c.ListByResourceGroup(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByResourceGroupCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/method_listbysubscription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/method_listbysubscription.go new file mode 100644 index 000000000000..24e73d822f71 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/method_listbysubscription.go @@ -0,0 +1,106 @@ +package virtualnetworks + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualNetwork +} + +type ListBySubscriptionCompleteResult struct { + LatestHttpResponse *http.Response + Items []VirtualNetwork +} + +type ListBySubscriptionCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListBySubscriptionCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListBySubscription ... +func (c VirtualNetworksClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (result ListBySubscriptionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListBySubscriptionCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.HybridContainerService/virtualNetworks", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]VirtualNetwork `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListBySubscriptionComplete retrieves all the results into a single object +func (c VirtualNetworksClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, VirtualNetworkOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VirtualNetworksClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate VirtualNetworkOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]VirtualNetwork, 0) + + resp, err := c.ListBySubscription(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListBySubscriptionCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/method_retrieve.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/method_retrieve.go new file mode 100644 index 000000000000..97fbc7ebd93a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/method_retrieve.go @@ -0,0 +1,54 @@ +package virtualnetworks + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RetrieveOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *VirtualNetwork +} + +// Retrieve ... +func (c VirtualNetworksClient) Retrieve(ctx context.Context, id VirtualNetworkId) (result RetrieveOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model VirtualNetwork + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/method_update.go new file mode 100644 index 000000000000..6300e8e174c9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/method_update.go @@ -0,0 +1,75 @@ +package virtualnetworks + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *VirtualNetwork +} + +// Update ... +func (c VirtualNetworksClient) Update(ctx context.Context, id VirtualNetworkId, input VirtualNetworksPatch) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c VirtualNetworksClient) UpdateThenPoll(ctx context.Context, id VirtualNetworkId, input VirtualNetworksPatch) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetwork.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetwork.go new file mode 100644 index 000000000000..d144fa2810ec --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetwork.go @@ -0,0 +1,19 @@ +package virtualnetworks + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetwork struct { + ExtendedLocation *VirtualNetworkExtendedLocation `json:"extendedLocation,omitempty"` + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *VirtualNetworkProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetworkextendedlocation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetworkextendedlocation.go new file mode 100644 index 000000000000..b03e561f99eb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetworkextendedlocation.go @@ -0,0 +1,9 @@ +package virtualnetworks + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetworkExtendedLocation struct { + Name *string `json:"name,omitempty"` + Type *ExtendedLocationTypes `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetworkproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetworkproperties.go new file mode 100644 index 000000000000..8715a8e1721f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetworkproperties.go @@ -0,0 +1,16 @@ +package virtualnetworks + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetworkProperties struct { + DnsServers *[]string `json:"dnsServers,omitempty"` + Gateway *string `json:"gateway,omitempty"` + IPAddressPrefix *string `json:"ipAddressPrefix,omitempty"` + InfraVnetProfile *VirtualNetworkPropertiesInfraVnetProfile `json:"infraVnetProfile,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + Status *VirtualNetworkPropertiesStatus `json:"status,omitempty"` + VMipPool *[]VirtualNetworkPropertiesVMipPoolInlined `json:"vmipPool,omitempty"` + VipPool *[]VirtualNetworkPropertiesVipPoolInlined `json:"vipPool,omitempty"` + VlanID *int64 `json:"vlanID,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetworkpropertiesinfravnetprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetworkpropertiesinfravnetprofile.go new file mode 100644 index 000000000000..75ebed49c53e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetworkpropertiesinfravnetprofile.go @@ -0,0 +1,8 @@ +package virtualnetworks + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetworkPropertiesInfraVnetProfile struct { + Hci *VirtualNetworkPropertiesInfraVnetProfileHci `json:"hci,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetworkpropertiesinfravnetprofilehci.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetworkpropertiesinfravnetprofilehci.go new file mode 100644 index 000000000000..1a56907ec8c4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetworkpropertiesinfravnetprofilehci.go @@ -0,0 +1,10 @@ +package virtualnetworks + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetworkPropertiesInfraVnetProfileHci struct { + MocGroup *string `json:"mocGroup,omitempty"` + MocLocation *string `json:"mocLocation,omitempty"` + MocVnetName *string `json:"mocVnetName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetworkpropertiesstatus.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetworkpropertiesstatus.go new file mode 100644 index 000000000000..d472b60c84e7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetworkpropertiesstatus.go @@ -0,0 +1,8 @@ +package virtualnetworks + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetworkPropertiesStatus struct { + OperationStatus *VirtualNetworkPropertiesStatusOperationStatus `json:"operationStatus,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetworkpropertiesstatusoperationstatus.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetworkpropertiesstatusoperationstatus.go new file mode 100644 index 000000000000..7a56e25a6782 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetworkpropertiesstatusoperationstatus.go @@ -0,0 +1,10 @@ +package virtualnetworks + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetworkPropertiesStatusOperationStatus struct { + Error *VirtualNetworkPropertiesStatusOperationStatusError `json:"error,omitempty"` + OperationId *string `json:"operationId,omitempty"` + Status *string `json:"status,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetworkpropertiesstatusoperationstatuserror.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetworkpropertiesstatusoperationstatuserror.go new file mode 100644 index 000000000000..29d4c7d1585c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetworkpropertiesstatusoperationstatuserror.go @@ -0,0 +1,9 @@ +package virtualnetworks + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetworkPropertiesStatusOperationStatusError struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetworkpropertiesvippoolinlined.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetworkpropertiesvippoolinlined.go new file mode 100644 index 000000000000..f58acc03b90b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetworkpropertiesvippoolinlined.go @@ -0,0 +1,9 @@ +package virtualnetworks + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetworkPropertiesVipPoolInlined struct { + EndIP *string `json:"endIP,omitempty"` + StartIP *string `json:"startIP,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetworkpropertiesvmippoolinlined.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetworkpropertiesvmippoolinlined.go new file mode 100644 index 000000000000..3435820cb246 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetworkpropertiesvmippoolinlined.go @@ -0,0 +1,9 @@ +package virtualnetworks + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetworkPropertiesVMipPoolInlined struct { + EndIP *string `json:"endIP,omitempty"` + StartIP *string `json:"startIP,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetworkspatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetworkspatch.go new file mode 100644 index 000000000000..d2fc152d8038 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/model_virtualnetworkspatch.go @@ -0,0 +1,8 @@ +package virtualnetworks + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetworksPatch struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/predicates.go new file mode 100644 index 000000000000..34e415f32c22 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/predicates.go @@ -0,0 +1,32 @@ +package virtualnetworks + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetworkOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p VirtualNetworkOperationPredicate) Matches(input VirtualNetwork) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/version.go new file mode 100644 index 000000000000..d9a791b90241 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/version.go @@ -0,0 +1,12 @@ +package virtualnetworks + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-01-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/virtualnetworks/%s", defaultApiVersion) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index a51260d8ee74..8a17622a3de1 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -561,6 +561,7 @@ github.com/hashicorp/go-azure-sdk/resource-manager/healthcareapis/2022-12-01/iot github.com/hashicorp/go-azure-sdk/resource-manager/healthcareapis/2022-12-01/resource github.com/hashicorp/go-azure-sdk/resource-manager/healthcareapis/2022-12-01/workspaces github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances +github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privateendpointconnections From ae2990cf3329b81a155935fa29ebfac7404d328a Mon Sep 17 00:00:00 2001 From: teowa <104055472+teowa@users.noreply.github.com> Date: Fri, 16 Aug 2024 09:52:39 +0000 Subject: [PATCH 04/17] wip --- ...kubernetes_provisioned_cluster_resource.go | 464 ++++++++++-------- 1 file changed, 246 insertions(+), 218 deletions(-) diff --git a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go index 65d00a664093..8891233db2de 100644 --- a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go +++ b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go @@ -63,7 +63,6 @@ func (ArcKubernetesProvisionedClusterInstanceResource) ModelObject() interface{} type ArcKubernetesProvisionedClusterInstanceResourceModel struct { AgentPoolProfile []ProvisionedClusterInstanceAgentPoolProfile `tfschema:"agent_pool_profile"` - AutoScalerProfile []ProvisionedClusterInstanceAutoScalerProfile `tfschema:"auto_scaler_profile"` CloudProviderProfile []ProvisionedClusterInstanceCloudProviderProfile `tfschema:"cloud_provider_profile"` ConnectedClusterID string `tfschema:"connected_cluster_id"` ControlPlaneProfile []ProvisionedClusterInstanceControlPlaneProfile `tfschema:"control_plane_profile"` @@ -76,17 +75,17 @@ type ArcKubernetesProvisionedClusterInstanceResourceModel struct { } type ProvisionedClusterInstanceAgentPoolProfile struct { - AutoScalingEnabled bool `tfschema:"auto_scaling_enabled"` - Count int64 `tfschema:"count"` - MaxCount int64 `tfschema:"max_count"` - MaxPods int64 `tfschema:"max_pods"` - MinCount int64 `tfschema:"min_count"` - Name string `tfschema:"name"` - NodeLabels map[string]interface{} `tfschema:"node_labels"` - NodeTaints []string `tfschema:"node_taints"` - OsSku string `tfschema:"os_sku"` - OsType string `tfschema:"os_type"` - VmSize string `tfschema:"vm_size"` + AutoScalingEnabled bool `tfschema:"auto_scaling_enabled"` + Count int64 `tfschema:"count"` + MaxCount int64 `tfschema:"max_count"` + MaxPods int64 `tfschema:"max_pods"` + MinCount int64 `tfschema:"min_count"` + Name string `tfschema:"name"` + NodeLabels map[string]string `tfschema:"node_labels"` + NodeTaints []string `tfschema:"node_taints"` + OsSku string `tfschema:"os_sku"` + OsType string `tfschema:"os_type"` + VmSize string `tfschema:"vm_size"` } type ProvisionedClusterInstanceAutoScalerProfile struct { @@ -166,129 +165,10 @@ func (ArcKubernetesProvisionedClusterInstanceResource) Arguments() map[string]*p ValidateFunc: customlocations.ValidateCustomLocationID, }, - "auto_scaler_profile": { - Type: pluginsdk.TypeList, - Required: true, - ForceNew: true, - MaxItems: 1, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "balance_similar_node_groups": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringIsNotEmpty, - }, - "expander": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringInSlice([]string{ - string(provisionedclusterinstances.ExpanderLeastNegativewaste), - string(provisionedclusterinstances.ExpanderMostNegativepods), - string(provisionedclusterinstances.ExpanderPriority), - string(provisionedclusterinstances.ExpanderRandom), - }, false), - }, - "max_empty_bulk_delete": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringIsNotEmpty, - }, - "max_graceful_termination_sec": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringIsNotEmpty, - }, - "max_node_provision_time": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringIsNotEmpty, - }, - "max_total_unready_percentage": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringIsNotEmpty, - }, - "new_pod_scale_up_delay": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringIsNotEmpty, - }, - "ok_total_unready_count": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringIsNotEmpty, - }, - "scan_interval": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringIsNotEmpty, - }, - "scale_down_delay_after_add": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringIsNotEmpty, - }, - "scale_down_delay_after_delete": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringIsNotEmpty, - }, - "scale_down_delay_after_failure": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringIsNotEmpty, - }, - "scale_down_unneeded_time": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringIsNotEmpty, - }, - "scale_down_unready_time": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringIsNotEmpty, - }, - "scale_down_utilization_threshold": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringIsNotEmpty, - }, - "skip_nodes_with_local_storage": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringIsNotEmpty, - }, - "skip_nodes_with_system_pods": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringIsNotEmpty, - }, - }, - }, - }, - "agent_pool_profile": { Type: pluginsdk.TypeList, Required: true, ForceNew: true, - MaxItems: 1, Elem: &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ "name": { @@ -435,10 +315,9 @@ func (ArcKubernetesProvisionedClusterInstanceResource) Arguments() map[string]*p Required: true, ValidateFunc: validation.StringIsNotEmpty, }, - "linux_profile": { Type: pluginsdk.TypeList, - Required: true, + Optional: true, ForceNew: true, MaxItems: 1, Elem: &pluginsdk.Resource{ @@ -558,19 +437,21 @@ func (r ArcKubernetesProvisionedClusterInstanceResource) Create() sdk.ResourceFu return fmt.Errorf("decoding: %+v", err) } - id, err := connectedclusters.ParseConnectedClusterID(config.ConnectedClusterID) + connectedClusterId, err := connectedclusters.ParseConnectedClusterID(config.ConnectedClusterID) if err != nil { return err } - scopeId := commonids.NewScopeID(id.ID()) + scopeId := commonids.NewScopeID(connectedClusterId.ID()) + // TODO: the id should use resourceids.ResourceId + provisionedClusterInstanceId := connectedClusterId.ID() + ArcKubernetesProvisionedClusterInstanceResourceIdSuffix existing, err := client.ProvisionedClusterInstancesGet(ctx, scopeId) if err != nil && !response.WasNotFound(existing.HttpResponse) { - return fmt.Errorf("checking for presence of existing %s: %+v", id, err) + return fmt.Errorf("checking for presence of existing %s: %+v", provisionedClusterInstanceId, err) } if !response.WasNotFound(existing.HttpResponse) { - return metadata.ResourceRequiresImport(r.ResourceType(), id) + return metadata.ResourceRequiresImport(r.ResourceType(), scopeId) } payload := provisionedclusterinstances.ProvisionedCluster{ @@ -578,13 +459,23 @@ func (r ArcKubernetesProvisionedClusterInstanceResource) Create() sdk.ResourceFu Name: pointer.To(config.CustomLocationId), Type: pointer.To(provisionedclusterinstances.ExtendedLocationTypesCustomLocation), }, + Properties: &provisionedclusterinstances.ProvisionedClusterProperties{ + AgentPoolProfiles: expandProvisionedClusterAgentPoolProfiles(config.AgentPoolProfile), + CloudProviderProfile: expandProvisionedClusterCloudProviderProfile(config.CloudProviderProfile), + ControlPlane: expandProvisionedClusterControlPlaneProfile(config.ControlPlaneProfile), + KubernetesVersion: pointer.To(config.KubernetesVersion), + LinuxProfile: expandProvisionedClusterLinuxProfile(config.LinuxProfile), + LicenseProfile: expandProvisionedClusterLicenseProfile(config.LicenseProfile), + NetworkProfile: expandProvisionedClusterNetworkProfile(config.NetworkProfile), + StorageProfile: expandProvisionedClusterStorageProfile(config.StorageProfile), + }, } if err := client.ProvisionedClusterInstancesCreateOrUpdateThenPoll(ctx, scopeId, payload); err != nil { - return fmt.Errorf("creating %s: %+v", id, err) + return fmt.Errorf("creating %s: %+v", connectedClusterId, err) } - metadata.SetID(id) + metadata.SetID(connectedClusterId) return nil }, @@ -595,14 +486,19 @@ func (r ArcKubernetesProvisionedClusterInstanceResource) Read() sdk.ResourceFunc return sdk.ResourceFunc{ Timeout: 5 * time.Minute, Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - client := metadata.Client.AzureStackHCI.LogicalNetworks + client := metadata.Client.ArcKubernetes.ProvisionedClusterInstancesClient - id, err := logicalnetworks.ParseLogicalNetworkID(metadata.ResourceData.Id()) - if err != nil { - return err + idRaw := metadata.ResourceData.Id() + scopeId := strings.TrimRight(idRaw, ArcKubernetesProvisionedClusterInstanceResourceIdSuffix) + if !strings.EqualFold(idRaw, scopeId+ArcKubernetesProvisionedClusterInstanceResourceIdSuffix) { + return fmt.Errorf("expect `id` ends with %s, but got %s", ArcKubernetesProvisionedClusterInstanceResourceIdSuffix, idRaw) } - resp, err := client.Get(ctx, *id) + if connectedClusterId, err := connectedclusters.ParseConnectedClusterID(scopeId); err != nil { + return fmt.Errorf("parsing the scope of %q as a Connected Cluster ID: %+v", idRaw, err) + } + + resp, err := client.ProvisionedClusterInstancesGet(ctx, commonids.scopeId) if err != nil { if response.WasNotFound(resp.HttpResponse) { return metadata.MarkAsGone(id) @@ -611,10 +507,7 @@ func (r ArcKubernetesProvisionedClusterInstanceResource) Read() sdk.ResourceFunc return fmt.Errorf("retrieving %s: %+v", id, err) } - schema := ArcKubernetesProvisionedClusterInstanceResourceModel{ - Name: id.LogicalNetworkName, - ResourceGroupName: id.ResourceGroupName, - } + schema := ArcKubernetesProvisionedClusterInstanceResourceModel{} if model := resp.Model; model != nil { schema.Location = location.Normalize(model.Location) @@ -670,10 +563,6 @@ func (r ArcKubernetesProvisionedClusterInstanceResource) Update() sdk.ResourceFu return fmt.Errorf("retrieving %s: `model` was nil", *id) } - if metadata.ResourceData.HasChange("tags") { - parameters.Tags = tags.Expand(model.Tags) - } - if err := client.CreateOrUpdateThenPoll(ctx, *id, *parameters); err != nil { return fmt.Errorf("updating %s: %+v", id, err) } @@ -702,119 +591,258 @@ func (r ArcKubernetesProvisionedClusterInstanceResource) Delete() sdk.ResourceFu } } -func expandStackHCILogicalNetworkSubnet(input []StackHCISubnetModel) *[]logicalnetworks.Subnet { +func expandProvisionedClusterAgentPoolProfiles(input []ProvisionedClusterInstanceAgentPoolProfile) *[]provisionedclusterinstances.NamedAgentPoolProfile { if len(input) == 0 { return nil } - results := make([]logicalnetworks.Subnet, 0) + output := make([]provisionedclusterinstances.NamedAgentPoolProfile, 0) for _, v := range input { - results = append(results, logicalnetworks.Subnet{ - Properties: &logicalnetworks.SubnetPropertiesFormat{ - AddressPrefix: pointer.To(v.AddressPrefix), - IPAllocationMethod: pointer.To(logicalnetworks.IPAllocationMethodEnum(v.IpAllocationMethod)), - IPPools: expandStackHCILogicalNetworkIPPool(v.IpPool), - RouteTable: expandStackHCILogicalNetworkRouteTable(v.Route), - Vlan: pointer.To(v.VlanId), - }, - }) + agentPool := provisionedclusterinstances.NamedAgentPoolProfile{ + Name: pointer.To(v.Name), + Count: pointer.To(v.Count), + EnableAutoScaling: pointer.To(v.AutoScalingEnabled), + MaxCount: pointer.To(v.MaxCount), + MaxPods: pointer.To(v.MaxPods), + MinCount: pointer.To(v.MinCount), + NodeLabels: pointer.To(v.NodeLabels), + NodeTaints: pointer.To(v.NodeTaints), + OsSKU: pointer.To(provisionedclusterinstances.OSSKU(v.OsSku)), + OsType: pointer.To(provisionedclusterinstances.OsType(v.OsType)), + VMSize: pointer.To(v.VmSize), + } + + output = append(output, agentPool) } - return &results + return &output } -func flattenStackHCILogicalNetworkSubnet(input *[]logicalnetworks.Subnet) []StackHCISubnetModel { +func flattenProvisionedClusterAgentPoolProfiles(input *[]provisionedclusterinstances.NamedAgentPoolProfile) []ProvisionedClusterInstanceAgentPoolProfile { if input == nil { - return make([]StackHCISubnetModel, 0) + return make([]ProvisionedClusterInstanceAgentPoolProfile, 0) } - results := make([]StackHCISubnetModel, 0) + output := make([]ProvisionedClusterInstanceAgentPoolProfile, 0) for _, v := range *input { - if v.Properties != nil { - results = append(results, StackHCISubnetModel{ - AddressPrefix: pointer.From(v.Properties.AddressPrefix), - IpAllocationMethod: string(pointer.From(v.Properties.IPAllocationMethod)), - IpPool: flattenStackHCILogicalNetworkIPPool(v.Properties.IPPools), - Route: flattenStackHCILogicalNetworkRouteTable(v.Properties.RouteTable), - VlanId: pointer.From(v.Properties.Vlan), - }) + agentPool := ProvisionedClusterInstanceAgentPoolProfile{ + Name: pointer.From(v.Name), + Count: pointer.From(v.Count), + AutoScalingEnabled: pointer.From(v.EnableAutoScaling), + MaxCount: pointer.From(v.MaxCount), + MaxPods: pointer.From(v.MaxPods), + MinCount: pointer.From(v.MinCount), + NodeLabels: pointer.From(v.NodeLabels), + NodeTaints: pointer.From(v.NodeTaints), + OsSku: string(pointer.From(v.OsSKU)), + OsType: string(pointer.From(v.OsType)), + VmSize: pointer.From(v.VMSize), } + + output = append(output, agentPool) } - return results + return output } -func expandStackHCILogicalNetworkIPPool(input []StackHCIIPPoolModel) *[]logicalnetworks.IPPool { +func expandProvisionedClusterCloudProviderProfile(input []ProvisionedClusterInstanceCloudProviderProfile) *provisionedclusterinstances.CloudProviderProfile { if len(input) == 0 { return nil } - results := make([]logicalnetworks.IPPool, 0) - for _, v := range input { - results = append(results, logicalnetworks.IPPool{ - Start: pointer.To(v.Start), - End: pointer.To(v.End), - }) + v := input[0] + return &provisionedclusterinstances.CloudProviderProfile{ + InfraNetworkProfile: &provisionedclusterinstances.CloudProviderProfileInfraNetworkProfile{ + VnetSubnetIds: pointer.To(v.InfraNetworkProfile[0].VnetSubnetIds), + }, + } +} + +func flattenProvisionedClusterCloudProviderProfile(input *provisionedclusterinstances.CloudProviderProfile) []ProvisionedClusterInstanceCloudProviderProfile { + if input == nil { + return make([]ProvisionedClusterInstanceCloudProviderProfile, 0) + } + + return []ProvisionedClusterInstanceCloudProviderProfile{ + { + InfraNetworkProfile: []ProvisionedClusterInstanceInfraNetworkProfile{ + { + VnetSubnetIds: pointer.From(input.InfraNetworkProfile.VnetSubnetIds), + }, + }, + }, } +} - return &results +func expandProvisionedClusterControlPlaneProfile(input []ProvisionedClusterInstanceControlPlaneProfile) *provisionedclusterinstances.ControlPlaneProfile { + if len(input) == 0 { + return nil + } + + v := input[0] + return &provisionedclusterinstances.ControlPlaneProfile{ + Count: pointer.To(v.Count), + VMSize: pointer.To(v.VmSize), + ControlPlaneEndpoint: &provisionedclusterinstances.ControlPlaneProfileControlPlaneEndpoint{ + HostIP: pointer.To(v.HostIp), + }, + } } -func flattenStackHCILogicalNetworkIPPool(input *[]logicalnetworks.IPPool) []StackHCIIPPoolModel { +func flattenProvisionedClusterControlPlaneProfile(input *provisionedclusterinstances.ControlPlaneProfile) []ProvisionedClusterInstanceControlPlaneProfile { if input == nil { - return make([]StackHCIIPPoolModel, 0) + return make([]ProvisionedClusterInstanceControlPlaneProfile, 0) } - results := make([]StackHCIIPPoolModel, 0) - for _, v := range *input { - results = append(results, StackHCIIPPoolModel{ - Start: pointer.From(v.Start), - End: pointer.From(v.End), - }) + var hostIp string + if input.ControlPlaneEndpoint != nil { + hostIp = pointer.From(input.ControlPlaneEndpoint.HostIP) } - return results + return []ProvisionedClusterInstanceControlPlaneProfile{ + { + Count: pointer.From(input.Count), + VmSize: pointer.From(input.VMSize), + HostIp: hostIp, + }, + } } -func expandStackHCILogicalNetworkRouteTable(input []StackHCIRouteModel) *logicalnetworks.RouteTable { +func expandProvisionedClusterLinuxProfile(input []ProvisionedClusterInstanceLinuxProfile) *provisionedclusterinstances.LinuxProfileProperties { if len(input) == 0 { return nil } - routes := make([]logicalnetworks.Route, 0) - for _, v := range input { - routes = append(routes, logicalnetworks.Route{ - Name: pointer.To(v.Name), - Properties: &logicalnetworks.RoutePropertiesFormat{ - AddressPrefix: pointer.To(v.AddressPrefix), - NextHopIPAddress: pointer.To(v.NextHopIpAddress), - }, + publicKeys := make([]provisionedclusterinstances.LinuxProfilePropertiesSshPublicKeysInlined, 0) + for _, v := range input[0].SshKey { + publicKeys = append(publicKeys, provisionedclusterinstances.LinuxProfilePropertiesSshPublicKeysInlined{ + KeyData: pointer.To(v.KeyData), }) } - return &logicalnetworks.RouteTable{ - Properties: &logicalnetworks.RouteTablePropertiesFormat{ - Routes: pointer.To(routes), + return &provisionedclusterinstances.LinuxProfileProperties{ + Ssh: &provisionedclusterinstances.LinuxProfilePropertiesSsh{ + PublicKeys: &publicKeys, }, } } -func flattenStackHCILogicalNetworkRouteTable(input *logicalnetworks.RouteTable) []StackHCIRouteModel { - if input == nil || input.Properties == nil || input.Properties.Routes == nil { - return make([]StackHCIRouteModel, 0) +func flattenProvisionedClusterLinuxProfile(input *provisionedclusterinstances.LinuxProfileProperties) []ProvisionedClusterInstanceLinuxProfile { + if input == nil || input.Ssh == nil || input.Ssh.PublicKeys == nil { + return nil } - results := make([]StackHCIRouteModel, 0) - for _, v := range *input.Properties.Routes { - route := StackHCIRouteModel{ - Name: pointer.From(v.Name), - } - if v.Properties != nil { - route.AddressPrefix = pointer.From(v.Properties.AddressPrefix) - route.NextHopIpAddress = pointer.From(v.Properties.NextHopIPAddress) + sshKey := make([]ProvisionedClusterInstanceSshKey, 0) + for _, v := range *input.Ssh.PublicKeys { + sshKey = append(sshKey, ProvisionedClusterInstanceSshKey{ + KeyData: pointer.From(v.KeyData), + }) + } + + return []ProvisionedClusterInstanceLinuxProfile{ + { + SshKey: sshKey, + }, + } +} + +func expandProvisionedClusterLicenseProfile(input []ProvisionedClusterInstanceLicenseProfile) *provisionedclusterinstances.ProvisionedClusterLicenseProfile { + if len(input) == 0 { + return nil + } + + v := input[0] + return &provisionedclusterinstances.ProvisionedClusterLicenseProfile{ + AzureHybridBenefit: pointer.To(provisionedclusterinstances.AzureHybridBenefit(v.AzureHybridBenefit)), + } +} + +func flattenProvisionedClusterLicenseProfile(input *provisionedclusterinstances.ProvisionedClusterLicenseProfile) []ProvisionedClusterInstanceLicenseProfile { + if input == nil || input.AzureHybridBenefit == nil { + return make([]ProvisionedClusterInstanceLicenseProfile, 0) + } + + return []ProvisionedClusterInstanceLicenseProfile{ + { + AzureHybridBenefit: string(pointer.From(input.AzureHybridBenefit)), + }, + } +} + +func expandProvisionedClusterNetworkProfile(input []ProvisionedClusterInstanceNetworkProfile) *provisionedclusterinstances.NetworkProfile { + if len(input) == 0 { + return nil + } + + v := input[0] + networkProfile := &provisionedclusterinstances.NetworkProfile{ + NetworkPolicy: pointer.To(provisionedclusterinstances.NetworkPolicy(v.NetworkPolicy)), + PodCidr: pointer.To(v.PodCidr), + } + + if len(v.LoadBalancerProfile) > 0 && v.LoadBalancerProfile[0].Count != 0 { + networkProfile.LoadBalancerProfile = &provisionedclusterinstances.NetworkProfileLoadBalancerProfile{ + Count: pointer.To(v.LoadBalancerProfile[0].Count), } - results = append(results, route) } - return results + return networkProfile +} + +func flattenProvisionedClusterNetworkProfile(input *provisionedclusterinstances.NetworkProfile) []ProvisionedClusterInstanceNetworkProfile { + if input == nil { + return make([]ProvisionedClusterInstanceNetworkProfile, 0) + } + + loadBalancer := make([]ProvisionedClusterInstanceLoadBalancerProfile, 0) + if input.LoadBalancerProfile != nil { + loadBalancer = append(loadBalancer, ProvisionedClusterInstanceLoadBalancerProfile{ + Count: pointer.From(input.LoadBalancerProfile.Count), + }) + } + + return []ProvisionedClusterInstanceNetworkProfile{ + { + NetworkPolicy: string(pointer.From(input.NetworkPolicy)), + PodCidr: pointer.From(input.PodCidr), + LoadBalancerProfile: loadBalancer, + }, + } +} + +func expandProvisionedClusterStorageProfile(input []ProvisionedClusterInstanceStorageProfile) *provisionedclusterinstances.StorageProfile { + if len(input) == 0 { + return nil + } + + v := input[0] + return &provisionedclusterinstances.StorageProfile{ + NfsCsiDriver: &provisionedclusterinstances.StorageProfileNfsCSIDriver{ + Enabled: pointer.To(v.NfsCsiDriverEnabled), + }, + SmbCsiDriver: &provisionedclusterinstances.StorageProfileSmbCSIDriver{ + Enabled: pointer.To(v.SmbCsiDriverEnabled), + }, + } +} + +func flattenProvisionedClusterStorageProfile(input *provisionedclusterinstances.StorageProfile) []ProvisionedClusterInstanceStorageProfile { + if input == nil { + return make([]ProvisionedClusterInstanceStorageProfile, 0) + } + + var nfsCsiDriverEnabled, smbCsiDriverEnabled bool + if input.NfsCsiDriver != nil { + nfsCsiDriverEnabled = pointer.From(input.NfsCsiDriver.Enabled) + } + if input.SmbCsiDriver != nil { + smbCsiDriverEnabled = pointer.From(input.SmbCsiDriver.Enabled) + } + + return []ProvisionedClusterInstanceStorageProfile{ + { + NfsCsiDriverEnabled: nfsCsiDriverEnabled, + SmbCsiDriverEnabled: smbCsiDriverEnabled, + }, + } } From ac4642f9158ccaf3cc4edb23438529b481d991b4 Mon Sep 17 00:00:00 2001 From: teowa <104055472+teowa@users.noreply.github.com> Date: Tue, 20 Aug 2024 07:45:41 +0000 Subject: [PATCH 05/17] wip --- .../arc_kubernetes_cluster_resource.go | 18 +- ...kubernetes_provisioned_cluster_resource.go | 166 +++++------ ...netes_provisioned_cluster_resource_test.go | 212 ++++++++++++++ ...kubernetes_provisioned_cluster_instance.go | 134 +++++++++ ...netes_provisioned_cluster_instance_test.go | 267 ++++++++++++++++++ .../services/arckubernetes/registration.go | 1 + .../services/arckubernetes/resourceids.go | 3 + ...ernetes_provisioned_cluster_instance_id.go | 26 ++ ...es_provisioned_cluster_instance_id_test.go | 91 ++++++ 9 files changed, 833 insertions(+), 85 deletions(-) create mode 100644 internal/services/arckubernetes/parse/arc_kubernetes_provisioned_cluster_instance.go create mode 100644 internal/services/arckubernetes/parse/arc_kubernetes_provisioned_cluster_instance_test.go create mode 100644 internal/services/arckubernetes/resourceids.go create mode 100644 internal/services/arckubernetes/validate/arc_kubernetes_provisioned_cluster_instance_id.go create mode 100644 internal/services/arckubernetes/validate/arc_kubernetes_provisioned_cluster_instance_id_test.go diff --git a/internal/services/arckubernetes/arc_kubernetes_cluster_resource.go b/internal/services/arckubernetes/arc_kubernetes_cluster_resource.go index 09ff06db4ad2..fd11f8b36f12 100644 --- a/internal/services/arckubernetes/arc_kubernetes_cluster_resource.go +++ b/internal/services/arckubernetes/arc_kubernetes_cluster_resource.go @@ -8,6 +8,7 @@ import ( "regexp" "time" + "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" @@ -56,7 +57,7 @@ func resourceArcKubernetesCluster() *pluginsdk.Resource { "agent_public_key_certificate": { Type: pluginsdk.TypeString, - Required: true, + Optional: true, ForceNew: true, ValidateFunc: azValidate.Base64EncodedString, }, @@ -65,6 +66,16 @@ func resourceArcKubernetesCluster() *pluginsdk.Resource { "location": commonschema.Location(), + "kind": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ConflictsWith: []string{"agent_public_key_certificate"}, + ValidateFunc: validation.StringInSlice([]string{ + string(arckubernetes.ConnectedClusterKindProvisionedCluster), + }, false), + }, + "agent_version": { Type: pluginsdk.TypeString, Computed: true, @@ -138,6 +149,9 @@ func resourceArcKubernetesClusterCreate(d *pluginsdk.ResourceData, meta interfac }, Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } + if kindVal := d.Get("kind").(string); kindVal != "" { + props.Kind = pointer.To(arckubernetes.ConnectedClusterKind(kindVal)) + } if err := client.ConnectedClusterCreateThenPoll(ctx, id, props); err != nil { return fmt.Errorf("creating %s: %+v", id, err) @@ -173,7 +187,7 @@ func resourceArcKubernetesClusterRead(d *pluginsdk.ResourceData, meta interface{ if err := d.Set("identity", identity.FlattenSystemAssigned(&model.Identity)); err != nil { return fmt.Errorf("setting `identity`: %+v", err) } - + d.Set("kind", string(pointer.From(model.Kind))) d.Set("location", location.Normalize(model.Location)) props := model.Properties d.Set("agent_public_key_certificate", props.AgentPublicKeyCertificate) diff --git a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go index 8891233db2de..112038805835 100644 --- a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go +++ b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go @@ -4,26 +4,23 @@ import ( "context" "fmt" "regexp" - "strings" "time" "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" - "github.com/hashicorp/go-azure-helpers/resourcemanager/location" - "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" "github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2024-01-01/logicalnetworks" "github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations" "github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances" "github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks" "github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2024-01-01/connectedclusters" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/arckubernetes/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/arckubernetes/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" ) -const ArcKubernetesProvisionedClusterInstanceResourceIdSuffix = "/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default" - var ( _ sdk.Resource = ArcKubernetesProvisionedClusterInstanceResource{} _ sdk.ResourceWithUpdate = ArcKubernetesProvisionedClusterInstanceResource{} @@ -32,25 +29,7 @@ var ( type ArcKubernetesProvisionedClusterInstanceResource struct{} func (ArcKubernetesProvisionedClusterInstanceResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { - return func(val interface{}, key string) (warns []string, errs []error) { - idRaw, ok := val.(string) - if !ok { - errs = append(errs, fmt.Errorf("expected `id` to be a string but got %+v", val)) - return - } - - scopeId := strings.TrimRight(idRaw, ArcKubernetesProvisionedClusterInstanceResourceIdSuffix) - if !strings.EqualFold(idRaw, scopeId+ArcKubernetesProvisionedClusterInstanceResourceIdSuffix) { - errs = append(errs, fmt.Errorf("expect `id` ends with %s, but got %s", ArcKubernetesProvisionedClusterInstanceResourceIdSuffix, idRaw)) - } - - if _, err := connectedclusters.ParseConnectedClusterID(scopeId); err != nil { - errs = append(errs, fmt.Errorf("parsing the scope of %q as a Connected Cluster ID: %+v", idRaw, err)) - return - } - - return - } + return validate.ArcKubernetesProvisionedClusterInstanceID } func (ArcKubernetesProvisionedClusterInstanceResource) ResourceType() string { @@ -64,7 +43,7 @@ func (ArcKubernetesProvisionedClusterInstanceResource) ModelObject() interface{} type ArcKubernetesProvisionedClusterInstanceResourceModel struct { AgentPoolProfile []ProvisionedClusterInstanceAgentPoolProfile `tfschema:"agent_pool_profile"` CloudProviderProfile []ProvisionedClusterInstanceCloudProviderProfile `tfschema:"cloud_provider_profile"` - ConnectedClusterID string `tfschema:"connected_cluster_id"` + ClusterID string `tfschema:"cluster_id"` ControlPlaneProfile []ProvisionedClusterInstanceControlPlaneProfile `tfschema:"control_plane_profile"` CustomLocationId string `tfschema:"custom_location_id"` KubernetesVersion string `tfschema:"kubernetes_version"` @@ -88,26 +67,6 @@ type ProvisionedClusterInstanceAgentPoolProfile struct { VmSize string `tfschema:"vm_size"` } -type ProvisionedClusterInstanceAutoScalerProfile struct { - BalanceSimilarNodeGroups string `tfschema:"balance_similar_node_groups"` - Expander string `tfschema:"expander"` - MaxEmptyBulkDelete string `tfschema:"max_empty_bulk_delete"` - MaxGracefulTerminationSec string `tfschema:"max_graceful_termination_sec"` - MaxNodeProvisionTime string `tfschema:"max_node_provision_time"` - MaxTotalUnreadyPercentage string `tfschema:"max_total_unready_percentage"` - NewPodScaleUpDelay string `tfschema:"new_pod_scale_up_delay"` - OkTotalUnreadyCount string `tfschema:"ok_total_unready_count"` - ScanInterval string `tfschema:"scan_interval"` - ScaleDownDelayAfterAdd string `tfschema:"scale_down_delay_after_add"` - ScaleDownDelayAfterDelete string `tfschema:"scale_down_delay_after_delete"` - ScaleDownDelayAfterFailure string `tfschema:"scale_down_delay_after_failure"` - ScaleDownUnneededTime string `tfschema:"scale_down_unneeded_time"` - ScaleDownUnreadyTime string `tfschema:"scale_down_unready_time"` - ScaleDownUtilizationThreshold string `tfschema:"scale_down_utilization_threshold"` - SkipNodesWithLocalStorage string `tfschema:"skip_nodes_with_local_storage"` - SkipNodesWithSystemPods string `tfschema:"skip_nodes_with_system_pods"` -} - type ProvisionedClusterInstanceCloudProviderProfile struct { InfraNetworkProfile []ProvisionedClusterInstanceInfraNetworkProfile `tfschema:"infra_network_profile"` } @@ -151,7 +110,7 @@ type ProvisionedClusterInstanceStorageProfile struct { func (ArcKubernetesProvisionedClusterInstanceResource) Arguments() map[string]*pluginsdk.Schema { return map[string]*pluginsdk.Schema{ - "connected_cluster_id": { + "cluster_id": { Type: pluginsdk.TypeString, Required: true, ForceNew: true, @@ -437,21 +396,20 @@ func (r ArcKubernetesProvisionedClusterInstanceResource) Create() sdk.ResourceFu return fmt.Errorf("decoding: %+v", err) } - connectedClusterId, err := connectedclusters.ParseConnectedClusterID(config.ConnectedClusterID) + connectedClusterId, err := connectedclusters.ParseConnectedClusterID(config.ClusterID) if err != nil { return err } scopeId := commonids.NewScopeID(connectedClusterId.ID()) - // TODO: the id should use resourceids.ResourceId - provisionedClusterInstanceId := connectedClusterId.ID() + ArcKubernetesProvisionedClusterInstanceResourceIdSuffix + provisionedClusterInstanceId := parse.NewArcKubernetesProvisionedClusterInstanceID(connectedClusterId.SubscriptionId, connectedClusterId.ResourceGroupName, connectedClusterId.ConnectedClusterName, "default") existing, err := client.ProvisionedClusterInstancesGet(ctx, scopeId) if err != nil && !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", provisionedClusterInstanceId, err) } if !response.WasNotFound(existing.HttpResponse) { - return metadata.ResourceRequiresImport(r.ResourceType(), scopeId) + return metadata.ResourceRequiresImport(r.ResourceType(), provisionedClusterInstanceId) } payload := provisionedclusterinstances.ProvisionedCluster{ @@ -472,10 +430,10 @@ func (r ArcKubernetesProvisionedClusterInstanceResource) Create() sdk.ResourceFu } if err := client.ProvisionedClusterInstancesCreateOrUpdateThenPoll(ctx, scopeId, payload); err != nil { - return fmt.Errorf("creating %s: %+v", connectedClusterId, err) + return fmt.Errorf("creating %s: %+v", provisionedClusterInstanceId, err) } - metadata.SetID(connectedClusterId) + metadata.SetID(provisionedClusterInstanceId) return nil }, @@ -488,31 +446,28 @@ func (r ArcKubernetesProvisionedClusterInstanceResource) Read() sdk.ResourceFunc Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { client := metadata.Client.ArcKubernetes.ProvisionedClusterInstancesClient - idRaw := metadata.ResourceData.Id() - scopeId := strings.TrimRight(idRaw, ArcKubernetesProvisionedClusterInstanceResourceIdSuffix) - if !strings.EqualFold(idRaw, scopeId+ArcKubernetesProvisionedClusterInstanceResourceIdSuffix) { - return fmt.Errorf("expect `id` ends with %s, but got %s", ArcKubernetesProvisionedClusterInstanceResourceIdSuffix, idRaw) + id, err := parse.ArcKubernetesProvisionedClusterInstanceID(metadata.ResourceData.Id()) + if err != nil { + return err } - if connectedClusterId, err := connectedclusters.ParseConnectedClusterID(scopeId); err != nil { - return fmt.Errorf("parsing the scope of %q as a Connected Cluster ID: %+v", idRaw, err) - } + connectedClusterId := connectedclusters.NewConnectedClusterID(id.SubscriptionId, id.ResourceGroup, id.ConnectedClusterName) + scopeId := commonids.NewScopeID(connectedClusterId.ID()) - resp, err := client.ProvisionedClusterInstancesGet(ctx, commonids.scopeId) + resp, err := client.ProvisionedClusterInstancesGet(ctx, scopeId) if err != nil { if response.WasNotFound(resp.HttpResponse) { return metadata.MarkAsGone(id) } - return fmt.Errorf("retrieving %s: %+v", id, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - schema := ArcKubernetesProvisionedClusterInstanceResourceModel{} + schema := ArcKubernetesProvisionedClusterInstanceResourceModel{ + ClusterID: connectedClusterId.ID(), + } if model := resp.Model; model != nil { - schema.Location = location.Normalize(model.Location) - schema.Tags = tags.Flatten(model.Tags) - if model.ExtendedLocation != nil && model.ExtendedLocation.Name != nil { customLocationId, err := customlocations.ParseCustomLocationIDInsensitively(*model.ExtendedLocation.Name) if err != nil { @@ -523,12 +478,14 @@ func (r ArcKubernetesProvisionedClusterInstanceResource) Read() sdk.ResourceFunc } if props := model.Properties; props != nil { - schema.Subnet = flattenStackHCILogicalNetworkSubnet(props.Subnets) - schema.VirtualSwitchName = pointer.From(props.VMSwitchName) - - if props.DhcpOptions != nil { - schema.DNSServers = pointer.From(props.DhcpOptions.DnsServers) - } + schema.CloudProviderProfile = flattenProvisionedClusterCloudProviderProfile(props.CloudProviderProfile) + schema.AgentPoolProfile = flattenProvisionedClusterAgentPoolProfiles(props.AgentPoolProfiles) + schema.ControlPlaneProfile = flattenProvisionedClusterControlPlaneProfile(props.ControlPlane) + schema.KubernetesVersion = pointer.From(props.KubernetesVersion) + schema.LinuxProfile = flattenProvisionedClusterLinuxProfile(props.LinuxProfile) + schema.LicenseProfile = flattenProvisionedClusterLicenseProfile(props.LicenseProfile) + schema.NetworkProfile = flattenProvisionedClusterNetworkProfile(props.NetworkProfile) + schema.StorageProfile = flattenProvisionedClusterStorageProfile(props.StorageProfile) } } @@ -541,29 +498,64 @@ func (r ArcKubernetesProvisionedClusterInstanceResource) Update() sdk.ResourceFu return sdk.ResourceFunc{ Timeout: 30 * time.Minute, Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - client := metadata.Client.AzureStackHCI.LogicalNetworks + client := metadata.Client.ArcKubernetes.ProvisionedClusterInstancesClient - id, err := logicalnetworks.ParseLogicalNetworkID(metadata.ResourceData.Id()) + var config ArcKubernetesProvisionedClusterInstanceResourceModel + if err := metadata.Decode(&config); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + id, err := parse.ArcKubernetesProvisionedClusterInstanceID(metadata.ResourceData.Id()) if err != nil { return err } - var model ArcKubernetesProvisionedClusterInstanceResourceModel - if err := metadata.Decode(&model); err != nil { - return fmt.Errorf("decoding: %+v", err) - } + connectedClusterId := connectedclusters.NewConnectedClusterID(id.SubscriptionId, id.ResourceGroup, id.ConnectedClusterName) + scopeId := commonids.NewScopeID(connectedClusterId.ID()) - resp, err := client.Get(ctx, *id) + resp, err := client.ProvisionedClusterInstancesGet(ctx, scopeId) if err != nil { return fmt.Errorf("retrieving %s: %+v", *id, err) } parameters := resp.Model - if parameters == nil { + if parameters == nil || parameters.Properties == nil { return fmt.Errorf("retrieving %s: `model` was nil", *id) } - if err := client.CreateOrUpdateThenPoll(ctx, *id, *parameters); err != nil { + if metadata.ResourceData.HasChange("agent_pool_profile") { + parameters.Properties.AgentPoolProfiles = expandProvisionedClusterAgentPoolProfiles(config.AgentPoolProfile) + } + + if metadata.ResourceData.HasChange("cloud_provider_profile") { + parameters.Properties.CloudProviderProfile = expandProvisionedClusterCloudProviderProfile(config.CloudProviderProfile) + } + + if metadata.ResourceData.HasChange("control_plane_profile") { + parameters.Properties.ControlPlane = expandProvisionedClusterControlPlaneProfile(config.ControlPlaneProfile) + } + + if metadata.ResourceData.HasChange("kubernetes_version") { + parameters.Properties.KubernetesVersion = pointer.To(config.KubernetesVersion) + } + + if metadata.ResourceData.HasChange("linux_profile") { + parameters.Properties.LinuxProfile = expandProvisionedClusterLinuxProfile(config.LinuxProfile) + } + + if metadata.ResourceData.HasChange("license_profile") { + parameters.Properties.LicenseProfile = expandProvisionedClusterLicenseProfile(config.LicenseProfile) + } + + if metadata.ResourceData.HasChange("network_profile") { + parameters.Properties.NetworkProfile = expandProvisionedClusterNetworkProfile(config.NetworkProfile) + } + + if metadata.ResourceData.HasChange("storage_profile") { + parameters.Properties.StorageProfile = expandProvisionedClusterStorageProfile(config.StorageProfile) + } + + if err := client.ProvisionedClusterInstancesCreateOrUpdateThenPoll(ctx, scopeId, *parameters); err != nil { return fmt.Errorf("updating %s: %+v", id, err) } return nil @@ -575,14 +567,22 @@ func (r ArcKubernetesProvisionedClusterInstanceResource) Delete() sdk.ResourceFu return sdk.ResourceFunc{ Timeout: 30 * time.Minute, Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - client := metadata.Client.AzureStackHCI.LogicalNetworks + client := metadata.Client.ArcKubernetes.ProvisionedClusterInstancesClient - id, err := logicalnetworks.ParseLogicalNetworkID(metadata.ResourceData.Id()) + var config ArcKubernetesProvisionedClusterInstanceResourceModel + if err := metadata.Decode(&config); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + id, err := parse.ArcKubernetesProvisionedClusterInstanceID(metadata.ResourceData.Id()) if err != nil { return err } - if err := client.DeleteThenPoll(ctx, *id); err != nil { + connectedClusterId := connectedclusters.NewConnectedClusterID(id.SubscriptionId, id.ResourceGroup, id.ConnectedClusterName) + scopeId := commonids.NewScopeID(connectedClusterId.ID()) + + if err := client.ProvisionedClusterInstancesDeleteThenPoll(ctx, scopeId); err != nil { return fmt.Errorf("deleting %s: %+v", id, err) } diff --git a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go index ebd64ed2a8ec..18a9691f8771 100644 --- a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go +++ b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go @@ -1 +1,213 @@ package arckubernetes_test + +import ( + "context" + "fmt" + "os" + "testing" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2024-01-01/connectedclusters" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/arckubernetes/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +// https://learn.microsoft.com/en-us/azure/aks/hybrid/aks-create-clusters-cli?toc=%2Fazure-stack%2Fhci%2Ftoc.json&bc=%2Fazure-stack%2Fbreadcrumb%2Ftoc.json#before-you-begin +// The resource can only be created on the customlocation generated after HCI deployment +const ( + customLocationIdEnv = "ARM_TEST_STACK_HCI_CUSTOM_LOCATION_ID" +) + +type ArcKubernetesProvisionedClusterInstanceResource struct{} + +func TestAccArcKubernetesProvisionedClusterInstance_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_arc_kubernetes_provisioned_cluster_instance", "test") + r := ArcKubernetesProvisionedClusterInstanceResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccArcKubernetesProvisionedClusterInstance_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_arc_kubernetes_provisioned_cluster_instance", "test") + r := ArcKubernetesProvisionedClusterInstanceResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + { + Config: r.requiresImport(data), + ExpectError: acceptance.RequiresImportError(data.ResourceType), + }, + }) +} + +func (r ArcKubernetesProvisionedClusterInstanceResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + client := clients.ArcKubernetes.ProvisionedClusterInstancesClient + + id, err := parse.ArcKubernetesProvisionedClusterInstanceID(state.ID) + if err != nil { + return nil, err + } + + connectedClusterId := connectedclusters.NewConnectedClusterID(id.SubscriptionId, id.ResourceGroup, id.ConnectedClusterName) + scopeId := commonids.NewScopeID(connectedClusterId.ID()) + + resp, err := client.ProvisionedClusterInstancesGet(ctx, scopeId) + if err != nil { + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) + } + + return pointer.To(resp.Model != nil), nil +} + +func (r ArcKubernetesProvisionedClusterInstanceResource) basic(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%[1]s + +resource "azurerm_arc_kubernetes_provisioned_cluster_instance" "test" { + name = "acctest-akpci-%[2]d" + cluster_id = azurerm_arc_kubernetes_cluster.test.id + custom_location_id = "%[3]s" + kubernetes_version = "1.28.5" + + agent_pool_profile { + count = 1 + name = "nodepool1" + os_sku = "CBLMariner" + os_type = "Linux" + vm_size = "Standard_A4_v2" + } + + cloud_provider_profile { + infra_network_profile { + vnet_subnet_ids = [azurerm_stack_hci_logical_network.test.id] + } + } + + control_plane_profile { + count = 1 + host_ip = "192.168.1.190" + vm_size = "Standard_A4_v2" + } + + license_profile { + azure_hybrid_benefit = "False" + } + + linux_profile { + ssh_key { + key_data = tls_private_key.rsaKey.public_key_openssh + } + } + + network_profile { + network_policy = "calico" + pod_cidr = "10.244.0.0/16" + } + + storage_profile { + smb_csi_driver_enabled = false + nfs_csi_driver_enabled = false + } +} +`, template, data.RandomInteger, os.Getenv(customLocationIdEnv)) +} + +func (r ArcKubernetesProvisionedClusterInstanceResource) requiresImport(data acceptance.TestData) string { + config := r.basic(data) + return fmt.Sprintf(` +%s + +resource "azurerm_arc_kubernetes_provisioned_cluster_instance" "import" { + name = azurerm_arc_kubernetes_provisioned_cluster_instance.test.name + cluster_id = azurerm_arc_kubernetes_provisioned_cluster_instance.test.cluster_id + namespace = azurerm_arc_kubernetes_provisioned_cluster_instance.test.namespace + + git_repository { + url = "https://github.com/Azure/arc-k8s-demo" + reference_type = "branch" + reference_value = "main" + } + + kustomizations { + name = "kustomization-1" + } + + depends_on = [ + azurerm_arc_kubernetes_cluster_extension.test + ] +} +`, config) +} + +func (r ArcKubernetesProvisionedClusterInstanceResource) template(data acceptance.TestData) string { + return fmt.Sprintf(` +resource "tls_private_key" "rsaKey" { + algorithm = "RSA" + rsa_bits = 4096 +} + +resource "azurerm_resource_group" "test" { + name = "acctest-akpci-%[1]d" + location = "%[2]s" +} + +resource "azurerm_stack_hci_logical_network" "test" { + name = "acctest-ln-%[1]d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + custom_location_id = "%[3]s" + virtual_switch_name = "ConvergedSwitch(managementcompute)" + dns_servers = ["192.168.1.254"] + + subnet { + ip_allocation_method = "Static" + address_prefix = "192.168.1.0/24" + ip_pool { + start = "192.168.1.171" + end = "192.168.1.190" + } + route { + name = "test-route" + address_prefix = "10.0.0.0/0" + next_hop_ip_address = "192.168.1.1" + } + } +} + +# from https://github.com/Azure/Edge-infrastructure-quickstart-template/blob/main/modules/aks-arc/readiness.ps1 +resource "terraform_data" "waitAksVhdReady" { + provisioner "local-exec" { + command = "powershell.exe -ExecutionPolicy Bypass -NoProfile -File testdata/readiness.ps1 -customLocationResourceId '%[2]s' -kubernetesVersion '1.28.5' -osSku CBLMariner" + interpreter = ["PowerShell", "-Command"] + } +} + +resource "azurerm_arc_kubernetes_cluster" "test" { + name = "acctest-akcc-%[1]d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + kind = "ProvisionedCluster" + identity { + type = "SystemAssigned" + } + depends_on = [terraform_data.waitAksVhdReady] +} + +`, data.RandomInteger, data.Locations.Primary, os.Getenv(customLocationIdEnv)) +} diff --git a/internal/services/arckubernetes/parse/arc_kubernetes_provisioned_cluster_instance.go b/internal/services/arckubernetes/parse/arc_kubernetes_provisioned_cluster_instance.go new file mode 100644 index 000000000000..aff014dbdb32 --- /dev/null +++ b/internal/services/arckubernetes/parse/arc_kubernetes_provisioned_cluster_instance.go @@ -0,0 +1,134 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +type ArcKubernetesProvisionedClusterInstanceId struct { + SubscriptionId string + ResourceGroup string + ConnectedClusterName string + ProvisionedClusterInstanceName string +} + +func NewArcKubernetesProvisionedClusterInstanceID(subscriptionId, resourceGroup, connectedClusterName, provisionedClusterInstanceName string) ArcKubernetesProvisionedClusterInstanceId { + return ArcKubernetesProvisionedClusterInstanceId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + ConnectedClusterName: connectedClusterName, + ProvisionedClusterInstanceName: provisionedClusterInstanceName, + } +} + +func (id ArcKubernetesProvisionedClusterInstanceId) String() string { + segments := []string{ + fmt.Sprintf("Provisioned Cluster Instance Name %q", id.ProvisionedClusterInstanceName), + fmt.Sprintf("Connected Cluster Name %q", id.ConnectedClusterName), + fmt.Sprintf("Resource Group %q", id.ResourceGroup), + } + segmentsStr := strings.Join(segments, " / ") + return fmt.Sprintf("%s: (%s)", "Arc Kubernetes Provisioned Cluster Instance", segmentsStr) +} + +func (id ArcKubernetesProvisionedClusterInstanceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Kubernetes/connectedClusters/%s/providers/Microsoft.HybridContainerService/provisionedClusterInstances/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.ConnectedClusterName, id.ProvisionedClusterInstanceName) +} + +// ArcKubernetesProvisionedClusterInstanceID parses a ArcKubernetesProvisionedClusterInstance ID into an ArcKubernetesProvisionedClusterInstanceId struct +func ArcKubernetesProvisionedClusterInstanceID(input string) (*ArcKubernetesProvisionedClusterInstanceId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, fmt.Errorf("parsing %q as an ArcKubernetesProvisionedClusterInstance ID: %+v", input, err) + } + + resourceId := ArcKubernetesProvisionedClusterInstanceId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + if resourceId.ConnectedClusterName, err = id.PopSegment("connectedClusters"); err != nil { + return nil, err + } + if resourceId.ProvisionedClusterInstanceName, err = id.PopSegment("provisionedClusterInstances"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} + +// ArcKubernetesProvisionedClusterInstanceIDInsensitively parses an ArcKubernetesProvisionedClusterInstance ID into an ArcKubernetesProvisionedClusterInstanceId struct, insensitively +// This should only be used to parse an ID for rewriting, the ArcKubernetesProvisionedClusterInstanceID +// method should be used instead for validation etc. +// +// Whilst this may seem strange, this enables Terraform have consistent casing +// which works around issues in Core, whilst handling broken API responses. +func ArcKubernetesProvisionedClusterInstanceIDInsensitively(input string) (*ArcKubernetesProvisionedClusterInstanceId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := ArcKubernetesProvisionedClusterInstanceId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + // find the correct casing for the 'connectedClusters' segment + connectedClustersKey := "connectedClusters" + for key := range id.Path { + if strings.EqualFold(key, connectedClustersKey) { + connectedClustersKey = key + break + } + } + if resourceId.ConnectedClusterName, err = id.PopSegment(connectedClustersKey); err != nil { + return nil, err + } + + // find the correct casing for the 'provisionedClusterInstances' segment + provisionedClusterInstancesKey := "provisionedClusterInstances" + for key := range id.Path { + if strings.EqualFold(key, provisionedClusterInstancesKey) { + provisionedClusterInstancesKey = key + break + } + } + if resourceId.ProvisionedClusterInstanceName, err = id.PopSegment(provisionedClusterInstancesKey); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} diff --git a/internal/services/arckubernetes/parse/arc_kubernetes_provisioned_cluster_instance_test.go b/internal/services/arckubernetes/parse/arc_kubernetes_provisioned_cluster_instance_test.go new file mode 100644 index 000000000000..a28f0326eeb4 --- /dev/null +++ b/internal/services/arckubernetes/parse/arc_kubernetes_provisioned_cluster_instance_test.go @@ -0,0 +1,267 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.Id = ArcKubernetesProvisionedClusterInstanceId{} + +func TestArcKubernetesProvisionedClusterInstanceIDFormatter(t *testing.T) { + actual := NewArcKubernetesProvisionedClusterInstanceID("12345678-1234-9876-4563-123456789012", "group1", "cluster1", "default").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Kubernetes/connectedClusters/cluster1/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default" + if actual != expected { + t.Fatalf("Expected %q but got %q", expected, actual) + } +} + +func TestArcKubernetesProvisionedClusterInstanceID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ArcKubernetesProvisionedClusterInstanceId + }{ + + { + // empty + Input: "", + Error: true, + }, + + { + // missing SubscriptionId + Input: "/", + Error: true, + }, + + { + // missing value for SubscriptionId + Input: "/subscriptions/", + Error: true, + }, + + { + // missing ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", + Error: true, + }, + + { + // missing value for ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", + Error: true, + }, + + { + // missing ConnectedClusterName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Kubernetes/", + Error: true, + }, + + { + // missing value for ConnectedClusterName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Kubernetes/connectedClusters/", + Error: true, + }, + + { + // missing ProvisionedClusterInstanceName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Kubernetes/connectedClusters/cluster1/providers/Microsoft.HybridContainerService/", + Error: true, + }, + + { + // missing value for ProvisionedClusterInstanceName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Kubernetes/connectedClusters/cluster1/providers/Microsoft.HybridContainerService/provisionedClusterInstances/", + Error: true, + }, + + { + // valid + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Kubernetes/connectedClusters/cluster1/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default", + Expected: &ArcKubernetesProvisionedClusterInstanceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroup: "group1", + ConnectedClusterName: "cluster1", + ProvisionedClusterInstanceName: "default", + }, + }, + + { + // upper-cased + Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.KUBERNETES/CONNECTEDCLUSTERS/CLUSTER1/PROVIDERS/MICROSOFT.HYBRIDCONTAINERSERVICE/PROVISIONEDCLUSTERINSTANCES/DEFAULT", + Error: true, + }, + } + + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ArcKubernetesProvisionedClusterInstanceID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %s", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + if actual.ResourceGroup != v.Expected.ResourceGroup { + t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) + } + if actual.ConnectedClusterName != v.Expected.ConnectedClusterName { + t.Fatalf("Expected %q but got %q for ConnectedClusterName", v.Expected.ConnectedClusterName, actual.ConnectedClusterName) + } + if actual.ProvisionedClusterInstanceName != v.Expected.ProvisionedClusterInstanceName { + t.Fatalf("Expected %q but got %q for ProvisionedClusterInstanceName", v.Expected.ProvisionedClusterInstanceName, actual.ProvisionedClusterInstanceName) + } + } +} + +func TestArcKubernetesProvisionedClusterInstanceIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ArcKubernetesProvisionedClusterInstanceId + }{ + + { + // empty + Input: "", + Error: true, + }, + + { + // missing SubscriptionId + Input: "/", + Error: true, + }, + + { + // missing value for SubscriptionId + Input: "/subscriptions/", + Error: true, + }, + + { + // missing ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", + Error: true, + }, + + { + // missing value for ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", + Error: true, + }, + + { + // missing ConnectedClusterName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Kubernetes/", + Error: true, + }, + + { + // missing value for ConnectedClusterName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Kubernetes/connectedClusters/", + Error: true, + }, + + { + // missing ProvisionedClusterInstanceName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Kubernetes/connectedClusters/cluster1/providers/Microsoft.HybridContainerService/", + Error: true, + }, + + { + // missing value for ProvisionedClusterInstanceName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Kubernetes/connectedClusters/cluster1/providers/Microsoft.HybridContainerService/provisionedClusterInstances/", + Error: true, + }, + + { + // valid + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Kubernetes/connectedClusters/cluster1/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default", + Expected: &ArcKubernetesProvisionedClusterInstanceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroup: "group1", + ConnectedClusterName: "cluster1", + ProvisionedClusterInstanceName: "default", + }, + }, + + { + // lower-cased segment names + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Kubernetes/connectedclusters/cluster1/providers/Microsoft.HybridContainerService/provisionedclusterinstances/default", + Expected: &ArcKubernetesProvisionedClusterInstanceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroup: "group1", + ConnectedClusterName: "cluster1", + ProvisionedClusterInstanceName: "default", + }, + }, + + { + // upper-cased segment names + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Kubernetes/CONNECTEDCLUSTERS/cluster1/providers/Microsoft.HybridContainerService/PROVISIONEDCLUSTERINSTANCES/default", + Expected: &ArcKubernetesProvisionedClusterInstanceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroup: "group1", + ConnectedClusterName: "cluster1", + ProvisionedClusterInstanceName: "default", + }, + }, + + { + // mixed-cased segment names + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Kubernetes/CoNnEcTeDcLuStErS/cluster1/providers/Microsoft.HybridContainerService/PrOvIsIoNeDcLuStErInStAnCeS/default", + Expected: &ArcKubernetesProvisionedClusterInstanceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroup: "group1", + ConnectedClusterName: "cluster1", + ProvisionedClusterInstanceName: "default", + }, + }, + } + + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ArcKubernetesProvisionedClusterInstanceIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %s", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + if actual.ResourceGroup != v.Expected.ResourceGroup { + t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) + } + if actual.ConnectedClusterName != v.Expected.ConnectedClusterName { + t.Fatalf("Expected %q but got %q for ConnectedClusterName", v.Expected.ConnectedClusterName, actual.ConnectedClusterName) + } + if actual.ProvisionedClusterInstanceName != v.Expected.ProvisionedClusterInstanceName { + t.Fatalf("Expected %q but got %q for ProvisionedClusterInstanceName", v.Expected.ProvisionedClusterInstanceName, actual.ProvisionedClusterInstanceName) + } + } +} diff --git a/internal/services/arckubernetes/registration.go b/internal/services/arckubernetes/registration.go index ff205f7f0004..c4c1effd6547 100644 --- a/internal/services/arckubernetes/registration.go +++ b/internal/services/arckubernetes/registration.go @@ -47,5 +47,6 @@ func (r Registration) Resources() []sdk.Resource { return []sdk.Resource{ ArcKubernetesClusterExtensionResource{}, ArcKubernetesFluxConfigurationResource{}, + ArcKubernetesProvisionedClusterInstanceResource{}, } } diff --git a/internal/services/arckubernetes/resourceids.go b/internal/services/arckubernetes/resourceids.go new file mode 100644 index 000000000000..dc8608fcad1c --- /dev/null +++ b/internal/services/arckubernetes/resourceids.go @@ -0,0 +1,3 @@ +package arckubernetes + +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ArcKubernetesProvisionedClusterInstance -rewrite=true -id=/subscriptions diff --git a/internal/services/arckubernetes/validate/arc_kubernetes_provisioned_cluster_instance_id.go b/internal/services/arckubernetes/validate/arc_kubernetes_provisioned_cluster_instance_id.go new file mode 100644 index 000000000000..f37d237ad5c2 --- /dev/null +++ b/internal/services/arckubernetes/validate/arc_kubernetes_provisioned_cluster_instance_id.go @@ -0,0 +1,26 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + + "github.com/hashicorp/terraform-provider-azurerm/internal/services/arckubernetes/parse" +) + +func ArcKubernetesProvisionedClusterInstanceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := parse.ArcKubernetesProvisionedClusterInstanceID(v); err != nil { + errors = append(errors, err) + } + + return +} diff --git a/internal/services/arckubernetes/validate/arc_kubernetes_provisioned_cluster_instance_id_test.go b/internal/services/arckubernetes/validate/arc_kubernetes_provisioned_cluster_instance_id_test.go new file mode 100644 index 000000000000..f217e1dce599 --- /dev/null +++ b/internal/services/arckubernetes/validate/arc_kubernetes_provisioned_cluster_instance_id_test.go @@ -0,0 +1,91 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import "testing" + +func TestArcKubernetesProvisionedClusterInstanceID(t *testing.T) { + cases := []struct { + Input string + Valid bool + }{ + + { + // empty + Input: "", + Valid: false, + }, + + { + // missing SubscriptionId + Input: "/", + Valid: false, + }, + + { + // missing value for SubscriptionId + Input: "/subscriptions/", + Valid: false, + }, + + { + // missing ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", + Valid: false, + }, + + { + // missing value for ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", + Valid: false, + }, + + { + // missing ConnectedClusterName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Kubernetes/", + Valid: false, + }, + + { + // missing value for ConnectedClusterName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Kubernetes/connectedClusters/", + Valid: false, + }, + + { + // missing ProvisionedClusterInstanceName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Kubernetes/connectedClusters/cluster1/providers/Microsoft.HybridContainerService/", + Valid: false, + }, + + { + // missing value for ProvisionedClusterInstanceName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Kubernetes/connectedClusters/cluster1/providers/Microsoft.HybridContainerService/provisionedClusterInstances/", + Valid: false, + }, + + { + // valid + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Kubernetes/connectedClusters/cluster1/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default", + Valid: true, + }, + + { + // upper-cased + Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.KUBERNETES/CONNECTEDCLUSTERS/CLUSTER1/PROVIDERS/MICROSOFT.HYBRIDCONTAINERSERVICE/PROVISIONEDCLUSTERINSTANCES/DEFAULT", + Valid: false, + }, + } + for _, tc := range cases { + t.Logf("[DEBUG] Testing Value %s", tc.Input) + _, errors := ArcKubernetesProvisionedClusterInstanceID(tc.Input, "test") + valid := len(errors) == 0 + + if tc.Valid != valid { + t.Fatalf("Expected %t but got %t", tc.Valid, valid) + } + } +} From 227cc87df9be671615ae3d1dfcadd6a310827a71 Mon Sep 17 00:00:00 2001 From: teowa <104055472+teowa@users.noreply.github.com> Date: Tue, 20 Aug 2024 08:25:16 +0000 Subject: [PATCH 06/17] wip --- ...arc_kubernetes_provisioned_cluster_resource.go | 15 +++++---------- ...ubernetes_provisioned_cluster_resource_test.go | 7 ++----- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go index 112038805835..9ca1516dd01b 100644 --- a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go +++ b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go @@ -82,11 +82,7 @@ type ProvisionedClusterInstanceControlPlaneProfile struct { } type ProvisionedClusterInstanceLinuxProfile struct { - SshKey []ProvisionedClusterInstanceSshKey `tfschema:"ssh_key"` -} - -type ProvisionedClusterInstanceSshKey struct { - KeyData string `tfschema:"key_data"` + SshKey []string `tfschema:"ssh_key"` } type ProvisionedClusterInstanceLicenseProfile struct { @@ -225,6 +221,7 @@ func (ArcKubernetesProvisionedClusterInstanceResource) Arguments() map[string]*p Elem: &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ "vnet_subnet_ids": { + Type: pluginsdk.TypeList, Required: true, MinItems: 1, Elem: &pluginsdk.Schema{ @@ -716,7 +713,7 @@ func expandProvisionedClusterLinuxProfile(input []ProvisionedClusterInstanceLinu publicKeys := make([]provisionedclusterinstances.LinuxProfilePropertiesSshPublicKeysInlined, 0) for _, v := range input[0].SshKey { publicKeys = append(publicKeys, provisionedclusterinstances.LinuxProfilePropertiesSshPublicKeysInlined{ - KeyData: pointer.To(v.KeyData), + KeyData: pointer.To(v), }) } @@ -732,11 +729,9 @@ func flattenProvisionedClusterLinuxProfile(input *provisionedclusterinstances.Li return nil } - sshKey := make([]ProvisionedClusterInstanceSshKey, 0) + sshKey := make([]string, 0) for _, v := range *input.Ssh.PublicKeys { - sshKey = append(sshKey, ProvisionedClusterInstanceSshKey{ - KeyData: pointer.From(v.KeyData), - }) + sshKey = append(sshKey, pointer.From(v.KeyData)) } return []ProvisionedClusterInstanceLinuxProfile{ diff --git a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go index 18a9691f8771..952da01e3507 100644 --- a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go +++ b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go @@ -80,7 +80,6 @@ func (r ArcKubernetesProvisionedClusterInstanceResource) basic(data acceptance.T %[1]s resource "azurerm_arc_kubernetes_provisioned_cluster_instance" "test" { - name = "acctest-akpci-%[2]d" cluster_id = azurerm_arc_kubernetes_cluster.test.id custom_location_id = "%[3]s" kubernetes_version = "1.28.5" @@ -110,9 +109,7 @@ resource "azurerm_arc_kubernetes_provisioned_cluster_instance" "test" { } linux_profile { - ssh_key { - key_data = tls_private_key.rsaKey.public_key_openssh - } + ssh_key = [tls_private_key.rsaKey.public_key_openssh] } network_profile { @@ -193,7 +190,7 @@ resource "azurerm_stack_hci_logical_network" "test" { # from https://github.com/Azure/Edge-infrastructure-quickstart-template/blob/main/modules/aks-arc/readiness.ps1 resource "terraform_data" "waitAksVhdReady" { provisioner "local-exec" { - command = "powershell.exe -ExecutionPolicy Bypass -NoProfile -File testdata/readiness.ps1 -customLocationResourceId '%[2]s' -kubernetesVersion '1.28.5' -osSku CBLMariner" + command = "powershell.exe -ExecutionPolicy Bypass -NoProfile -File ./testdata/readiness.ps1 -customLocationResourceId '%[2]s' -kubernetesVersion '1.28.5' -osSku CBLMariner" interpreter = ["PowerShell", "-Command"] } } From 6fa6313759ab468328adab21858829eafb99e3c5 Mon Sep 17 00:00:00 2001 From: teowa <104055472+teowa@users.noreply.github.com> Date: Thu, 22 Aug 2024 14:27:16 +0000 Subject: [PATCH 07/17] new resource provisioned_cluster_instance --- ...kubernetes_provisioned_cluster_resource.go | 135 ++++++--- ...netes_provisioned_cluster_resource_test.go | 191 ++++++++++--- .../arckubernetes/testdata/readiness.ps1 | 61 ---- ...provisioned_cluster_instance.html.markdown | 261 ++++++++++++++++++ 4 files changed, 509 insertions(+), 139 deletions(-) delete mode 100644 internal/services/arckubernetes/testdata/readiness.ps1 create mode 100644 website/docs/r/arc_kubernetes_provisioned_cluster_instance.html.markdown diff --git a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go index 9ca1516dd01b..186c047e7acf 100644 --- a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go +++ b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go @@ -41,16 +41,17 @@ func (ArcKubernetesProvisionedClusterInstanceResource) ModelObject() interface{} } type ArcKubernetesProvisionedClusterInstanceResourceModel struct { - AgentPoolProfile []ProvisionedClusterInstanceAgentPoolProfile `tfschema:"agent_pool_profile"` - CloudProviderProfile []ProvisionedClusterInstanceCloudProviderProfile `tfschema:"cloud_provider_profile"` - ClusterID string `tfschema:"cluster_id"` - ControlPlaneProfile []ProvisionedClusterInstanceControlPlaneProfile `tfschema:"control_plane_profile"` - CustomLocationId string `tfschema:"custom_location_id"` - KubernetesVersion string `tfschema:"kubernetes_version"` - LinuxProfile []ProvisionedClusterInstanceLinuxProfile `tfschema:"linux_profile"` - LicenseProfile []ProvisionedClusterInstanceLicenseProfile `tfschema:"license_profile"` - NetworkProfile []ProvisionedClusterInstanceNetworkProfile `tfschema:"network_profile"` - StorageProfile []ProvisionedClusterInstanceStorageProfile `tfschema:"storage_profile"` + AgentPoolProfile []ProvisionedClusterInstanceAgentPoolProfile `tfschema:"agent_pool_profile"` + CloudProviderProfile []ProvisionedClusterInstanceCloudProviderProfile `tfschema:"cloud_provider_profile"` + ClusterID string `tfschema:"cluster_id"` + ClusterVmAcessProfile []ProvisionedClusterInstanceClusterVmAccessProfile `tfschema:"cluster_vm_access_profile"` + ControlPlaneProfile []ProvisionedClusterInstanceControlPlaneProfile `tfschema:"control_plane_profile"` + CustomLocationId string `tfschema:"custom_location_id"` + KubernetesVersion string `tfschema:"kubernetes_version"` + LinuxProfile []ProvisionedClusterInstanceLinuxProfile `tfschema:"linux_profile"` + LicenseProfile []ProvisionedClusterInstanceLicenseProfile `tfschema:"license_profile"` + NetworkProfile []ProvisionedClusterInstanceNetworkProfile `tfschema:"network_profile"` + StorageProfile []ProvisionedClusterInstanceStorageProfile `tfschema:"storage_profile"` } type ProvisionedClusterInstanceAgentPoolProfile struct { @@ -75,6 +76,10 @@ type ProvisionedClusterInstanceInfraNetworkProfile struct { VnetSubnetIds []string `tfschema:"vnet_subnet_ids"` } +type ProvisionedClusterInstanceClusterVmAccessProfile struct { + AuthorizedIPRanges string `tfschema:"authorized_ip_ranges"` +} + type ProvisionedClusterInstanceControlPlaneProfile struct { Count int64 `tfschema:"count"` HostIp string `tfschema:"host_ip"` @@ -123,7 +128,6 @@ func (ArcKubernetesProvisionedClusterInstanceResource) Arguments() map[string]*p "agent_pool_profile": { Type: pluginsdk.TypeList, Required: true, - ForceNew: true, Elem: &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ "name": { @@ -137,12 +141,12 @@ func (ArcKubernetesProvisionedClusterInstanceResource) Arguments() map[string]*p "vm_size": { Type: pluginsdk.TypeString, Required: true, + ForceNew: true, ValidateFunc: validation.StringIsNotEmpty, }, "auto_scaling_enabled": { Type: pluginsdk.TypeBool, Optional: true, - ForceNew: true, Default: false, }, "count": { @@ -154,38 +158,34 @@ func (ArcKubernetesProvisionedClusterInstanceResource) Arguments() map[string]*p "max_count": { Type: pluginsdk.TypeInt, Optional: true, - ForceNew: true, ValidateFunc: validation.IntAtLeast(1), }, "max_pods": { Type: pluginsdk.TypeInt, Optional: true, - ForceNew: true, ValidateFunc: validation.IntAtLeast(1), }, "min_count": { Type: pluginsdk.TypeInt, Optional: true, - ForceNew: true, ValidateFunc: validation.IntAtLeast(1), }, "node_labels": { Type: pluginsdk.TypeMap, - ForceNew: true, Optional: true, }, "node_taints": { Type: pluginsdk.TypeList, Optional: true, - ForceNew: true, Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, - ValidateFunc: validation.IsIPv4Address, + ValidateFunc: validation.StringIsNotEmpty, }, }, "os_sku": { Type: pluginsdk.TypeString, Optional: true, + ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ string(provisionedclusterinstances.OSSKUCBLMariner), string(provisionedclusterinstances.OSSKUWindowsTwoZeroOneNine), @@ -195,8 +195,8 @@ func (ArcKubernetesProvisionedClusterInstanceResource) Arguments() map[string]*p "os_type": { Type: pluginsdk.TypeString, Optional: true, - Default: string(provisionedclusterinstances.OsTypeLinux), ForceNew: true, + Default: string(provisionedclusterinstances.OsTypeLinux), ValidateFunc: validation.StringInSlice([]string{ string(provisionedclusterinstances.OsTypeLinux), string(provisionedclusterinstances.OsTypeWindows), @@ -239,21 +239,40 @@ func (ArcKubernetesProvisionedClusterInstanceResource) Arguments() map[string]*p }, }, + "cluster_vm_access_profile": { + Type: pluginsdk.TypeList, + Optional: true, + ForceNew: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "authorized_ip_ranges": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + }, + }, + "control_plane_profile": { Type: pluginsdk.TypeList, Required: true, - ForceNew: true, MaxItems: 1, Elem: &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ "host_ip": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: validation.IsIPv4Address, + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.IsIPv4Address, + ConflictsWith: []string{"network_profile.0.load_balancer_profile"}, }, "vm_size": { Type: pluginsdk.TypeString, Required: true, + ForceNew: true, ValidateFunc: validation.StringIsNotEmpty, }, "count": { @@ -269,8 +288,10 @@ func (ArcKubernetesProvisionedClusterInstanceResource) Arguments() map[string]*p "kubernetes_version": { Type: pluginsdk.TypeString, Required: true, + ForceNew: true, ValidateFunc: validation.StringIsNotEmpty, }, + "linux_profile": { Type: pluginsdk.TypeList, Optional: true, @@ -281,6 +302,7 @@ func (ArcKubernetesProvisionedClusterInstanceResource) Arguments() map[string]*p "ssh_key": { Type: pluginsdk.TypeList, Required: true, + ForceNew: true, MinItems: 1, Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, @@ -294,14 +316,13 @@ func (ArcKubernetesProvisionedClusterInstanceResource) Arguments() map[string]*p "license_profile": { Type: pluginsdk.TypeList, Optional: true, - ForceNew: true, MaxItems: 1, Elem: &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ "azure_hybrid_benefit": { Type: pluginsdk.TypeString, Optional: true, - Default: string(provisionedclusterinstances.AzureHybridBenefitNotApplicable), + Default: string(connectedclusters.AzureHybridBenefitNotApplicable), ValidateFunc: validation.StringInSlice([]string{ string(provisionedclusterinstances.AzureHybridBenefitNotApplicable), string(provisionedclusterinstances.AzureHybridBenefitFalse), @@ -314,14 +335,14 @@ func (ArcKubernetesProvisionedClusterInstanceResource) Arguments() map[string]*p "network_profile": { Type: pluginsdk.TypeList, - Optional: true, + Required: true, ForceNew: true, MaxItems: 1, Elem: &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ "network_policy": { Type: pluginsdk.TypeString, - Optional: true, + Required: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ string(provisionedclusterinstances.NetworkPolicyCalico), @@ -329,21 +350,22 @@ func (ArcKubernetesProvisionedClusterInstanceResource) Arguments() map[string]*p }, "pod_cidr": { Type: pluginsdk.TypeString, - Optional: true, + Required: true, ForceNew: true, ValidateFunc: validation.IsCIDR, }, "load_balancer_profile": { - Type: pluginsdk.TypeList, - Optional: true, - ForceNew: true, - MaxItems: 1, + Type: pluginsdk.TypeList, + Optional: true, + ForceNew: true, + MaxItems: 1, + ConflictsWith: []string{"control_plane_profile.0.host_ip"}, Elem: &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ "count": { Type: pluginsdk.TypeInt, - Optional: true, - Default: 0, + Required: true, + ForceNew: true, ValidateFunc: validation.IntAtLeast(1), }, }, @@ -356,20 +378,17 @@ func (ArcKubernetesProvisionedClusterInstanceResource) Arguments() map[string]*p "storage_profile": { Type: pluginsdk.TypeList, Optional: true, - ForceNew: true, MaxItems: 1, Elem: &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ "smb_csi_driver_enabled": { Type: pluginsdk.TypeBool, Optional: true, - ForceNew: true, Default: true, }, "nfs_csi_driver_enabled": { Type: pluginsdk.TypeBool, Optional: true, - ForceNew: true, Default: true, }, }, @@ -415,14 +434,15 @@ func (r ArcKubernetesProvisionedClusterInstanceResource) Create() sdk.ResourceFu Type: pointer.To(provisionedclusterinstances.ExtendedLocationTypesCustomLocation), }, Properties: &provisionedclusterinstances.ProvisionedClusterProperties{ - AgentPoolProfiles: expandProvisionedClusterAgentPoolProfiles(config.AgentPoolProfile), - CloudProviderProfile: expandProvisionedClusterCloudProviderProfile(config.CloudProviderProfile), - ControlPlane: expandProvisionedClusterControlPlaneProfile(config.ControlPlaneProfile), - KubernetesVersion: pointer.To(config.KubernetesVersion), - LinuxProfile: expandProvisionedClusterLinuxProfile(config.LinuxProfile), - LicenseProfile: expandProvisionedClusterLicenseProfile(config.LicenseProfile), - NetworkProfile: expandProvisionedClusterNetworkProfile(config.NetworkProfile), - StorageProfile: expandProvisionedClusterStorageProfile(config.StorageProfile), + AgentPoolProfiles: expandProvisionedClusterAgentPoolProfiles(config.AgentPoolProfile), + CloudProviderProfile: expandProvisionedClusterCloudProviderProfile(config.CloudProviderProfile), + ClusterVMAccessProfile: expandProvisionedClusterClusterVmAccessProfile(config.ClusterVmAcessProfile), + ControlPlane: expandProvisionedClusterControlPlaneProfile(config.ControlPlaneProfile), + KubernetesVersion: pointer.To(config.KubernetesVersion), + LinuxProfile: expandProvisionedClusterLinuxProfile(config.LinuxProfile), + LicenseProfile: expandProvisionedClusterLicenseProfile(config.LicenseProfile), + NetworkProfile: expandProvisionedClusterNetworkProfile(config.NetworkProfile), + StorageProfile: expandProvisionedClusterStorageProfile(config.StorageProfile), }, } @@ -477,6 +497,7 @@ func (r ArcKubernetesProvisionedClusterInstanceResource) Read() sdk.ResourceFunc if props := model.Properties; props != nil { schema.CloudProviderProfile = flattenProvisionedClusterCloudProviderProfile(props.CloudProviderProfile) schema.AgentPoolProfile = flattenProvisionedClusterAgentPoolProfiles(props.AgentPoolProfiles) + schema.ClusterVmAcessProfile = flattenProvisionedClusterClusterVmAccessProfile(props.ClusterVMAccessProfile) schema.ControlPlaneProfile = flattenProvisionedClusterControlPlaneProfile(props.ControlPlane) schema.KubernetesVersion = pointer.From(props.KubernetesVersion) schema.LinuxProfile = flattenProvisionedClusterLinuxProfile(props.LinuxProfile) @@ -671,6 +692,28 @@ func flattenProvisionedClusterCloudProviderProfile(input *provisionedclusterinst } } +func expandProvisionedClusterClusterVmAccessProfile(input []ProvisionedClusterInstanceClusterVmAccessProfile) *provisionedclusterinstances.ClusterVMAccessProfile { + if len(input) == 0 { + return nil + } + + return &provisionedclusterinstances.ClusterVMAccessProfile{ + AuthorizedIPRanges: pointer.To(input[0].AuthorizedIPRanges), + } +} + +func flattenProvisionedClusterClusterVmAccessProfile(input *provisionedclusterinstances.ClusterVMAccessProfile) []ProvisionedClusterInstanceClusterVmAccessProfile { + if input == nil || input.AuthorizedIPRanges == nil { + return make([]ProvisionedClusterInstanceClusterVmAccessProfile, 0) + } + + return []ProvisionedClusterInstanceClusterVmAccessProfile{ + { + AuthorizedIPRanges: pointer.From(input.AuthorizedIPRanges), + }, + } +} + func expandProvisionedClusterControlPlaneProfile(input []ProvisionedClusterInstanceControlPlaneProfile) *provisionedclusterinstances.ControlPlaneProfile { if len(input) == 0 { return nil @@ -790,7 +833,7 @@ func flattenProvisionedClusterNetworkProfile(input *provisionedclusterinstances. } loadBalancer := make([]ProvisionedClusterInstanceLoadBalancerProfile, 0) - if input.LoadBalancerProfile != nil { + if input.LoadBalancerProfile != nil && input.LoadBalancerProfile.Count != nil { loadBalancer = append(loadBalancer, ProvisionedClusterInstanceLoadBalancerProfile{ Count: pointer.From(input.LoadBalancerProfile.Count), }) diff --git a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go index 952da01e3507..e2e2bf57d312 100644 --- a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go +++ b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go @@ -24,10 +24,28 @@ const ( type ArcKubernetesProvisionedClusterInstanceResource struct{} -func TestAccArcKubernetesProvisionedClusterInstance_basic(t *testing.T) { +func TestAccArcKubernetesProvisionedClusterInstance(t *testing.T) { + // NOTE: this is a combined test rather than separate split out tests due to + // the test environment network limitation + // (which our test suite can't easily work around) + + testCases := map[string]func(t *testing.T){ + "basic": testAccArcKubernetesProvisionedClusterInstance_basic, + "complete": testAccArcKubernetesProvisionedClusterInstance_complete, + "update": testAccArcKubernetesProvisionedClusterInstance_update, + "requiresImport": testAccArcKubernetesProvisionedClusterInstance_requiresImport, + } + for name, m := range testCases { + t.Run(name, func(t *testing.T) { + m(t) + }) + } +} + +func testAccArcKubernetesProvisionedClusterInstance_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_arc_kubernetes_provisioned_cluster_instance", "test") r := ArcKubernetesProvisionedClusterInstanceResource{} - data.ResourceTest(t, r, []acceptance.TestStep{ + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), Check: acceptance.ComposeTestCheckFunc( @@ -38,10 +56,52 @@ func TestAccArcKubernetesProvisionedClusterInstance_basic(t *testing.T) { }) } -func TestAccArcKubernetesProvisionedClusterInstance_requiresImport(t *testing.T) { +func testAccArcKubernetesProvisionedClusterInstance_complete(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_arc_kubernetes_provisioned_cluster_instance", "test") r := ArcKubernetesProvisionedClusterInstanceResource{} - data.ResourceTest(t, r, []acceptance.TestStep{ + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func testAccArcKubernetesProvisionedClusterInstance_update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_arc_kubernetes_provisioned_cluster_instance", "test") + r := ArcKubernetesProvisionedClusterInstanceResource{} + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func testAccArcKubernetesProvisionedClusterInstance_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_arc_kubernetes_provisioned_cluster_instance", "test") + r := ArcKubernetesProvisionedClusterInstanceResource{} + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), Check: acceptance.ComposeTestCheckFunc( @@ -85,7 +145,6 @@ resource "azurerm_arc_kubernetes_provisioned_cluster_instance" "test" { kubernetes_version = "1.28.5" agent_pool_profile { - count = 1 name = "nodepool1" os_sku = "CBLMariner" os_type = "Linux" @@ -99,15 +158,10 @@ resource "azurerm_arc_kubernetes_provisioned_cluster_instance" "test" { } control_plane_profile { - count = 1 host_ip = "192.168.1.190" vm_size = "Standard_A4_v2" } - license_profile { - azure_hybrid_benefit = "False" - } - linux_profile { ssh_key = [tls_private_key.rsaKey.public_key_openssh] } @@ -131,27 +185,110 @@ func (r ArcKubernetesProvisionedClusterInstanceResource) requiresImport(data acc %s resource "azurerm_arc_kubernetes_provisioned_cluster_instance" "import" { - name = azurerm_arc_kubernetes_provisioned_cluster_instance.test.name cluster_id = azurerm_arc_kubernetes_provisioned_cluster_instance.test.cluster_id - namespace = azurerm_arc_kubernetes_provisioned_cluster_instance.test.namespace + custom_location_id = azurerm_arc_kubernetes_provisioned_cluster_instance.test.custom_location_id + kubernetes_version = "1.28.5" + + agent_pool_profile { + name = "nodepool1" + os_sku = "CBLMariner" + os_type = "Linux" + vm_size = "Standard_A4_v2" + } + + cloud_provider_profile { + infra_network_profile { + vnet_subnet_ids = [azurerm_stack_hci_logical_network.test.id] + } + } - git_repository { - url = "https://github.com/Azure/arc-k8s-demo" - reference_type = "branch" - reference_value = "main" + control_plane_profile { + host_ip = "192.168.1.190" + vm_size = "Standard_A4_v2" } - kustomizations { - name = "kustomization-1" + linux_profile { + ssh_key = [tls_private_key.rsaKey.public_key_openssh] } - depends_on = [ - azurerm_arc_kubernetes_cluster_extension.test - ] + network_profile { + network_policy = "calico" + pod_cidr = "10.244.0.0/16" + } + + storage_profile { + smb_csi_driver_enabled = false + nfs_csi_driver_enabled = false + } } `, config) } +func (r ArcKubernetesProvisionedClusterInstanceResource) complete(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%[1]s + +resource "azurerm_arc_kubernetes_provisioned_cluster_instance" "test" { + cluster_id = azurerm_arc_kubernetes_cluster.test.id + custom_location_id = "%[3]s" + kubernetes_version = "1.28.5" + + agent_pool_profile { + auto_scaling_enabled = true + count = 1 + max_count = 2 + min_count = 1 + max_pods = 20 + name = "nodepool1" + os_sku = "CBLMariner" + os_type = "Linux" + vm_size = "Standard_A4_v2" + node_taints = ["env=prod:NoSchedule"] + + node_labels = { + foo = "bar" + env = "dev" + } + } + + cloud_provider_profile { + infra_network_profile { + vnet_subnet_ids = [azurerm_stack_hci_logical_network.test.id] + } + } + + cluster_vm_access_profile { + authorized_ip_ranges = "192.168.0.1,192.168.0.2" + } + + control_plane_profile { + count = 3 + vm_size = "Standard_A4_v2" + host_ip = "192.168.1.190" + } + + license_profile { + azure_hybrid_benefit = "False" + } + + linux_profile { + ssh_key = [tls_private_key.rsaKey.public_key_openssh] + } + + network_profile { + network_policy = "calico" + pod_cidr = "10.244.0.0/16" + } + + storage_profile { + smb_csi_driver_enabled = true + nfs_csi_driver_enabled = true + } +} +`, template, data.RandomInteger, os.Getenv(customLocationIdEnv)) +} + func (r ArcKubernetesProvisionedClusterInstanceResource) template(data acceptance.TestData) string { return fmt.Sprintf(` resource "tls_private_key" "rsaKey" { @@ -181,20 +318,12 @@ resource "azurerm_stack_hci_logical_network" "test" { } route { name = "test-route" - address_prefix = "10.0.0.0/0" + address_prefix = "0.0.0.0/0" next_hop_ip_address = "192.168.1.1" } } } -# from https://github.com/Azure/Edge-infrastructure-quickstart-template/blob/main/modules/aks-arc/readiness.ps1 -resource "terraform_data" "waitAksVhdReady" { - provisioner "local-exec" { - command = "powershell.exe -ExecutionPolicy Bypass -NoProfile -File ./testdata/readiness.ps1 -customLocationResourceId '%[2]s' -kubernetesVersion '1.28.5' -osSku CBLMariner" - interpreter = ["PowerShell", "-Command"] - } -} - resource "azurerm_arc_kubernetes_cluster" "test" { name = "acctest-akcc-%[1]d" resource_group_name = azurerm_resource_group.test.name @@ -203,8 +332,6 @@ resource "azurerm_arc_kubernetes_cluster" "test" { identity { type = "SystemAssigned" } - depends_on = [terraform_data.waitAksVhdReady] } - `, data.RandomInteger, data.Locations.Primary, os.Getenv(customLocationIdEnv)) } diff --git a/internal/services/arckubernetes/testdata/readiness.ps1 b/internal/services/arckubernetes/testdata/readiness.ps1 deleted file mode 100644 index 5b844748f34a..000000000000 --- a/internal/services/arckubernetes/testdata/readiness.ps1 +++ /dev/null @@ -1,61 +0,0 @@ -# used in acctest for arc_kubernetes_provisioned_cluster_instance -# from https://github.com/Azure/Edge-infrastructure-quickstart-template/blob/main/modules/aks-arc/readiness.ps1 -param ( - [string] $customLocationResourceId, - [string] $kubernetesVersion, - [string] $osSku -) - -$ErrorActionPreference = "Stop" - -az extension add --name aksarc --yes - -while ($true) { - if ($env:ACTIONS_ID_TOKEN_REQUEST_TOKEN) { - $resp = Invoke-WebRequest -Uri "$env:ACTIONS_ID_TOKEN_REQUEST_URL&audience=api://AzureADTokenExchange" -Headers @{"Authorization" = "bearer $env:ACTIONS_ID_TOKEN_REQUEST_TOKEN"} - $token = (echo $resp.Content | ConvertFrom-Json).value - - az login --federated-token $token --tenant $env:ARM_TENANT_ID -u $env:ARM_CLIENT_ID --service-principal - az account set --subscription $env:ARM_SUBSCRIPTION_ID - } - - $state = az aksarc get-versions --custom-location $customLocationResourceId -o json --only-show-errors - $state = "$state".Replace("`n", "").Replace("`r", "").Replace("`t", "").Replace(" ", "") - echo $state - - $pos = $state.IndexOf("{") - $state = $state.Substring($pos) - $quotePos = $state.IndexOf('"') - - # Workaround for warning messages in the CLI - if ($quotePos -gt 1) { - echo "workaround for warning messages in the CLI" - $state = $state.Substring($quotePos) - $state = "{$state" - } - $ready = $false - - foreach ($version in (echo $state | ConvertFrom-Json).properties.values) { - if (!$kubernetesVersion.StartsWith($version.version)) { - continue - } - - if ($version.patchVersions.PSobject.Properties.name -notcontains $kubernetesVersion) { - break - } - - foreach ($readiness in $version.patchVersions.$kubernetesVersion.readiness) { - if ($readiness.osSku -eq $osSku) { - $ready = $readiness.ready - } - } - } - - if ($ready) { - echo "Kubernetes version $kubernetesVersion is ready for osSku $osSku." - break - } - - echo "Kubernetes version $kubernetesVersion is not ready yet for osSku $osSku. Retrying in 10 seconds." - sleep 10 -} diff --git a/website/docs/r/arc_kubernetes_provisioned_cluster_instance.html.markdown b/website/docs/r/arc_kubernetes_provisioned_cluster_instance.html.markdown new file mode 100644 index 000000000000..ab5bf6e46628 --- /dev/null +++ b/website/docs/r/arc_kubernetes_provisioned_cluster_instance.html.markdown @@ -0,0 +1,261 @@ +--- +subcategory: "ArcKubernetes" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_arc_kubernetes_provisioned_cluster_instance" +description: |- + Manages an Arc Kubernetes Provisioned Cluster Instance. +--- + +# azurerm_arc_kubernetes_provisioned_cluster_instance + +Manages an Arc Kubernetes Provisioned Cluster Instance. + +## Example Usage + +```hcl +resource "tls_private_key" "rsaKey" { + algorithm = "RSA" + rsa_bits = 4096 +} + +resource "azurerm_resource_group" "example" { + name = "example-akpci" + location = "West Europe" +} + +resource "azurerm_stack_hci_logical_network" "example" { + name = "example-ln" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location + custom_location_id = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ExtendedLocation/customLocations/cl1" + virtual_switch_name = "ConvergedSwitch(managementcompute)" + dns_servers = ["192.168.1.254"] + + subnet { + ip_allocation_method = "Static" + address_prefix = "192.168.1.0/24" + ip_pool { + start = "192.168.1.171" + end = "192.168.1.190" + } + route { + name = "example-route" + address_prefix = "0.0.0.0/0" + next_hop_ip_address = "192.168.1.1" + } + } +} + +resource "azurerm_arc_kubernetes_cluster" "example" { + name = "example-akc" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location + kind = "ProvisionedCluster" + identity { + type = "SystemAssigned" + } +} + +resource "azurerm_arc_kubernetes_provisioned_cluster_instance" "example" { + cluster_id = azurerm_arc_kubernetes_cluster.example.id + custom_location_id = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ExtendedLocation/customLocations/cl1" + kubernetes_version = "1.28.5" + + agent_pool_profile { + auto_scaling_enabled = true + count = 1 + max_count = 2 + min_count = 1 + max_pods = 20 + name = "nodepool1" + os_sku = "CBLMariner" + os_type = "Linux" + vm_size = "Standard_A4_v2" + node_taints = ["env=prod:NoSchedule"] + + node_labels = { + foo = "bar" + env = "dev" + } + } + + cloud_provider_profile { + infra_network_profile { + vnet_subnet_ids = [azurerm_stack_hci_logical_network.example.id] + } + } + + cluster_vm_access_profile { + authorized_ip_ranges = "192.168.0.1,192.168.0.2" + } + + control_plane_profile { + count = 3 + vm_size = "Standard_A4_v2" + host_ip = "192.168.1.190" + } + + license_profile { + azure_hybrid_benefit = "False" + } + + linux_profile { + ssh_key = [tls_private_key.rsaKey.public_key_openssh] + } + + network_profile { + network_policy = "calico" + pod_cidr = "10.244.0.0/16" + } + + storage_profile { + smb_csi_driver_enabled = true + nfs_csi_driver_enabled = true + } +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `agent_pool_profile` - (Required) One or more `agent_pool_profile` blocks as defined below. + +* `cloud_provider_profile` - (Required) A `cloud_provider_profile` block as defined below. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. + +* `cluster_id` - (Required) The ID of the Arc Kubernetes Cluster. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. + +* `control_plane_profile` - (Required) A `control_plane_profile` block as defined below. + +* `custom_location_id` - (Required) The ID of the Custom Location. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. + +* `kubernetes_version` - (Required) The Kubernetes version to use for the Arc Kubernetes Provisioned Cluster Instance. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. + +* `network_profile` - (Required) A `network_profile` block as defined below. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. + +--- + +* `cluster_vm_access_profile` - (Optional) A `cluster_vm_access_profile` block as defined below. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. + +* `license_profile` - (Optional) A `license_profile` block as defined below. + +* `linux_profile` - (Optional) A `linux_profile` block as defined below. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. + +* `storage_profile` - (Optional) A `storage_profile` block as defined below. + +--- + +A `agent_pool_profile` block supports the following: + +* `name` - (Required) The name which should be used for this Agent Pool. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. + +* `vm_size` - (Required) The VM sku size of the agent pool node VMs. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. + +* `auto_scaling_enabled` - (Optional) Should the auto scaling be enabled? Defaults to `false`. + +* `count` - (Optional) The number of nodes in the agent pool. Defaults to `1`. + +* `max_count` - (Optional) The maximum number of nodes for auto scaling. + +* `max_pods` - (Optional) The maximum number of pods that can run on a node. + +* `min_count` - (Optional) The minimum number of nodes for auto scaling. + +* `node_labels` - (Optional) The node labels to be persisted across all nodes in agent pool. + +* `node_taints` - (Optional) The taints added to new nodes during node pool create and scale. For example, `key=value:NoSchedule`. + +* `os_sku` - (Optional) The OS SKU used by the agent pool nodes. Possible values are `CBLMariner`, `Windows2019` and `Windows2022`. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. + +* `os_type` - (Optional) The OS type for the agent pool nodes. Defaults to `Linux`. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. + +--- + +A `cloud_provider_profile` block supports the following: + +* `infra_network_profile` - (Required) A `infra_network_profile` block as defined below. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. + +--- + +A `cluster_vm_access_profile` block supports the following: + +* `authorized_ip_ranges` - (Optional) The ranges of IP Address or CIDR for SSH access to VMs in the provisioned cluster. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. + +--- + +A `control_plane_profile` block supports the following: + +* `vm_size` - (Required) VM sku size of the control plane nodes. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. + +* `count` - (Optional) The number of control plane nodes. The count should be an odd number. Defaults to `1`. + +* `host_ip` - (Optional) The IP Address of the Kubernetes API server. Conflicts with `network_profile.0.load_balancer_profile`. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. + +~> **NOTE:** The `control_plane_profile.host_ip` and `load_balancer_profile` cannot be specified together. + +--- + +A `infra_network_profile` block supports the following: + +* `vnet_subnet_ids` - (Required) Specifies a list of ARM resource IDs (maximum 1) for the infrastructure network object with `Microsoft.AzureStackHCI/logicalNetworks` or `Microsoft.HybridContainerService/virtualNetworks` resource type. + +--- + +A `license_profile` block supports the following: + +* `azure_hybrid_benefit` - (Optional) Whether Azure Hybrid Benefit is opted in. Defaults to `NotApplicable`. + +--- + +A `linux_profile` block supports the following: + +* `ssh_key` - (Required) A list of certificate public key used to authenticate with VMs through SSH. The certificate must be in PEM format with or without headers. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. + +--- + +A `load_balancer_profile` block supports the following: + +* `count` - (Required) The number of HA Proxy load balancer VMs. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. + +~> **NOTE:** The `load_balancer_profile` and `control_plane_profile.host_ip` cannot be specified together. + +--- + +A `network_profile` block supports the following: + +* `network_policy` - (Required) Network policy used for building Kubernetes network. Possible value is `calico`. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. + +* `pod_cidr` - (Required) A CIDR notation IP Address range from which to assign pod IPs. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. + +* `load_balancer_profile` - (Optional) A `load_balancer_profile` block as defined above.Conflicts with `control_plane_profile.0.host_ip`. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. + +--- + +A `storage_profile` block supports the following: + +* `nfs_csi_driver_enabled` - (Optional) Should the NFS CSI Driver be enabled? Defaults to `true`. + +* `smb_csi_driver_enabled` - (Optional) Should the SMB CSI Driver be enabled? Defaults to `true`. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Arc Kubernetes Provisioned Cluster Instance. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating the Arc Kubernetes Provisioned Cluster Instance. +* `read` - (Defaults to 5 minutes) Used when retrieving the Arc Kubernetes Provisioned Cluster Instance. +* `update` - (Defaults to 30 minutes) Used when updating the Arc Kubernetes Provisioned Cluster Instance. +* `delete` - (Defaults to 30 minutes) Used when deleting the Arc Kubernetes Provisioned Cluster Instance. + +## Import + +Arc Kubernetes Provisioned Cluster Instances can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_arc_kubernetes_provisioned_cluster_instance.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Kubernetes/connectedClusters/cluster1/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default +``` From ca3f8b09d8b15f095e75b11c9e7d628c2808f51a Mon Sep 17 00:00:00 2001 From: teowa <104055472+teowa@users.noreply.github.com> Date: Thu, 22 Aug 2024 14:27:56 +0000 Subject: [PATCH 08/17] terrafmt --- ...netes_provisioned_cluster_resource_test.go | 42 +++++++++---------- ...provisioned_cluster_instance.html.markdown | 28 ++++++------- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go index e2e2bf57d312..f045c12a7c14 100644 --- a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go +++ b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go @@ -140,13 +140,13 @@ func (r ArcKubernetesProvisionedClusterInstanceResource) basic(data acceptance.T %[1]s resource "azurerm_arc_kubernetes_provisioned_cluster_instance" "test" { - cluster_id = azurerm_arc_kubernetes_cluster.test.id + cluster_id = azurerm_arc_kubernetes_cluster.test.id custom_location_id = "%[3]s" kubernetes_version = "1.28.5" agent_pool_profile { - name = "nodepool1" - os_sku = "CBLMariner" + name = "nodepool1" + os_sku = "CBLMariner" os_type = "Linux" vm_size = "Standard_A4_v2" } @@ -168,7 +168,7 @@ resource "azurerm_arc_kubernetes_provisioned_cluster_instance" "test" { network_profile { network_policy = "calico" - pod_cidr = "10.244.0.0/16" + pod_cidr = "10.244.0.0/16" } storage_profile { @@ -185,13 +185,13 @@ func (r ArcKubernetesProvisionedClusterInstanceResource) requiresImport(data acc %s resource "azurerm_arc_kubernetes_provisioned_cluster_instance" "import" { - cluster_id = azurerm_arc_kubernetes_provisioned_cluster_instance.test.cluster_id + cluster_id = azurerm_arc_kubernetes_provisioned_cluster_instance.test.cluster_id custom_location_id = azurerm_arc_kubernetes_provisioned_cluster_instance.test.custom_location_id kubernetes_version = "1.28.5" agent_pool_profile { - name = "nodepool1" - os_sku = "CBLMariner" + name = "nodepool1" + os_sku = "CBLMariner" os_type = "Linux" vm_size = "Standard_A4_v2" } @@ -213,7 +213,7 @@ resource "azurerm_arc_kubernetes_provisioned_cluster_instance" "import" { network_profile { network_policy = "calico" - pod_cidr = "10.244.0.0/16" + pod_cidr = "10.244.0.0/16" } storage_profile { @@ -230,21 +230,21 @@ func (r ArcKubernetesProvisionedClusterInstanceResource) complete(data acceptanc %[1]s resource "azurerm_arc_kubernetes_provisioned_cluster_instance" "test" { - cluster_id = azurerm_arc_kubernetes_cluster.test.id + cluster_id = azurerm_arc_kubernetes_cluster.test.id custom_location_id = "%[3]s" kubernetes_version = "1.28.5" agent_pool_profile { auto_scaling_enabled = true - count = 1 - max_count = 2 - min_count = 1 - max_pods = 20 - name = "nodepool1" - os_sku = "CBLMariner" - os_type = "Linux" - vm_size = "Standard_A4_v2" - node_taints = ["env=prod:NoSchedule"] + count = 1 + max_count = 2 + min_count = 1 + max_pods = 20 + name = "nodepool1" + os_sku = "CBLMariner" + os_type = "Linux" + vm_size = "Standard_A4_v2" + node_taints = ["env=prod:NoSchedule"] node_labels = { foo = "bar" @@ -263,7 +263,7 @@ resource "azurerm_arc_kubernetes_provisioned_cluster_instance" "test" { } control_plane_profile { - count = 3 + count = 3 vm_size = "Standard_A4_v2" host_ip = "192.168.1.190" } @@ -278,7 +278,7 @@ resource "azurerm_arc_kubernetes_provisioned_cluster_instance" "test" { network_profile { network_policy = "calico" - pod_cidr = "10.244.0.0/16" + pod_cidr = "10.244.0.0/16" } storage_profile { @@ -297,7 +297,7 @@ resource "tls_private_key" "rsaKey" { } resource "azurerm_resource_group" "test" { - name = "acctest-akpci-%[1]d" + name = "acctest-akpci-%[1]d" location = "%[2]s" } diff --git a/website/docs/r/arc_kubernetes_provisioned_cluster_instance.html.markdown b/website/docs/r/arc_kubernetes_provisioned_cluster_instance.html.markdown index ab5bf6e46628..4202b2f049c5 100644 --- a/website/docs/r/arc_kubernetes_provisioned_cluster_instance.html.markdown +++ b/website/docs/r/arc_kubernetes_provisioned_cluster_instance.html.markdown @@ -19,7 +19,7 @@ resource "tls_private_key" "rsaKey" { } resource "azurerm_resource_group" "example" { - name = "example-akpci" + name = "example-akpci" location = "West Europe" } @@ -57,21 +57,21 @@ resource "azurerm_arc_kubernetes_cluster" "example" { } resource "azurerm_arc_kubernetes_provisioned_cluster_instance" "example" { - cluster_id = azurerm_arc_kubernetes_cluster.example.id - custom_location_id = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ExtendedLocation/customLocations/cl1" + cluster_id = azurerm_arc_kubernetes_cluster.example.id + custom_location_id = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ExtendedLocation/customLocations/cl1" kubernetes_version = "1.28.5" agent_pool_profile { auto_scaling_enabled = true - count = 1 - max_count = 2 - min_count = 1 - max_pods = 20 - name = "nodepool1" - os_sku = "CBLMariner" - os_type = "Linux" - vm_size = "Standard_A4_v2" - node_taints = ["env=prod:NoSchedule"] + count = 1 + max_count = 2 + min_count = 1 + max_pods = 20 + name = "nodepool1" + os_sku = "CBLMariner" + os_type = "Linux" + vm_size = "Standard_A4_v2" + node_taints = ["env=prod:NoSchedule"] node_labels = { foo = "bar" @@ -90,7 +90,7 @@ resource "azurerm_arc_kubernetes_provisioned_cluster_instance" "example" { } control_plane_profile { - count = 3 + count = 3 vm_size = "Standard_A4_v2" host_ip = "192.168.1.190" } @@ -105,7 +105,7 @@ resource "azurerm_arc_kubernetes_provisioned_cluster_instance" "example" { network_profile { network_policy = "calico" - pod_cidr = "10.244.0.0/16" + pod_cidr = "10.244.0.0/16" } storage_profile { From cf57d5211010a701757b82ed268a999906b73eee Mon Sep 17 00:00:00 2001 From: teowa <104055472+teowa@users.noreply.github.com> Date: Sat, 24 Aug 2024 02:24:14 +0000 Subject: [PATCH 09/17] fix ci --- .../arc_kubernetes_provisioned_cluster_resource.go | 3 +++ internal/services/arckubernetes/resourceids.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go index 186c047e7acf..5f875273eb5b 100644 --- a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go +++ b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go @@ -173,6 +173,9 @@ func (ArcKubernetesProvisionedClusterInstanceResource) Arguments() map[string]*p "node_labels": { Type: pluginsdk.TypeMap, Optional: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, }, "node_taints": { Type: pluginsdk.TypeList, diff --git a/internal/services/arckubernetes/resourceids.go b/internal/services/arckubernetes/resourceids.go index dc8608fcad1c..dfe6ee3e1bd1 100644 --- a/internal/services/arckubernetes/resourceids.go +++ b/internal/services/arckubernetes/resourceids.go @@ -1,3 +1,3 @@ package arckubernetes -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ArcKubernetesProvisionedClusterInstance -rewrite=true -id=/subscriptions +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ArcKubernetesProvisionedClusterInstance -rewrite=true -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Kubernetes/connectedClusters/cluster1/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default From 8ffe14227def14d517195e2148dd8f9b43cecfde Mon Sep 17 00:00:00 2001 From: teowa <104055472+teowa@users.noreply.github.com> Date: Tue, 27 Aug 2024 08:27:33 +0000 Subject: [PATCH 10/17] restore the arc kubernetes cluster part --- .../arc_kubernetes_cluster_resource.go | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/internal/services/arckubernetes/arc_kubernetes_cluster_resource.go b/internal/services/arckubernetes/arc_kubernetes_cluster_resource.go index fd11f8b36f12..395bb852fe82 100644 --- a/internal/services/arckubernetes/arc_kubernetes_cluster_resource.go +++ b/internal/services/arckubernetes/arc_kubernetes_cluster_resource.go @@ -8,7 +8,6 @@ import ( "regexp" "time" - "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" @@ -57,7 +56,7 @@ func resourceArcKubernetesCluster() *pluginsdk.Resource { "agent_public_key_certificate": { Type: pluginsdk.TypeString, - Optional: true, + Required: true, ForceNew: true, ValidateFunc: azValidate.Base64EncodedString, }, @@ -66,16 +65,6 @@ func resourceArcKubernetesCluster() *pluginsdk.Resource { "location": commonschema.Location(), - "kind": { - Type: pluginsdk.TypeString, - Optional: true, - ForceNew: true, - ConflictsWith: []string{"agent_public_key_certificate"}, - ValidateFunc: validation.StringInSlice([]string{ - string(arckubernetes.ConnectedClusterKindProvisionedCluster), - }, false), - }, - "agent_version": { Type: pluginsdk.TypeString, Computed: true, @@ -149,9 +138,6 @@ func resourceArcKubernetesClusterCreate(d *pluginsdk.ResourceData, meta interfac }, Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } - if kindVal := d.Get("kind").(string); kindVal != "" { - props.Kind = pointer.To(arckubernetes.ConnectedClusterKind(kindVal)) - } if err := client.ConnectedClusterCreateThenPoll(ctx, id, props); err != nil { return fmt.Errorf("creating %s: %+v", id, err) @@ -187,7 +173,6 @@ func resourceArcKubernetesClusterRead(d *pluginsdk.ResourceData, meta interface{ if err := d.Set("identity", identity.FlattenSystemAssigned(&model.Identity)); err != nil { return fmt.Errorf("setting `identity`: %+v", err) } - d.Set("kind", string(pointer.From(model.Kind))) d.Set("location", location.Normalize(model.Location)) props := model.Properties d.Set("agent_public_key_certificate", props.AgentPublicKeyCertificate) From 635e1b5d220b4ea077d0f28c11d53fa1fde145f6 Mon Sep 17 00:00:00 2001 From: teowa <104055472+teowa@users.noreply.github.com> Date: Tue, 3 Sep 2024 11:03:29 +0000 Subject: [PATCH 11/17] rename resource; update schema; fix doc --- ...kubernetes_provisioned_cluster_resource.go | 200 ++++++++---------- ...netes_provisioned_cluster_resource_test.go | 18 +- ...provisioned_cluster_instance.html.markdown | 36 ++-- 3 files changed, 114 insertions(+), 140 deletions(-) diff --git a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go index 5f875273eb5b..0c2664875edf 100644 --- a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go +++ b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2024-01-01/logicalnetworks" "github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations" "github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances" @@ -33,7 +34,7 @@ func (ArcKubernetesProvisionedClusterInstanceResource) IDValidationFunc() plugin } func (ArcKubernetesProvisionedClusterInstanceResource) ResourceType() string { - return "azurerm_arc_kubernetes_provisioned_cluster_instance" + return "azurerm_arc_kubernetes_provisioned_cluster" } func (ArcKubernetesProvisionedClusterInstanceResource) ModelObject() interface{} { @@ -111,19 +112,9 @@ type ProvisionedClusterInstanceStorageProfile struct { func (ArcKubernetesProvisionedClusterInstanceResource) Arguments() map[string]*pluginsdk.Schema { return map[string]*pluginsdk.Schema{ - "cluster_id": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: connectedclusters.ValidateConnectedClusterID, - }, + "cluster_id": commonschema.ResourceIDReferenceRequiredForceNew(&connectedclusters.ConnectedClusterId{}), - "custom_location_id": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: customlocations.ValidateCustomLocationID, - }, + "custom_location_id": commonschema.ResourceIDReferenceRequiredForceNew(&customlocations.CustomLocationId{}), "agent_pool_profile": { Type: pluginsdk.TypeList, @@ -138,6 +129,25 @@ func (ArcKubernetesProvisionedClusterInstanceResource) Arguments() map[string]*p regexp.MustCompile(`^[a-z][a-z0-9]{2,11}$`), "`name` must start with lower cases characters and can only contains 3-12 lowercase alphanumberic characters"), }, + "os_sku": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{ + string(provisionedclusterinstances.OSSKUCBLMariner), + string(provisionedclusterinstances.OSSKUWindowsTwoZeroOneNine), + string(provisionedclusterinstances.OSSKUWindowsTwoZeroTwoTwo), + }, false), + }, + "os_type": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{ + string(provisionedclusterinstances.OsTypeLinux), + string(provisionedclusterinstances.OsTypeWindows), + }, false), + }, "vm_size": { Type: pluginsdk.TypeString, Required: true, @@ -185,26 +195,6 @@ func (ArcKubernetesProvisionedClusterInstanceResource) Arguments() map[string]*p ValidateFunc: validation.StringIsNotEmpty, }, }, - "os_sku": { - Type: pluginsdk.TypeString, - Optional: true, - ForceNew: true, - ValidateFunc: validation.StringInSlice([]string{ - string(provisionedclusterinstances.OSSKUCBLMariner), - string(provisionedclusterinstances.OSSKUWindowsTwoZeroOneNine), - string(provisionedclusterinstances.OSSKUWindowsTwoZeroTwoTwo), - }, false), - }, - "os_type": { - Type: pluginsdk.TypeString, - Optional: true, - ForceNew: true, - Default: string(provisionedclusterinstances.OsTypeLinux), - ValidateFunc: validation.StringInSlice([]string{ - string(provisionedclusterinstances.OsTypeLinux), - string(provisionedclusterinstances.OsTypeWindows), - }, false), - }, }, }, }, @@ -242,29 +232,18 @@ func (ArcKubernetesProvisionedClusterInstanceResource) Arguments() map[string]*p }, }, - "cluster_vm_access_profile": { + "control_plane_profile": { Type: pluginsdk.TypeList, - Optional: true, - ForceNew: true, + Required: true, MaxItems: 1, Elem: &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ - "authorized_ip_ranges": { + "vm_size": { Type: pluginsdk.TypeString, - Optional: true, + Required: true, ForceNew: true, ValidateFunc: validation.StringIsNotEmpty, }, - }, - }, - }, - - "control_plane_profile": { - Type: pluginsdk.TypeList, - Required: true, - MaxItems: 1, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ "host_ip": { Type: pluginsdk.TypeString, Optional: true, @@ -272,12 +251,6 @@ func (ArcKubernetesProvisionedClusterInstanceResource) Arguments() map[string]*p ValidateFunc: validation.IsIPv4Address, ConflictsWith: []string{"network_profile.0.load_balancer_profile"}, }, - "vm_size": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringIsNotEmpty, - }, "count": { Type: pluginsdk.TypeInt, Optional: true, @@ -295,47 +268,6 @@ func (ArcKubernetesProvisionedClusterInstanceResource) Arguments() map[string]*p ValidateFunc: validation.StringIsNotEmpty, }, - "linux_profile": { - Type: pluginsdk.TypeList, - Optional: true, - ForceNew: true, - MaxItems: 1, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "ssh_key": { - Type: pluginsdk.TypeList, - Required: true, - ForceNew: true, - MinItems: 1, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - ValidateFunc: validation.StringIsNotEmpty, - }, - }, - }, - }, - }, - - "license_profile": { - Type: pluginsdk.TypeList, - Optional: true, - MaxItems: 1, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "azure_hybrid_benefit": { - Type: pluginsdk.TypeString, - Optional: true, - Default: string(connectedclusters.AzureHybridBenefitNotApplicable), - ValidateFunc: validation.StringInSlice([]string{ - string(provisionedclusterinstances.AzureHybridBenefitNotApplicable), - string(provisionedclusterinstances.AzureHybridBenefitFalse), - string(provisionedclusterinstances.AzureHybridBenefitTrue), - }, false), - }, - }, - }, - }, - "network_profile": { Type: pluginsdk.TypeList, Required: true, @@ -378,6 +310,64 @@ func (ArcKubernetesProvisionedClusterInstanceResource) Arguments() map[string]*p }, }, + "cluster_vm_access_profile": { + Type: pluginsdk.TypeList, + Optional: true, + ForceNew: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "authorized_ip_ranges": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + }, + }, + + "linux_profile": { + Type: pluginsdk.TypeList, + Optional: true, + ForceNew: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "ssh_key": { + Type: pluginsdk.TypeList, + Required: true, + ForceNew: true, + MinItems: 1, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + }, + }, + }, + + "license_profile": { + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "azure_hybrid_benefit": { + Type: pluginsdk.TypeString, + Optional: true, + Default: string(connectedclusters.AzureHybridBenefitNotApplicable), + ValidateFunc: validation.StringInSlice([]string{ + string(provisionedclusterinstances.AzureHybridBenefitNotApplicable), + string(provisionedclusterinstances.AzureHybridBenefitFalse), + string(provisionedclusterinstances.AzureHybridBenefitTrue), + }, false), + }, + }, + }, + }, + "storage_profile": { Type: pluginsdk.TypeList, Optional: true, @@ -548,30 +538,14 @@ func (r ArcKubernetesProvisionedClusterInstanceResource) Update() sdk.ResourceFu parameters.Properties.AgentPoolProfiles = expandProvisionedClusterAgentPoolProfiles(config.AgentPoolProfile) } - if metadata.ResourceData.HasChange("cloud_provider_profile") { - parameters.Properties.CloudProviderProfile = expandProvisionedClusterCloudProviderProfile(config.CloudProviderProfile) - } - if metadata.ResourceData.HasChange("control_plane_profile") { parameters.Properties.ControlPlane = expandProvisionedClusterControlPlaneProfile(config.ControlPlaneProfile) } - if metadata.ResourceData.HasChange("kubernetes_version") { - parameters.Properties.KubernetesVersion = pointer.To(config.KubernetesVersion) - } - - if metadata.ResourceData.HasChange("linux_profile") { - parameters.Properties.LinuxProfile = expandProvisionedClusterLinuxProfile(config.LinuxProfile) - } - if metadata.ResourceData.HasChange("license_profile") { parameters.Properties.LicenseProfile = expandProvisionedClusterLicenseProfile(config.LicenseProfile) } - if metadata.ResourceData.HasChange("network_profile") { - parameters.Properties.NetworkProfile = expandProvisionedClusterNetworkProfile(config.NetworkProfile) - } - if metadata.ResourceData.HasChange("storage_profile") { parameters.Properties.StorageProfile = expandProvisionedClusterStorageProfile(config.StorageProfile) } @@ -667,7 +641,7 @@ func flattenProvisionedClusterAgentPoolProfiles(input *[]provisionedclusterinsta } func expandProvisionedClusterCloudProviderProfile(input []ProvisionedClusterInstanceCloudProviderProfile) *provisionedclusterinstances.CloudProviderProfile { - if len(input) == 0 { + if len(input) == 0 || len(input[0].InfraNetworkProfile) == 0 { return nil } @@ -680,7 +654,7 @@ func expandProvisionedClusterCloudProviderProfile(input []ProvisionedClusterInst } func flattenProvisionedClusterCloudProviderProfile(input *provisionedclusterinstances.CloudProviderProfile) []ProvisionedClusterInstanceCloudProviderProfile { - if input == nil { + if input == nil || input.InfraNetworkProfile == nil { return make([]ProvisionedClusterInstanceCloudProviderProfile, 0) } diff --git a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go index f045c12a7c14..0dec6a19d52b 100644 --- a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go +++ b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go @@ -43,7 +43,7 @@ func TestAccArcKubernetesProvisionedClusterInstance(t *testing.T) { } func testAccArcKubernetesProvisionedClusterInstance_basic(t *testing.T) { - data := acceptance.BuildTestData(t, "azurerm_arc_kubernetes_provisioned_cluster_instance", "test") + data := acceptance.BuildTestData(t, "azurerm_arc_kubernetes_provisioned_cluster", "test") r := ArcKubernetesProvisionedClusterInstanceResource{} data.ResourceSequentialTest(t, r, []acceptance.TestStep{ { @@ -57,7 +57,7 @@ func testAccArcKubernetesProvisionedClusterInstance_basic(t *testing.T) { } func testAccArcKubernetesProvisionedClusterInstance_complete(t *testing.T) { - data := acceptance.BuildTestData(t, "azurerm_arc_kubernetes_provisioned_cluster_instance", "test") + data := acceptance.BuildTestData(t, "azurerm_arc_kubernetes_provisioned_cluster", "test") r := ArcKubernetesProvisionedClusterInstanceResource{} data.ResourceSequentialTest(t, r, []acceptance.TestStep{ { @@ -71,7 +71,7 @@ func testAccArcKubernetesProvisionedClusterInstance_complete(t *testing.T) { } func testAccArcKubernetesProvisionedClusterInstance_update(t *testing.T) { - data := acceptance.BuildTestData(t, "azurerm_arc_kubernetes_provisioned_cluster_instance", "test") + data := acceptance.BuildTestData(t, "azurerm_arc_kubernetes_provisioned_cluster", "test") r := ArcKubernetesProvisionedClusterInstanceResource{} data.ResourceSequentialTest(t, r, []acceptance.TestStep{ { @@ -99,7 +99,7 @@ func testAccArcKubernetesProvisionedClusterInstance_update(t *testing.T) { } func testAccArcKubernetesProvisionedClusterInstance_requiresImport(t *testing.T) { - data := acceptance.BuildTestData(t, "azurerm_arc_kubernetes_provisioned_cluster_instance", "test") + data := acceptance.BuildTestData(t, "azurerm_arc_kubernetes_provisioned_cluster", "test") r := ArcKubernetesProvisionedClusterInstanceResource{} data.ResourceSequentialTest(t, r, []acceptance.TestStep{ { @@ -139,7 +139,7 @@ func (r ArcKubernetesProvisionedClusterInstanceResource) basic(data acceptance.T return fmt.Sprintf(` %[1]s -resource "azurerm_arc_kubernetes_provisioned_cluster_instance" "test" { +resource "azurerm_arc_kubernetes_provisioned_cluster" "test" { cluster_id = azurerm_arc_kubernetes_cluster.test.id custom_location_id = "%[3]s" kubernetes_version = "1.28.5" @@ -184,9 +184,9 @@ func (r ArcKubernetesProvisionedClusterInstanceResource) requiresImport(data acc return fmt.Sprintf(` %s -resource "azurerm_arc_kubernetes_provisioned_cluster_instance" "import" { - cluster_id = azurerm_arc_kubernetes_provisioned_cluster_instance.test.cluster_id - custom_location_id = azurerm_arc_kubernetes_provisioned_cluster_instance.test.custom_location_id +resource "azurerm_arc_kubernetes_provisioned_cluster" "import" { + cluster_id = azurerm_arc_kubernetes_provisioned_cluster.test.cluster_id + custom_location_id = azurerm_arc_kubernetes_provisioned_cluster.test.custom_location_id kubernetes_version = "1.28.5" agent_pool_profile { @@ -229,7 +229,7 @@ func (r ArcKubernetesProvisionedClusterInstanceResource) complete(data acceptanc return fmt.Sprintf(` %[1]s -resource "azurerm_arc_kubernetes_provisioned_cluster_instance" "test" { +resource "azurerm_arc_kubernetes_provisioned_cluster" "test" { cluster_id = azurerm_arc_kubernetes_cluster.test.id custom_location_id = "%[3]s" kubernetes_version = "1.28.5" diff --git a/website/docs/r/arc_kubernetes_provisioned_cluster_instance.html.markdown b/website/docs/r/arc_kubernetes_provisioned_cluster_instance.html.markdown index 4202b2f049c5..578db4bb4d36 100644 --- a/website/docs/r/arc_kubernetes_provisioned_cluster_instance.html.markdown +++ b/website/docs/r/arc_kubernetes_provisioned_cluster_instance.html.markdown @@ -1,12 +1,12 @@ --- subcategory: "ArcKubernetes" layout: "azurerm" -page_title: "Azure Resource Manager: azurerm_arc_kubernetes_provisioned_cluster_instance" +page_title: "Azure Resource Manager: azurerm_arc_kubernetes_provisioned_cluster" description: |- Manages an Arc Kubernetes Provisioned Cluster Instance. --- -# azurerm_arc_kubernetes_provisioned_cluster_instance +# azurerm_arc_kubernetes_provisioned_cluster Manages an Arc Kubernetes Provisioned Cluster Instance. @@ -56,7 +56,7 @@ resource "azurerm_arc_kubernetes_cluster" "example" { } } -resource "azurerm_arc_kubernetes_provisioned_cluster_instance" "example" { +resource "azurerm_arc_kubernetes_provisioned_cluster" "example" { cluster_id = azurerm_arc_kubernetes_cluster.example.id custom_location_id = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ExtendedLocation/customLocations/cl1" kubernetes_version = "1.28.5" @@ -151,7 +151,11 @@ A `agent_pool_profile` block supports the following: * `vm_size` - (Required) The VM sku size of the agent pool node VMs. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. -* `auto_scaling_enabled` - (Optional) Should the auto scaling be enabled? Defaults to `false`. +* `os_sku` - (Required) The OS SKU used by the agent pool nodes. Possible values are `CBLMariner`, `Windows2019` and `Windows2022`. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. + +* `os_type` - (Required) The OS type for the agent pool nodes. Possible values are `Windows` and `Linux`. Defaults to `Linux`. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. + +* `auto_scaling_enabled` - (Optional) Whether to enable auto scaling. Defaults to `false`. * `count` - (Optional) The number of nodes in the agent pool. Defaults to `1`. @@ -165,10 +169,6 @@ A `agent_pool_profile` block supports the following: * `node_taints` - (Optional) The taints added to new nodes during node pool create and scale. For example, `key=value:NoSchedule`. -* `os_sku` - (Optional) The OS SKU used by the agent pool nodes. Possible values are `CBLMariner`, `Windows2019` and `Windows2022`. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. - -* `os_type` - (Optional) The OS type for the agent pool nodes. Defaults to `Linux`. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. - --- A `cloud_provider_profile` block supports the following: @@ -179,17 +179,17 @@ A `cloud_provider_profile` block supports the following: A `cluster_vm_access_profile` block supports the following: -* `authorized_ip_ranges` - (Optional) The ranges of IP Address or CIDR for SSH access to VMs in the provisioned cluster. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. +* `authorized_ip_ranges` - (Required) The ranges of IP Address or CIDR for SSH access to VMs in the provisioned cluster. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. --- A `control_plane_profile` block supports the following: -* `vm_size` - (Required) VM sku size of the control plane nodes. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. +* `vm_size` - (Required) The VM sku size of the control plane nodes. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. * `count` - (Optional) The number of control plane nodes. The count should be an odd number. Defaults to `1`. -* `host_ip` - (Optional) The IP Address of the Kubernetes API server. Conflicts with `network_profile.0.load_balancer_profile`. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. +* `host_ip` - (Optional) The IP Address of the Kubernetes API server. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. ~> **NOTE:** The `control_plane_profile.host_ip` and `load_balancer_profile` cannot be specified together. @@ -197,7 +197,7 @@ A `control_plane_profile` block supports the following: A `infra_network_profile` block supports the following: -* `vnet_subnet_ids` - (Required) Specifies a list of ARM resource IDs (maximum 1) for the infrastructure network object with `Microsoft.AzureStackHCI/logicalNetworks` or `Microsoft.HybridContainerService/virtualNetworks` resource type. +* `vnet_subnet_ids` - (Required) Specifies a list of ARM resource IDs for the infrastructure network object with `Microsoft.AzureStackHCI/logicalNetworks` or `Microsoft.HybridContainerService/virtualNetworks` resource type. --- @@ -209,7 +209,7 @@ A `license_profile` block supports the following: A `linux_profile` block supports the following: -* `ssh_key` - (Required) A list of certificate public key used to authenticate with VMs through SSH. The certificate must be in PEM format with or without headers. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. +* `ssh_key` - (Required) A list of certificate public keys used to authenticate with VMs through SSH. The certificate must be in PEM format with or without headers. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. --- @@ -223,19 +223,19 @@ A `load_balancer_profile` block supports the following: A `network_profile` block supports the following: -* `network_policy` - (Required) Network policy used for building Kubernetes network. Possible value is `calico`. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. +* `network_policy` - (Required) The network policy used for building Kubernetes network. The only possible value is `calico`. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. * `pod_cidr` - (Required) A CIDR notation IP Address range from which to assign pod IPs. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. -* `load_balancer_profile` - (Optional) A `load_balancer_profile` block as defined above.Conflicts with `control_plane_profile.0.host_ip`. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. +* `load_balancer_profile` - (Optional) A `load_balancer_profile` block as defined above. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. --- A `storage_profile` block supports the following: -* `nfs_csi_driver_enabled` - (Optional) Should the NFS CSI Driver be enabled? Defaults to `true`. +* `nfs_csi_driver_enabled` - (Optional) Whether to enable the NFS CSI Driver. Defaults to `true`. -* `smb_csi_driver_enabled` - (Optional) Should the SMB CSI Driver be enabled? Defaults to `true`. +* `smb_csi_driver_enabled` - (Optional) Whether to enable the SMB CSI Driver. Defaults to `true`. ## Attributes Reference @@ -257,5 +257,5 @@ The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/l Arc Kubernetes Provisioned Cluster Instances can be imported using the `resource id`, e.g. ```shell -terraform import azurerm_arc_kubernetes_provisioned_cluster_instance.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Kubernetes/connectedClusters/cluster1/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default +terraform import azurerm_arc_kubernetes_provisioned_cluster.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Kubernetes/connectedClusters/cluster1/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default ``` From b9b38b79fb7921c64a1dfdffcb801d85c3384fcd Mon Sep 17 00:00:00 2001 From: teowa <104055472+teowa@users.noreply.github.com> Date: Tue, 3 Sep 2024 11:09:23 +0000 Subject: [PATCH 12/17] rename variables --- ...kubernetes_provisioned_cluster_resource.go | 46 +++++++++---------- ...netes_provisioned_cluster_resource_test.go | 40 ++++++++-------- ... => arc_kubernetes_provisioned_cluster.go} | 28 +++++------ ...rc_kubernetes_provisioned_cluster_test.go} | 28 +++++------ .../services/arckubernetes/registration.go | 2 +- .../services/arckubernetes/resourceids.go | 2 +- ... arc_kubernetes_provisioned_cluster_id.go} | 4 +- ...kubernetes_provisioned_cluster_id_test.go} | 4 +- 8 files changed, 77 insertions(+), 77 deletions(-) rename internal/services/arckubernetes/parse/{arc_kubernetes_provisioned_cluster_instance.go => arc_kubernetes_provisioned_cluster.go} (74%) rename internal/services/arckubernetes/parse/{arc_kubernetes_provisioned_cluster_instance_test.go => arc_kubernetes_provisioned_cluster_test.go} (89%) rename internal/services/arckubernetes/validate/{arc_kubernetes_provisioned_cluster_instance_id.go => arc_kubernetes_provisioned_cluster_id.go} (69%) rename internal/services/arckubernetes/validate/{arc_kubernetes_provisioned_cluster_instance_id_test.go => arc_kubernetes_provisioned_cluster_id_test.go} (94%) diff --git a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go index 0c2664875edf..ebb875e1d449 100644 --- a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go +++ b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go @@ -23,25 +23,25 @@ import ( ) var ( - _ sdk.Resource = ArcKubernetesProvisionedClusterInstanceResource{} - _ sdk.ResourceWithUpdate = ArcKubernetesProvisionedClusterInstanceResource{} + _ sdk.Resource = ArcKubernetesProvisionedClusterResource{} + _ sdk.ResourceWithUpdate = ArcKubernetesProvisionedClusterResource{} ) -type ArcKubernetesProvisionedClusterInstanceResource struct{} +type ArcKubernetesProvisionedClusterResource struct{} -func (ArcKubernetesProvisionedClusterInstanceResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { - return validate.ArcKubernetesProvisionedClusterInstanceID +func (ArcKubernetesProvisionedClusterResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return validate.ArcKubernetesProvisionedClusterID } -func (ArcKubernetesProvisionedClusterInstanceResource) ResourceType() string { +func (ArcKubernetesProvisionedClusterResource) ResourceType() string { return "azurerm_arc_kubernetes_provisioned_cluster" } -func (ArcKubernetesProvisionedClusterInstanceResource) ModelObject() interface{} { - return &ArcKubernetesProvisionedClusterInstanceResourceModel{} +func (ArcKubernetesProvisionedClusterResource) ModelObject() interface{} { + return &ArcKubernetesProvisionedClusterResourceModel{} } -type ArcKubernetesProvisionedClusterInstanceResourceModel struct { +type ArcKubernetesProvisionedClusterResourceModel struct { AgentPoolProfile []ProvisionedClusterInstanceAgentPoolProfile `tfschema:"agent_pool_profile"` CloudProviderProfile []ProvisionedClusterInstanceCloudProviderProfile `tfschema:"cloud_provider_profile"` ClusterID string `tfschema:"cluster_id"` @@ -110,7 +110,7 @@ type ProvisionedClusterInstanceStorageProfile struct { NfsCsiDriverEnabled bool `tfschema:"nfs_csi_driver_enabled"` } -func (ArcKubernetesProvisionedClusterInstanceResource) Arguments() map[string]*pluginsdk.Schema { +func (ArcKubernetesProvisionedClusterResource) Arguments() map[string]*pluginsdk.Schema { return map[string]*pluginsdk.Schema{ "cluster_id": commonschema.ResourceIDReferenceRequiredForceNew(&connectedclusters.ConnectedClusterId{}), @@ -390,17 +390,17 @@ func (ArcKubernetesProvisionedClusterInstanceResource) Arguments() map[string]*p } } -func (ArcKubernetesProvisionedClusterInstanceResource) Attributes() map[string]*pluginsdk.Schema { +func (ArcKubernetesProvisionedClusterResource) Attributes() map[string]*pluginsdk.Schema { return map[string]*pluginsdk.Schema{} } -func (r ArcKubernetesProvisionedClusterInstanceResource) Create() sdk.ResourceFunc { +func (r ArcKubernetesProvisionedClusterResource) Create() sdk.ResourceFunc { return sdk.ResourceFunc{ Timeout: 30 * time.Minute, Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { client := metadata.Client.ArcKubernetes.ProvisionedClusterInstancesClient - var config ArcKubernetesProvisionedClusterInstanceResourceModel + var config ArcKubernetesProvisionedClusterResourceModel if err := metadata.Decode(&config); err != nil { return fmt.Errorf("decoding: %+v", err) } @@ -411,7 +411,7 @@ func (r ArcKubernetesProvisionedClusterInstanceResource) Create() sdk.ResourceFu } scopeId := commonids.NewScopeID(connectedClusterId.ID()) - provisionedClusterInstanceId := parse.NewArcKubernetesProvisionedClusterInstanceID(connectedClusterId.SubscriptionId, connectedClusterId.ResourceGroupName, connectedClusterId.ConnectedClusterName, "default") + provisionedClusterInstanceId := parse.NewArcKubernetesProvisionedClusterID(connectedClusterId.SubscriptionId, connectedClusterId.ResourceGroupName, connectedClusterId.ConnectedClusterName, "default") existing, err := client.ProvisionedClusterInstancesGet(ctx, scopeId) if err != nil && !response.WasNotFound(existing.HttpResponse) { @@ -450,13 +450,13 @@ func (r ArcKubernetesProvisionedClusterInstanceResource) Create() sdk.ResourceFu } } -func (r ArcKubernetesProvisionedClusterInstanceResource) Read() sdk.ResourceFunc { +func (r ArcKubernetesProvisionedClusterResource) Read() sdk.ResourceFunc { return sdk.ResourceFunc{ Timeout: 5 * time.Minute, Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { client := metadata.Client.ArcKubernetes.ProvisionedClusterInstancesClient - id, err := parse.ArcKubernetesProvisionedClusterInstanceID(metadata.ResourceData.Id()) + id, err := parse.ArcKubernetesProvisionedClusterID(metadata.ResourceData.Id()) if err != nil { return err } @@ -473,7 +473,7 @@ func (r ArcKubernetesProvisionedClusterInstanceResource) Read() sdk.ResourceFunc return fmt.Errorf("retrieving %s: %+v", *id, err) } - schema := ArcKubernetesProvisionedClusterInstanceResourceModel{ + schema := ArcKubernetesProvisionedClusterResourceModel{ ClusterID: connectedClusterId.ID(), } @@ -505,18 +505,18 @@ func (r ArcKubernetesProvisionedClusterInstanceResource) Read() sdk.ResourceFunc } } -func (r ArcKubernetesProvisionedClusterInstanceResource) Update() sdk.ResourceFunc { +func (r ArcKubernetesProvisionedClusterResource) Update() sdk.ResourceFunc { return sdk.ResourceFunc{ Timeout: 30 * time.Minute, Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { client := metadata.Client.ArcKubernetes.ProvisionedClusterInstancesClient - var config ArcKubernetesProvisionedClusterInstanceResourceModel + var config ArcKubernetesProvisionedClusterResourceModel if err := metadata.Decode(&config); err != nil { return fmt.Errorf("decoding: %+v", err) } - id, err := parse.ArcKubernetesProvisionedClusterInstanceID(metadata.ResourceData.Id()) + id, err := parse.ArcKubernetesProvisionedClusterID(metadata.ResourceData.Id()) if err != nil { return err } @@ -558,18 +558,18 @@ func (r ArcKubernetesProvisionedClusterInstanceResource) Update() sdk.ResourceFu } } -func (r ArcKubernetesProvisionedClusterInstanceResource) Delete() sdk.ResourceFunc { +func (r ArcKubernetesProvisionedClusterResource) Delete() sdk.ResourceFunc { return sdk.ResourceFunc{ Timeout: 30 * time.Minute, Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { client := metadata.Client.ArcKubernetes.ProvisionedClusterInstancesClient - var config ArcKubernetesProvisionedClusterInstanceResourceModel + var config ArcKubernetesProvisionedClusterResourceModel if err := metadata.Decode(&config); err != nil { return fmt.Errorf("decoding: %+v", err) } - id, err := parse.ArcKubernetesProvisionedClusterInstanceID(metadata.ResourceData.Id()) + id, err := parse.ArcKubernetesProvisionedClusterID(metadata.ResourceData.Id()) if err != nil { return err } diff --git a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go index 0dec6a19d52b..4f5f22447eb2 100644 --- a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go +++ b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go @@ -22,18 +22,18 @@ const ( customLocationIdEnv = "ARM_TEST_STACK_HCI_CUSTOM_LOCATION_ID" ) -type ArcKubernetesProvisionedClusterInstanceResource struct{} +type ArcKubernetesProvisionedClusterResource struct{} -func TestAccArcKubernetesProvisionedClusterInstance(t *testing.T) { +func TestAccArcKubernetesProvisionedCluster(t *testing.T) { // NOTE: this is a combined test rather than separate split out tests due to // the test environment network limitation // (which our test suite can't easily work around) testCases := map[string]func(t *testing.T){ - "basic": testAccArcKubernetesProvisionedClusterInstance_basic, - "complete": testAccArcKubernetesProvisionedClusterInstance_complete, - "update": testAccArcKubernetesProvisionedClusterInstance_update, - "requiresImport": testAccArcKubernetesProvisionedClusterInstance_requiresImport, + "basic": testAccArcKubernetesProvisionedCluster_basic, + "complete": testAccArcKubernetesProvisionedCluster_complete, + "update": testAccArcKubernetesProvisionedCluster_update, + "requiresImport": testAccArcKubernetesProvisionedCluster_requiresImport, } for name, m := range testCases { t.Run(name, func(t *testing.T) { @@ -42,9 +42,9 @@ func TestAccArcKubernetesProvisionedClusterInstance(t *testing.T) { } } -func testAccArcKubernetesProvisionedClusterInstance_basic(t *testing.T) { +func testAccArcKubernetesProvisionedCluster_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_arc_kubernetes_provisioned_cluster", "test") - r := ArcKubernetesProvisionedClusterInstanceResource{} + r := ArcKubernetesProvisionedClusterResource{} data.ResourceSequentialTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), @@ -56,9 +56,9 @@ func testAccArcKubernetesProvisionedClusterInstance_basic(t *testing.T) { }) } -func testAccArcKubernetesProvisionedClusterInstance_complete(t *testing.T) { +func testAccArcKubernetesProvisionedCluster_complete(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_arc_kubernetes_provisioned_cluster", "test") - r := ArcKubernetesProvisionedClusterInstanceResource{} + r := ArcKubernetesProvisionedClusterResource{} data.ResourceSequentialTest(t, r, []acceptance.TestStep{ { Config: r.complete(data), @@ -70,9 +70,9 @@ func testAccArcKubernetesProvisionedClusterInstance_complete(t *testing.T) { }) } -func testAccArcKubernetesProvisionedClusterInstance_update(t *testing.T) { +func testAccArcKubernetesProvisionedCluster_update(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_arc_kubernetes_provisioned_cluster", "test") - r := ArcKubernetesProvisionedClusterInstanceResource{} + r := ArcKubernetesProvisionedClusterResource{} data.ResourceSequentialTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), @@ -98,9 +98,9 @@ func testAccArcKubernetesProvisionedClusterInstance_update(t *testing.T) { }) } -func testAccArcKubernetesProvisionedClusterInstance_requiresImport(t *testing.T) { +func testAccArcKubernetesProvisionedCluster_requiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_arc_kubernetes_provisioned_cluster", "test") - r := ArcKubernetesProvisionedClusterInstanceResource{} + r := ArcKubernetesProvisionedClusterResource{} data.ResourceSequentialTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), @@ -115,10 +115,10 @@ func testAccArcKubernetesProvisionedClusterInstance_requiresImport(t *testing.T) }) } -func (r ArcKubernetesProvisionedClusterInstanceResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { +func (r ArcKubernetesProvisionedClusterResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { client := clients.ArcKubernetes.ProvisionedClusterInstancesClient - id, err := parse.ArcKubernetesProvisionedClusterInstanceID(state.ID) + id, err := parse.ArcKubernetesProvisionedClusterID(state.ID) if err != nil { return nil, err } @@ -134,7 +134,7 @@ func (r ArcKubernetesProvisionedClusterInstanceResource) Exists(ctx context.Cont return pointer.To(resp.Model != nil), nil } -func (r ArcKubernetesProvisionedClusterInstanceResource) basic(data acceptance.TestData) string { +func (r ArcKubernetesProvisionedClusterResource) basic(data acceptance.TestData) string { template := r.template(data) return fmt.Sprintf(` %[1]s @@ -179,7 +179,7 @@ resource "azurerm_arc_kubernetes_provisioned_cluster" "test" { `, template, data.RandomInteger, os.Getenv(customLocationIdEnv)) } -func (r ArcKubernetesProvisionedClusterInstanceResource) requiresImport(data acceptance.TestData) string { +func (r ArcKubernetesProvisionedClusterResource) requiresImport(data acceptance.TestData) string { config := r.basic(data) return fmt.Sprintf(` %s @@ -224,7 +224,7 @@ resource "azurerm_arc_kubernetes_provisioned_cluster" "import" { `, config) } -func (r ArcKubernetesProvisionedClusterInstanceResource) complete(data acceptance.TestData) string { +func (r ArcKubernetesProvisionedClusterResource) complete(data acceptance.TestData) string { template := r.template(data) return fmt.Sprintf(` %[1]s @@ -289,7 +289,7 @@ resource "azurerm_arc_kubernetes_provisioned_cluster" "test" { `, template, data.RandomInteger, os.Getenv(customLocationIdEnv)) } -func (r ArcKubernetesProvisionedClusterInstanceResource) template(data acceptance.TestData) string { +func (r ArcKubernetesProvisionedClusterResource) template(data acceptance.TestData) string { return fmt.Sprintf(` resource "tls_private_key" "rsaKey" { algorithm = "RSA" diff --git a/internal/services/arckubernetes/parse/arc_kubernetes_provisioned_cluster_instance.go b/internal/services/arckubernetes/parse/arc_kubernetes_provisioned_cluster.go similarity index 74% rename from internal/services/arckubernetes/parse/arc_kubernetes_provisioned_cluster_instance.go rename to internal/services/arckubernetes/parse/arc_kubernetes_provisioned_cluster.go index aff014dbdb32..95e3a7cc5715 100644 --- a/internal/services/arckubernetes/parse/arc_kubernetes_provisioned_cluster_instance.go +++ b/internal/services/arckubernetes/parse/arc_kubernetes_provisioned_cluster.go @@ -12,15 +12,15 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" ) -type ArcKubernetesProvisionedClusterInstanceId struct { +type ArcKubernetesProvisionedClusterId struct { SubscriptionId string ResourceGroup string ConnectedClusterName string ProvisionedClusterInstanceName string } -func NewArcKubernetesProvisionedClusterInstanceID(subscriptionId, resourceGroup, connectedClusterName, provisionedClusterInstanceName string) ArcKubernetesProvisionedClusterInstanceId { - return ArcKubernetesProvisionedClusterInstanceId{ +func NewArcKubernetesProvisionedClusterID(subscriptionId, resourceGroup, connectedClusterName, provisionedClusterInstanceName string) ArcKubernetesProvisionedClusterId { + return ArcKubernetesProvisionedClusterId{ SubscriptionId: subscriptionId, ResourceGroup: resourceGroup, ConnectedClusterName: connectedClusterName, @@ -28,29 +28,29 @@ func NewArcKubernetesProvisionedClusterInstanceID(subscriptionId, resourceGroup, } } -func (id ArcKubernetesProvisionedClusterInstanceId) String() string { +func (id ArcKubernetesProvisionedClusterId) String() string { segments := []string{ fmt.Sprintf("Provisioned Cluster Instance Name %q", id.ProvisionedClusterInstanceName), fmt.Sprintf("Connected Cluster Name %q", id.ConnectedClusterName), fmt.Sprintf("Resource Group %q", id.ResourceGroup), } segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Arc Kubernetes Provisioned Cluster Instance", segmentsStr) + return fmt.Sprintf("%s: (%s)", "Arc Kubernetes Provisioned Cluster", segmentsStr) } -func (id ArcKubernetesProvisionedClusterInstanceId) ID() string { +func (id ArcKubernetesProvisionedClusterId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Kubernetes/connectedClusters/%s/providers/Microsoft.HybridContainerService/provisionedClusterInstances/%s" return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.ConnectedClusterName, id.ProvisionedClusterInstanceName) } -// ArcKubernetesProvisionedClusterInstanceID parses a ArcKubernetesProvisionedClusterInstance ID into an ArcKubernetesProvisionedClusterInstanceId struct -func ArcKubernetesProvisionedClusterInstanceID(input string) (*ArcKubernetesProvisionedClusterInstanceId, error) { +// ArcKubernetesProvisionedClusterID parses a ArcKubernetesProvisionedCluster ID into an ArcKubernetesProvisionedClusterId struct +func ArcKubernetesProvisionedClusterID(input string) (*ArcKubernetesProvisionedClusterId, error) { id, err := resourceids.ParseAzureResourceID(input) if err != nil { - return nil, fmt.Errorf("parsing %q as an ArcKubernetesProvisionedClusterInstance ID: %+v", input, err) + return nil, fmt.Errorf("parsing %q as an ArcKubernetesProvisionedCluster ID: %+v", input, err) } - resourceId := ArcKubernetesProvisionedClusterInstanceId{ + resourceId := ArcKubernetesProvisionedClusterId{ SubscriptionId: id.SubscriptionID, ResourceGroup: id.ResourceGroup, } @@ -77,19 +77,19 @@ func ArcKubernetesProvisionedClusterInstanceID(input string) (*ArcKubernetesProv return &resourceId, nil } -// ArcKubernetesProvisionedClusterInstanceIDInsensitively parses an ArcKubernetesProvisionedClusterInstance ID into an ArcKubernetesProvisionedClusterInstanceId struct, insensitively -// This should only be used to parse an ID for rewriting, the ArcKubernetesProvisionedClusterInstanceID +// ArcKubernetesProvisionedClusterIDInsensitively parses an ArcKubernetesProvisionedCluster ID into an ArcKubernetesProvisionedClusterId struct, insensitively +// This should only be used to parse an ID for rewriting, the ArcKubernetesProvisionedClusterID // method should be used instead for validation etc. // // Whilst this may seem strange, this enables Terraform have consistent casing // which works around issues in Core, whilst handling broken API responses. -func ArcKubernetesProvisionedClusterInstanceIDInsensitively(input string) (*ArcKubernetesProvisionedClusterInstanceId, error) { +func ArcKubernetesProvisionedClusterIDInsensitively(input string) (*ArcKubernetesProvisionedClusterId, error) { id, err := resourceids.ParseAzureResourceID(input) if err != nil { return nil, err } - resourceId := ArcKubernetesProvisionedClusterInstanceId{ + resourceId := ArcKubernetesProvisionedClusterId{ SubscriptionId: id.SubscriptionID, ResourceGroup: id.ResourceGroup, } diff --git a/internal/services/arckubernetes/parse/arc_kubernetes_provisioned_cluster_instance_test.go b/internal/services/arckubernetes/parse/arc_kubernetes_provisioned_cluster_test.go similarity index 89% rename from internal/services/arckubernetes/parse/arc_kubernetes_provisioned_cluster_instance_test.go rename to internal/services/arckubernetes/parse/arc_kubernetes_provisioned_cluster_test.go index a28f0326eeb4..2a6a37c4e087 100644 --- a/internal/services/arckubernetes/parse/arc_kubernetes_provisioned_cluster_instance_test.go +++ b/internal/services/arckubernetes/parse/arc_kubernetes_provisioned_cluster_test.go @@ -11,21 +11,21 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" ) -var _ resourceids.Id = ArcKubernetesProvisionedClusterInstanceId{} +var _ resourceids.Id = ArcKubernetesProvisionedClusterId{} -func TestArcKubernetesProvisionedClusterInstanceIDFormatter(t *testing.T) { - actual := NewArcKubernetesProvisionedClusterInstanceID("12345678-1234-9876-4563-123456789012", "group1", "cluster1", "default").ID() +func TestArcKubernetesProvisionedClusterIDFormatter(t *testing.T) { + actual := NewArcKubernetesProvisionedClusterID("12345678-1234-9876-4563-123456789012", "group1", "cluster1", "default").ID() expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Kubernetes/connectedClusters/cluster1/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default" if actual != expected { t.Fatalf("Expected %q but got %q", expected, actual) } } -func TestArcKubernetesProvisionedClusterInstanceID(t *testing.T) { +func TestArcKubernetesProvisionedClusterID(t *testing.T) { testData := []struct { Input string Error bool - Expected *ArcKubernetesProvisionedClusterInstanceId + Expected *ArcKubernetesProvisionedClusterId }{ { @@ -85,7 +85,7 @@ func TestArcKubernetesProvisionedClusterInstanceID(t *testing.T) { { // valid Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Kubernetes/connectedClusters/cluster1/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default", - Expected: &ArcKubernetesProvisionedClusterInstanceId{ + Expected: &ArcKubernetesProvisionedClusterId{ SubscriptionId: "12345678-1234-9876-4563-123456789012", ResourceGroup: "group1", ConnectedClusterName: "cluster1", @@ -103,7 +103,7 @@ func TestArcKubernetesProvisionedClusterInstanceID(t *testing.T) { for _, v := range testData { t.Logf("[DEBUG] Testing %q", v.Input) - actual, err := ArcKubernetesProvisionedClusterInstanceID(v.Input) + actual, err := ArcKubernetesProvisionedClusterID(v.Input) if err != nil { if v.Error { continue @@ -130,11 +130,11 @@ func TestArcKubernetesProvisionedClusterInstanceID(t *testing.T) { } } -func TestArcKubernetesProvisionedClusterInstanceIDInsensitively(t *testing.T) { +func TestArcKubernetesProvisionedClusterIDInsensitively(t *testing.T) { testData := []struct { Input string Error bool - Expected *ArcKubernetesProvisionedClusterInstanceId + Expected *ArcKubernetesProvisionedClusterId }{ { @@ -194,7 +194,7 @@ func TestArcKubernetesProvisionedClusterInstanceIDInsensitively(t *testing.T) { { // valid Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Kubernetes/connectedClusters/cluster1/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default", - Expected: &ArcKubernetesProvisionedClusterInstanceId{ + Expected: &ArcKubernetesProvisionedClusterId{ SubscriptionId: "12345678-1234-9876-4563-123456789012", ResourceGroup: "group1", ConnectedClusterName: "cluster1", @@ -205,7 +205,7 @@ func TestArcKubernetesProvisionedClusterInstanceIDInsensitively(t *testing.T) { { // lower-cased segment names Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Kubernetes/connectedclusters/cluster1/providers/Microsoft.HybridContainerService/provisionedclusterinstances/default", - Expected: &ArcKubernetesProvisionedClusterInstanceId{ + Expected: &ArcKubernetesProvisionedClusterId{ SubscriptionId: "12345678-1234-9876-4563-123456789012", ResourceGroup: "group1", ConnectedClusterName: "cluster1", @@ -216,7 +216,7 @@ func TestArcKubernetesProvisionedClusterInstanceIDInsensitively(t *testing.T) { { // upper-cased segment names Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Kubernetes/CONNECTEDCLUSTERS/cluster1/providers/Microsoft.HybridContainerService/PROVISIONEDCLUSTERINSTANCES/default", - Expected: &ArcKubernetesProvisionedClusterInstanceId{ + Expected: &ArcKubernetesProvisionedClusterId{ SubscriptionId: "12345678-1234-9876-4563-123456789012", ResourceGroup: "group1", ConnectedClusterName: "cluster1", @@ -227,7 +227,7 @@ func TestArcKubernetesProvisionedClusterInstanceIDInsensitively(t *testing.T) { { // mixed-cased segment names Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Kubernetes/CoNnEcTeDcLuStErS/cluster1/providers/Microsoft.HybridContainerService/PrOvIsIoNeDcLuStErInStAnCeS/default", - Expected: &ArcKubernetesProvisionedClusterInstanceId{ + Expected: &ArcKubernetesProvisionedClusterId{ SubscriptionId: "12345678-1234-9876-4563-123456789012", ResourceGroup: "group1", ConnectedClusterName: "cluster1", @@ -239,7 +239,7 @@ func TestArcKubernetesProvisionedClusterInstanceIDInsensitively(t *testing.T) { for _, v := range testData { t.Logf("[DEBUG] Testing %q", v.Input) - actual, err := ArcKubernetesProvisionedClusterInstanceIDInsensitively(v.Input) + actual, err := ArcKubernetesProvisionedClusterIDInsensitively(v.Input) if err != nil { if v.Error { continue diff --git a/internal/services/arckubernetes/registration.go b/internal/services/arckubernetes/registration.go index c4c1effd6547..4422a0007245 100644 --- a/internal/services/arckubernetes/registration.go +++ b/internal/services/arckubernetes/registration.go @@ -47,6 +47,6 @@ func (r Registration) Resources() []sdk.Resource { return []sdk.Resource{ ArcKubernetesClusterExtensionResource{}, ArcKubernetesFluxConfigurationResource{}, - ArcKubernetesProvisionedClusterInstanceResource{}, + ArcKubernetesProvisionedClusterResource{}, } } diff --git a/internal/services/arckubernetes/resourceids.go b/internal/services/arckubernetes/resourceids.go index dfe6ee3e1bd1..993179d8904a 100644 --- a/internal/services/arckubernetes/resourceids.go +++ b/internal/services/arckubernetes/resourceids.go @@ -1,3 +1,3 @@ package arckubernetes -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ArcKubernetesProvisionedClusterInstance -rewrite=true -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Kubernetes/connectedClusters/cluster1/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ArcKubernetesProvisionedCluster -rewrite=true -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Kubernetes/connectedClusters/cluster1/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default diff --git a/internal/services/arckubernetes/validate/arc_kubernetes_provisioned_cluster_instance_id.go b/internal/services/arckubernetes/validate/arc_kubernetes_provisioned_cluster_id.go similarity index 69% rename from internal/services/arckubernetes/validate/arc_kubernetes_provisioned_cluster_instance_id.go rename to internal/services/arckubernetes/validate/arc_kubernetes_provisioned_cluster_id.go index f37d237ad5c2..a03a592470b5 100644 --- a/internal/services/arckubernetes/validate/arc_kubernetes_provisioned_cluster_instance_id.go +++ b/internal/services/arckubernetes/validate/arc_kubernetes_provisioned_cluster_id.go @@ -11,14 +11,14 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/arckubernetes/parse" ) -func ArcKubernetesProvisionedClusterInstanceID(input interface{}, key string) (warnings []string, errors []error) { +func ArcKubernetesProvisionedClusterID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) if !ok { errors = append(errors, fmt.Errorf("expected %q to be a string", key)) return } - if _, err := parse.ArcKubernetesProvisionedClusterInstanceID(v); err != nil { + if _, err := parse.ArcKubernetesProvisionedClusterID(v); err != nil { errors = append(errors, err) } diff --git a/internal/services/arckubernetes/validate/arc_kubernetes_provisioned_cluster_instance_id_test.go b/internal/services/arckubernetes/validate/arc_kubernetes_provisioned_cluster_id_test.go similarity index 94% rename from internal/services/arckubernetes/validate/arc_kubernetes_provisioned_cluster_instance_id_test.go rename to internal/services/arckubernetes/validate/arc_kubernetes_provisioned_cluster_id_test.go index f217e1dce599..89b88fb6eb8e 100644 --- a/internal/services/arckubernetes/validate/arc_kubernetes_provisioned_cluster_instance_id_test.go +++ b/internal/services/arckubernetes/validate/arc_kubernetes_provisioned_cluster_id_test.go @@ -7,7 +7,7 @@ package validate import "testing" -func TestArcKubernetesProvisionedClusterInstanceID(t *testing.T) { +func TestArcKubernetesProvisionedClusterID(t *testing.T) { cases := []struct { Input string Valid bool @@ -81,7 +81,7 @@ func TestArcKubernetesProvisionedClusterInstanceID(t *testing.T) { } for _, tc := range cases { t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := ArcKubernetesProvisionedClusterInstanceID(tc.Input, "test") + _, errors := ArcKubernetesProvisionedClusterID(tc.Input, "test") valid := len(errors) == 0 if tc.Valid != valid { From ec268bd2025344225ca678313076e943a6467f5e Mon Sep 17 00:00:00 2001 From: teowa <104055472+teowa@users.noreply.github.com> Date: Thu, 24 Oct 2024 09:39:39 +0000 Subject: [PATCH 13/17] update test --- .../services/arckubernetes/arc_kubernetes_cluster_resource.go | 1 + .../arc_kubernetes_provisioned_cluster_resource_test.go | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/services/arckubernetes/arc_kubernetes_cluster_resource.go b/internal/services/arckubernetes/arc_kubernetes_cluster_resource.go index 395bb852fe82..09ff06db4ad2 100644 --- a/internal/services/arckubernetes/arc_kubernetes_cluster_resource.go +++ b/internal/services/arckubernetes/arc_kubernetes_cluster_resource.go @@ -173,6 +173,7 @@ func resourceArcKubernetesClusterRead(d *pluginsdk.ResourceData, meta interface{ if err := d.Set("identity", identity.FlattenSystemAssigned(&model.Identity)); err != nil { return fmt.Errorf("setting `identity`: %+v", err) } + d.Set("location", location.Normalize(model.Location)) props := model.Properties d.Set("agent_public_key_certificate", props.AgentPublicKeyCertificate) diff --git a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go index 4f5f22447eb2..84786bad7be6 100644 --- a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go +++ b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go @@ -317,7 +317,6 @@ resource "azurerm_stack_hci_logical_network" "test" { end = "192.168.1.190" } route { - name = "test-route" address_prefix = "0.0.0.0/0" next_hop_ip_address = "192.168.1.1" } From a17e0515a302cedf22ef1fadacc00db1e8bc2b1c Mon Sep 17 00:00:00 2001 From: teowa <104055472+teowa@users.noreply.github.com> Date: Thu, 24 Oct 2024 12:14:11 +0000 Subject: [PATCH 14/17] go mod vendor --- .../2024-01-01/provisionedclusterinstances/README.md | 8 ++++---- .../2024-01-01/provisionedclusterinstances/client.go | 2 +- .../provisionedclusterinstances/id_scopedagentpool.go | 6 +++--- .../provisionedclusterinstances/method_agentpoolget.go | 1 - .../method_getkubernetesversions.go | 1 - .../method_getupgradeprofile.go | 1 - .../provisionedclusterinstances/method_getvmskus.go | 1 - .../method_hybrididentitymetadataget.go | 1 - .../method_hybrididentitymetadataput.go | 1 - .../method_provisionedclusterinstancesget.go | 1 - .../2024-01-01/provisionedclusterinstances/version.go | 4 +--- .../2024-01-01/virtualnetworks/README.md | 10 +++++----- .../2024-01-01/virtualnetworks/client.go | 2 +- .../2024-01-01/virtualnetworks/id_virtualnetwork.go | 6 +++--- .../2024-01-01/virtualnetworks/method_retrieve.go | 1 - .../2024-01-01/virtualnetworks/version.go | 4 +--- 16 files changed, 19 insertions(+), 31 deletions(-) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/README.md index 3d96beb4fe02..3a220dc02e95 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/README.md @@ -1,7 +1,7 @@ ## `github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances` Documentation -The `provisionedclusterinstances` SDK allows for interaction with the Azure Resource Manager Service `hybridazurekubernetesservice` (API Version `2024-01-01`). +The `provisionedclusterinstances` SDK allows for interaction with Azure Resource Manager `hybridazurekubernetesservice` (API Version `2024-01-01`). This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). @@ -25,7 +25,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := provisionedclusterinstances.NewScopedAgentPoolID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "agentPoolValue") +id := provisionedclusterinstances.NewScopedAgentPoolID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "agentPoolName") payload := provisionedclusterinstances.AgentPool{ // ... @@ -42,7 +42,7 @@ if err := client.AgentPoolCreateOrUpdateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := provisionedclusterinstances.NewScopedAgentPoolID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "agentPoolValue") +id := provisionedclusterinstances.NewScopedAgentPoolID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "agentPoolName") if err := client.AgentPoolDeleteThenPoll(ctx, id); err != nil { // handle the error @@ -54,7 +54,7 @@ if err := client.AgentPoolDeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := provisionedclusterinstances.NewScopedAgentPoolID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "agentPoolValue") +id := provisionedclusterinstances.NewScopedAgentPoolID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "agentPoolName") read, err := client.AgentPoolGet(ctx, id) if err != nil { diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/client.go index 6a00319ff27f..bcb260adbd11 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/client.go @@ -15,7 +15,7 @@ type ProvisionedClusterInstancesClient struct { } func NewProvisionedClusterInstancesClientWithBaseURI(sdkApi sdkEnv.Api) (*ProvisionedClusterInstancesClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "provisionedclusterinstances", defaultApiVersion) + client, err := resourcemanager.NewClient(sdkApi, "provisionedclusterinstances", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ProvisionedClusterInstancesClient: %+v", err) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/id_scopedagentpool.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/id_scopedagentpool.go index f999b2720cae..2879602cba63 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/id_scopedagentpool.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/id_scopedagentpool.go @@ -40,7 +40,7 @@ func ParseScopedAgentPoolID(input string) (*ScopedAgentPoolId, error) { } id := ScopedAgentPoolId{} - if err := id.FromParseResult(*parsed); err != nil { + if err = id.FromParseResult(*parsed); err != nil { return nil, err } @@ -57,7 +57,7 @@ func ParseScopedAgentPoolIDInsensitively(input string) (*ScopedAgentPoolId, erro } id := ScopedAgentPoolId{} - if err := id.FromParseResult(*parsed); err != nil { + if err = id.FromParseResult(*parsed); err != nil { return nil, err } @@ -108,7 +108,7 @@ func (id ScopedAgentPoolId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProvisionedClusterInstances", "provisionedClusterInstances", "provisionedClusterInstances"), resourceids.StaticSegment("staticDefault", "default", "default"), resourceids.StaticSegment("staticAgentPools", "agentPools", "agentPools"), - resourceids.UserSpecifiedSegment("agentPoolName", "agentPoolValue"), + resourceids.UserSpecifiedSegment("agentPoolName", "agentPoolName"), } } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_agentpoolget.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_agentpoolget.go index cbc387e3c213..f16c7489acf6 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_agentpoolget.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_agentpoolget.go @@ -45,7 +45,6 @@ func (c ProvisionedClusterInstancesClient) AgentPoolGet(ctx context.Context, id var model AgentPool result.Model = &model - if err = resp.Unmarshal(result.Model); err != nil { return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_getkubernetesversions.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_getkubernetesversions.go index b47cd7964274..b3c63e6b6a3f 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_getkubernetesversions.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_getkubernetesversions.go @@ -47,7 +47,6 @@ func (c ProvisionedClusterInstancesClient) GetKubernetesVersions(ctx context.Con var model KubernetesVersionProfile result.Model = &model - if err = resp.Unmarshal(result.Model); err != nil { return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_getupgradeprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_getupgradeprofile.go index 2279556e2ece..c6425cb99621 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_getupgradeprofile.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_getupgradeprofile.go @@ -47,7 +47,6 @@ func (c ProvisionedClusterInstancesClient) GetUpgradeProfile(ctx context.Context var model ProvisionedClusterUpgradeProfile result.Model = &model - if err = resp.Unmarshal(result.Model); err != nil { return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_getvmskus.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_getvmskus.go index 16d298704b66..1668ef6340dd 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_getvmskus.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_getvmskus.go @@ -47,7 +47,6 @@ func (c ProvisionedClusterInstancesClient) GetVMSkus(ctx context.Context, id com var model VMSkuProfile result.Model = &model - if err = resp.Unmarshal(result.Model); err != nil { return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_hybrididentitymetadataget.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_hybrididentitymetadataget.go index fe29c34d4920..e3f2bd348b47 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_hybrididentitymetadataget.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_hybrididentitymetadataget.go @@ -47,7 +47,6 @@ func (c ProvisionedClusterInstancesClient) HybridIdentityMetadataGet(ctx context var model HybridIdentityMetadata result.Model = &model - if err = resp.Unmarshal(result.Model); err != nil { return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_hybrididentitymetadataput.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_hybrididentitymetadataput.go index 10a89ea87df7..ac29afaa56d5 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_hybrididentitymetadataput.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_hybrididentitymetadataput.go @@ -52,7 +52,6 @@ func (c ProvisionedClusterInstancesClient) HybridIdentityMetadataPut(ctx context var model HybridIdentityMetadata result.Model = &model - if err = resp.Unmarshal(result.Model); err != nil { return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_provisionedclusterinstancesget.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_provisionedclusterinstancesget.go index 816cc41d9d67..47e8e2dcc2ec 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_provisionedclusterinstancesget.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/method_provisionedclusterinstancesget.go @@ -47,7 +47,6 @@ func (c ProvisionedClusterInstancesClient) ProvisionedClusterInstancesGet(ctx co var model ProvisionedCluster result.Model = &model - if err = resp.Unmarshal(result.Model); err != nil { return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/version.go index 0ebd18f17bfd..31bf25f4b0a3 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/version.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/provisionedclusterinstances/version.go @@ -1,12 +1,10 @@ package provisionedclusterinstances -import "fmt" - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. const defaultApiVersion = "2024-01-01" func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/provisionedclusterinstances/%s", defaultApiVersion) + return "hashicorp/go-azure-sdk/provisionedclusterinstances/2024-01-01" } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/README.md index c84552405ffb..d667c42979b8 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/README.md @@ -1,7 +1,7 @@ ## `github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks` Documentation -The `virtualnetworks` SDK allows for interaction with the Azure Resource Manager Service `hybridazurekubernetesservice` (API Version `2024-01-01`). +The `virtualnetworks` SDK allows for interaction with Azure Resource Manager `hybridazurekubernetesservice` (API Version `2024-01-01`). This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). @@ -25,7 +25,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := virtualnetworks.NewVirtualNetworkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualNetworkValue") +id := virtualnetworks.NewVirtualNetworkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualNetworkName") payload := virtualnetworks.VirtualNetwork{ // ... @@ -42,7 +42,7 @@ if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := virtualnetworks.NewVirtualNetworkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualNetworkValue") +id := virtualnetworks.NewVirtualNetworkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualNetworkName") if err := client.DeleteThenPoll(ctx, id); err != nil { // handle the error @@ -88,7 +88,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := virtualnetworks.NewVirtualNetworkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualNetworkValue") +id := virtualnetworks.NewVirtualNetworkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualNetworkName") read, err := client.Retrieve(ctx, id) if err != nil { @@ -104,7 +104,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := virtualnetworks.NewVirtualNetworkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualNetworkValue") +id := virtualnetworks.NewVirtualNetworkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualNetworkName") payload := virtualnetworks.VirtualNetworksPatch{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/client.go index 15c346279f67..9acbb6c10272 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/client.go @@ -15,7 +15,7 @@ type VirtualNetworksClient struct { } func NewVirtualNetworksClientWithBaseURI(sdkApi sdkEnv.Api) (*VirtualNetworksClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "virtualnetworks", defaultApiVersion) + client, err := resourcemanager.NewClient(sdkApi, "virtualnetworks", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualNetworksClient: %+v", err) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/id_virtualnetwork.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/id_virtualnetwork.go index b926754b94ab..5af388b42e37 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/id_virtualnetwork.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/id_virtualnetwork.go @@ -42,7 +42,7 @@ func ParseVirtualNetworkID(input string) (*VirtualNetworkId, error) { } id := VirtualNetworkId{} - if err := id.FromParseResult(*parsed); err != nil { + if err = id.FromParseResult(*parsed); err != nil { return nil, err } @@ -59,7 +59,7 @@ func ParseVirtualNetworkIDInsensitively(input string) (*VirtualNetworkId, error) } id := VirtualNetworkId{} - if err := id.FromParseResult(*parsed); err != nil { + if err = id.FromParseResult(*parsed); err != nil { return nil, err } @@ -115,7 +115,7 @@ func (id VirtualNetworkId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftHybridContainerService", "Microsoft.HybridContainerService", "Microsoft.HybridContainerService"), resourceids.StaticSegment("staticVirtualNetworks", "virtualNetworks", "virtualNetworks"), - resourceids.UserSpecifiedSegment("virtualNetworkName", "virtualNetworkValue"), + resourceids.UserSpecifiedSegment("virtualNetworkName", "virtualNetworkName"), } } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/method_retrieve.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/method_retrieve.go index 97fbc7ebd93a..045f558eab5e 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/method_retrieve.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/method_retrieve.go @@ -45,7 +45,6 @@ func (c VirtualNetworksClient) Retrieve(ctx context.Context, id VirtualNetworkId var model VirtualNetwork result.Model = &model - if err = resp.Unmarshal(result.Model); err != nil { return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/version.go index d9a791b90241..8e288d9a64b7 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/version.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridazurekubernetesservice/2024-01-01/virtualnetworks/version.go @@ -1,12 +1,10 @@ package virtualnetworks -import "fmt" - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. const defaultApiVersion = "2024-01-01" func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/virtualnetworks/%s", defaultApiVersion) + return "hashicorp/go-azure-sdk/virtualnetworks/2024-01-01" } From 8047d56d67d55c9f3222bf06b80181ae104efffb Mon Sep 17 00:00:00 2001 From: teowa <104055472+teowa@users.noreply.github.com> Date: Tue, 3 Dec 2024 08:16:15 +0000 Subject: [PATCH 15/17] fix lint --- .github/labeler-issue-triage.yml | 2 +- .../parse/arc_kubernetes_provisioned_cluster.go | 9 +++++---- .../parse/arc_kubernetes_provisioned_cluster_test.go | 2 -- .../arc_kubernetes_provisioned_cluster_id_test.go | 1 - 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/labeler-issue-triage.yml b/.github/labeler-issue-triage.yml index ba97f5f93250..91e74971a4b9 100644 --- a/.github/labeler-issue-triage.yml +++ b/.github/labeler-issue-triage.yml @@ -27,7 +27,7 @@ service/app-configuration: - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_app_configuration((.|\n)*)###' service/app-service: - - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_(app_service_environment_v3\W+|app_service_environment_v3\W+|app_service_source_control\W+|app_service_source_control_slot\W+|arc_kubernetes_cluster_extension\W+|arc_kubernetes_flux_configuration\W+|function_app_active_slot\W+|function_app_function\W+|function_app_hybrid_connection\W+|linux_function_app\W+|linux_function_app\W+|linux_function_app_slot\W+|linux_web_app\W+|linux_web_app\W+|linux_web_app_slot\W+|service_plan|source_control_token|static_web_app|web_app_|windows_function_app\W+|windows_function_app\W+|windows_function_app_slot\W+|windows_web_app\W+|windows_web_app\W+|windows_web_app_slot\W+)((.|\n)*)###' + - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_(app_service_environment_v3\W+|app_service_environment_v3\W+|app_service_source_control\W+|app_service_source_control_slot\W+|arc_kubernetes_cluster_extension\W+|arc_kubernetes_flux_configuration\W+|arc_kubernetes_provisioned_cluster\W+|function_app_active_slot\W+|function_app_function\W+|function_app_hybrid_connection\W+|linux_function_app\W+|linux_function_app\W+|linux_function_app_slot\W+|linux_web_app\W+|linux_web_app\W+|linux_web_app_slot\W+|service_plan|source_control_token|static_web_app|web_app_|windows_function_app\W+|windows_function_app\W+|windows_function_app_slot\W+|windows_web_app\W+|windows_web_app\W+|windows_web_app_slot\W+)((.|\n)*)###' service/application-insights: - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_application_insights((.|\n)*)###' diff --git a/internal/services/arckubernetes/parse/arc_kubernetes_provisioned_cluster.go b/internal/services/arckubernetes/parse/arc_kubernetes_provisioned_cluster.go index 95e3a7cc5715..4076346c7fd0 100644 --- a/internal/services/arckubernetes/parse/arc_kubernetes_provisioned_cluster.go +++ b/internal/services/arckubernetes/parse/arc_kubernetes_provisioned_cluster.go @@ -6,6 +6,7 @@ package parse // NOTE: this file is generated via 'go:generate' - manual changes will be overwritten import ( + "errors" "fmt" "strings" @@ -56,11 +57,11 @@ func ArcKubernetesProvisionedClusterID(input string) (*ArcKubernetesProvisionedC } if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + return nil, errors.New("ID was missing the 'subscriptions' element") } if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + return nil, errors.New("ID was missing the 'resourceGroups' element") } if resourceId.ConnectedClusterName, err = id.PopSegment("connectedClusters"); err != nil { @@ -95,11 +96,11 @@ func ArcKubernetesProvisionedClusterIDInsensitively(input string) (*ArcKubernete } if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + return nil, errors.New("ID was missing the 'subscriptions' element") } if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + return nil, errors.New("ID was missing the 'resourceGroups' element") } // find the correct casing for the 'connectedClusters' segment diff --git a/internal/services/arckubernetes/parse/arc_kubernetes_provisioned_cluster_test.go b/internal/services/arckubernetes/parse/arc_kubernetes_provisioned_cluster_test.go index 2a6a37c4e087..a69742d855c4 100644 --- a/internal/services/arckubernetes/parse/arc_kubernetes_provisioned_cluster_test.go +++ b/internal/services/arckubernetes/parse/arc_kubernetes_provisioned_cluster_test.go @@ -27,7 +27,6 @@ func TestArcKubernetesProvisionedClusterID(t *testing.T) { Error bool Expected *ArcKubernetesProvisionedClusterId }{ - { // empty Input: "", @@ -136,7 +135,6 @@ func TestArcKubernetesProvisionedClusterIDInsensitively(t *testing.T) { Error bool Expected *ArcKubernetesProvisionedClusterId }{ - { // empty Input: "", diff --git a/internal/services/arckubernetes/validate/arc_kubernetes_provisioned_cluster_id_test.go b/internal/services/arckubernetes/validate/arc_kubernetes_provisioned_cluster_id_test.go index 89b88fb6eb8e..33439ae9d59c 100644 --- a/internal/services/arckubernetes/validate/arc_kubernetes_provisioned_cluster_id_test.go +++ b/internal/services/arckubernetes/validate/arc_kubernetes_provisioned_cluster_id_test.go @@ -12,7 +12,6 @@ func TestArcKubernetesProvisionedClusterID(t *testing.T) { Input string Valid bool }{ - { // empty Input: "", From e0a1e3a19bd236db5f20e1350ba9151ed1d35e43 Mon Sep 17 00:00:00 2001 From: teowa <104055472+teowa@users.noreply.github.com> Date: Mon, 9 Dec 2024 09:31:37 +0000 Subject: [PATCH 16/17] rename to azurerm_arc_kubernetes_provisioned_cluster_instance --- .github/labeler-issue-triage.yml | 5 +- .github/labeler-pull-request-triage.yml | 5 ++ ..._provisioned_cluster_instance_resource.go} | 48 ++++++------- ...isioned_cluster_instance_resource_test.go} | 69 +++++++++---------- ...ubernetes_provisioned_cluster_instance.go} | 28 ++++---- ...etes_provisioned_cluster_instance_test.go} | 28 ++++---- .../services/arckubernetes/registration.go | 10 ++- .../services/arckubernetes/resourceids.go | 2 +- ...rnetes_provisioned_cluster_instance_id.go} | 4 +- ...s_provisioned_cluster_instance_id_test.go} | 4 +- ...provisioned_cluster_instance.html.markdown | 21 +++--- 11 files changed, 116 insertions(+), 108 deletions(-) rename internal/services/arckubernetes/{arc_kubernetes_provisioned_cluster_resource.go => arc_kubernetes_provisioned_cluster_instance_resource.go} (93%) rename internal/services/arckubernetes/{arc_kubernetes_provisioned_cluster_resource_test.go => arc_kubernetes_provisioned_cluster_instance_resource_test.go} (76%) rename internal/services/arckubernetes/parse/{arc_kubernetes_provisioned_cluster.go => arc_kubernetes_provisioned_cluster_instance.go} (74%) rename internal/services/arckubernetes/parse/{arc_kubernetes_provisioned_cluster_test.go => arc_kubernetes_provisioned_cluster_instance_test.go} (89%) rename internal/services/arckubernetes/validate/{arc_kubernetes_provisioned_cluster_id.go => arc_kubernetes_provisioned_cluster_instance_id.go} (69%) rename internal/services/arckubernetes/validate/{arc_kubernetes_provisioned_cluster_id_test.go => arc_kubernetes_provisioned_cluster_instance_id_test.go} (94%) diff --git a/.github/labeler-issue-triage.yml b/.github/labeler-issue-triage.yml index 91e74971a4b9..66351c6c5091 100644 --- a/.github/labeler-issue-triage.yml +++ b/.github/labeler-issue-triage.yml @@ -27,11 +27,14 @@ service/app-configuration: - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_app_configuration((.|\n)*)###' service/app-service: - - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_(app_service_environment_v3\W+|app_service_environment_v3\W+|app_service_source_control\W+|app_service_source_control_slot\W+|arc_kubernetes_cluster_extension\W+|arc_kubernetes_flux_configuration\W+|arc_kubernetes_provisioned_cluster\W+|function_app_active_slot\W+|function_app_function\W+|function_app_hybrid_connection\W+|linux_function_app\W+|linux_function_app\W+|linux_function_app_slot\W+|linux_web_app\W+|linux_web_app\W+|linux_web_app_slot\W+|service_plan|source_control_token|static_web_app|web_app_|windows_function_app\W+|windows_function_app\W+|windows_function_app_slot\W+|windows_web_app\W+|windows_web_app\W+|windows_web_app_slot\W+)((.|\n)*)###' + - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_(app_service_environment_v3\W+|app_service_environment_v3\W+|app_service_source_control\W+|app_service_source_control_slot\W+|function_app_active_slot\W+|function_app_function\W+|function_app_hybrid_connection\W+|linux_function_app\W+|linux_function_app\W+|linux_function_app_slot\W+|linux_web_app\W+|linux_web_app\W+|linux_web_app_slot\W+|service_plan|source_control_token|static_web_app|web_app_|windows_function_app\W+|windows_function_app\W+|windows_function_app_slot\W+|windows_web_app\W+|windows_web_app\W+|windows_web_app_slot\W+)((.|\n)*)###' service/application-insights: - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_application_insights((.|\n)*)###' +service/arc-kubernetes: + - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_arc_kubernetes_((.|\n)*)###' + service/arc-resource-bridge: - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_arc_resource_bridge_appliance((.|\n)*)###' diff --git a/.github/labeler-pull-request-triage.yml b/.github/labeler-pull-request-triage.yml index 154f12cb7ac8..486596e577c3 100644 --- a/.github/labeler-pull-request-triage.yml +++ b/.github/labeler-pull-request-triage.yml @@ -52,6 +52,11 @@ service/application-insights: - any-glob-to-any-file: - internal/services/applicationinsights/**/* +service/arc-kubernetes: +- changed-files: + - any-glob-to-any-file: + - internal/services/arckubernetes/**/* + service/arc-resource-bridge: - changed-files: - any-glob-to-any-file: diff --git a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_instance_resource.go similarity index 93% rename from internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go rename to internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_instance_resource.go index ebb875e1d449..ef5bed716ece 100644 --- a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource.go +++ b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_instance_resource.go @@ -23,25 +23,25 @@ import ( ) var ( - _ sdk.Resource = ArcKubernetesProvisionedClusterResource{} - _ sdk.ResourceWithUpdate = ArcKubernetesProvisionedClusterResource{} + _ sdk.Resource = ArcKubernetesProvisionedClusterInstanceResource{} + _ sdk.ResourceWithUpdate = ArcKubernetesProvisionedClusterInstanceResource{} ) -type ArcKubernetesProvisionedClusterResource struct{} +type ArcKubernetesProvisionedClusterInstanceResource struct{} -func (ArcKubernetesProvisionedClusterResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { - return validate.ArcKubernetesProvisionedClusterID +func (ArcKubernetesProvisionedClusterInstanceResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return validate.ArcKubernetesProvisionedClusterInstanceID } -func (ArcKubernetesProvisionedClusterResource) ResourceType() string { - return "azurerm_arc_kubernetes_provisioned_cluster" +func (ArcKubernetesProvisionedClusterInstanceResource) ResourceType() string { + return "azurerm_arc_kubernetes_provisioned_cluster_instance" } -func (ArcKubernetesProvisionedClusterResource) ModelObject() interface{} { - return &ArcKubernetesProvisionedClusterResourceModel{} +func (ArcKubernetesProvisionedClusterInstanceResource) ModelObject() interface{} { + return &ArcKubernetesProvisionedClusterInstanceResourceModel{} } -type ArcKubernetesProvisionedClusterResourceModel struct { +type ArcKubernetesProvisionedClusterInstanceResourceModel struct { AgentPoolProfile []ProvisionedClusterInstanceAgentPoolProfile `tfschema:"agent_pool_profile"` CloudProviderProfile []ProvisionedClusterInstanceCloudProviderProfile `tfschema:"cloud_provider_profile"` ClusterID string `tfschema:"cluster_id"` @@ -110,7 +110,7 @@ type ProvisionedClusterInstanceStorageProfile struct { NfsCsiDriverEnabled bool `tfschema:"nfs_csi_driver_enabled"` } -func (ArcKubernetesProvisionedClusterResource) Arguments() map[string]*pluginsdk.Schema { +func (ArcKubernetesProvisionedClusterInstanceResource) Arguments() map[string]*pluginsdk.Schema { return map[string]*pluginsdk.Schema{ "cluster_id": commonschema.ResourceIDReferenceRequiredForceNew(&connectedclusters.ConnectedClusterId{}), @@ -390,17 +390,17 @@ func (ArcKubernetesProvisionedClusterResource) Arguments() map[string]*pluginsdk } } -func (ArcKubernetesProvisionedClusterResource) Attributes() map[string]*pluginsdk.Schema { +func (ArcKubernetesProvisionedClusterInstanceResource) Attributes() map[string]*pluginsdk.Schema { return map[string]*pluginsdk.Schema{} } -func (r ArcKubernetesProvisionedClusterResource) Create() sdk.ResourceFunc { +func (r ArcKubernetesProvisionedClusterInstanceResource) Create() sdk.ResourceFunc { return sdk.ResourceFunc{ Timeout: 30 * time.Minute, Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { client := metadata.Client.ArcKubernetes.ProvisionedClusterInstancesClient - var config ArcKubernetesProvisionedClusterResourceModel + var config ArcKubernetesProvisionedClusterInstanceResourceModel if err := metadata.Decode(&config); err != nil { return fmt.Errorf("decoding: %+v", err) } @@ -411,7 +411,7 @@ func (r ArcKubernetesProvisionedClusterResource) Create() sdk.ResourceFunc { } scopeId := commonids.NewScopeID(connectedClusterId.ID()) - provisionedClusterInstanceId := parse.NewArcKubernetesProvisionedClusterID(connectedClusterId.SubscriptionId, connectedClusterId.ResourceGroupName, connectedClusterId.ConnectedClusterName, "default") + provisionedClusterInstanceId := parse.NewArcKubernetesProvisionedClusterInstanceID(connectedClusterId.SubscriptionId, connectedClusterId.ResourceGroupName, connectedClusterId.ConnectedClusterName, "default") existing, err := client.ProvisionedClusterInstancesGet(ctx, scopeId) if err != nil && !response.WasNotFound(existing.HttpResponse) { @@ -450,13 +450,13 @@ func (r ArcKubernetesProvisionedClusterResource) Create() sdk.ResourceFunc { } } -func (r ArcKubernetesProvisionedClusterResource) Read() sdk.ResourceFunc { +func (r ArcKubernetesProvisionedClusterInstanceResource) Read() sdk.ResourceFunc { return sdk.ResourceFunc{ Timeout: 5 * time.Minute, Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { client := metadata.Client.ArcKubernetes.ProvisionedClusterInstancesClient - id, err := parse.ArcKubernetesProvisionedClusterID(metadata.ResourceData.Id()) + id, err := parse.ArcKubernetesProvisionedClusterInstanceID(metadata.ResourceData.Id()) if err != nil { return err } @@ -473,7 +473,7 @@ func (r ArcKubernetesProvisionedClusterResource) Read() sdk.ResourceFunc { return fmt.Errorf("retrieving %s: %+v", *id, err) } - schema := ArcKubernetesProvisionedClusterResourceModel{ + schema := ArcKubernetesProvisionedClusterInstanceResourceModel{ ClusterID: connectedClusterId.ID(), } @@ -505,18 +505,18 @@ func (r ArcKubernetesProvisionedClusterResource) Read() sdk.ResourceFunc { } } -func (r ArcKubernetesProvisionedClusterResource) Update() sdk.ResourceFunc { +func (r ArcKubernetesProvisionedClusterInstanceResource) Update() sdk.ResourceFunc { return sdk.ResourceFunc{ Timeout: 30 * time.Minute, Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { client := metadata.Client.ArcKubernetes.ProvisionedClusterInstancesClient - var config ArcKubernetesProvisionedClusterResourceModel + var config ArcKubernetesProvisionedClusterInstanceResourceModel if err := metadata.Decode(&config); err != nil { return fmt.Errorf("decoding: %+v", err) } - id, err := parse.ArcKubernetesProvisionedClusterID(metadata.ResourceData.Id()) + id, err := parse.ArcKubernetesProvisionedClusterInstanceID(metadata.ResourceData.Id()) if err != nil { return err } @@ -558,18 +558,18 @@ func (r ArcKubernetesProvisionedClusterResource) Update() sdk.ResourceFunc { } } -func (r ArcKubernetesProvisionedClusterResource) Delete() sdk.ResourceFunc { +func (r ArcKubernetesProvisionedClusterInstanceResource) Delete() sdk.ResourceFunc { return sdk.ResourceFunc{ Timeout: 30 * time.Minute, Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { client := metadata.Client.ArcKubernetes.ProvisionedClusterInstancesClient - var config ArcKubernetesProvisionedClusterResourceModel + var config ArcKubernetesProvisionedClusterInstanceResourceModel if err := metadata.Decode(&config); err != nil { return fmt.Errorf("decoding: %+v", err) } - id, err := parse.ArcKubernetesProvisionedClusterID(metadata.ResourceData.Id()) + id, err := parse.ArcKubernetesProvisionedClusterInstanceID(metadata.ResourceData.Id()) if err != nil { return err } diff --git a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_instance_resource_test.go similarity index 76% rename from internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go rename to internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_instance_resource_test.go index 84786bad7be6..ceb0c8ddaf6f 100644 --- a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_resource_test.go +++ b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_instance_resource_test.go @@ -22,18 +22,18 @@ const ( customLocationIdEnv = "ARM_TEST_STACK_HCI_CUSTOM_LOCATION_ID" ) -type ArcKubernetesProvisionedClusterResource struct{} +type ArcKubernetesProvisionedClusterInstanceResource struct{} -func TestAccArcKubernetesProvisionedCluster(t *testing.T) { +func TestAccArcKubernetesProvisionedClusterInstance(t *testing.T) { // NOTE: this is a combined test rather than separate split out tests due to // the test environment network limitation // (which our test suite can't easily work around) testCases := map[string]func(t *testing.T){ - "basic": testAccArcKubernetesProvisionedCluster_basic, - "complete": testAccArcKubernetesProvisionedCluster_complete, - "update": testAccArcKubernetesProvisionedCluster_update, - "requiresImport": testAccArcKubernetesProvisionedCluster_requiresImport, + "basic": testAccArcKubernetesProvisionedClusterInstance_basic, + "complete": testAccArcKubernetesProvisionedClusterInstance_complete, + "update": testAccArcKubernetesProvisionedClusterInstance_update, + "requiresImport": testAccArcKubernetesProvisionedClusterInstance_requiresImport, } for name, m := range testCases { t.Run(name, func(t *testing.T) { @@ -42,9 +42,9 @@ func TestAccArcKubernetesProvisionedCluster(t *testing.T) { } } -func testAccArcKubernetesProvisionedCluster_basic(t *testing.T) { - data := acceptance.BuildTestData(t, "azurerm_arc_kubernetes_provisioned_cluster", "test") - r := ArcKubernetesProvisionedClusterResource{} +func testAccArcKubernetesProvisionedClusterInstance_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_arc_kubernetes_provisioned_cluster_instance", "test") + r := ArcKubernetesProvisionedClusterInstanceResource{} data.ResourceSequentialTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), @@ -56,9 +56,9 @@ func testAccArcKubernetesProvisionedCluster_basic(t *testing.T) { }) } -func testAccArcKubernetesProvisionedCluster_complete(t *testing.T) { - data := acceptance.BuildTestData(t, "azurerm_arc_kubernetes_provisioned_cluster", "test") - r := ArcKubernetesProvisionedClusterResource{} +func testAccArcKubernetesProvisionedClusterInstance_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_arc_kubernetes_provisioned_cluster_instance", "test") + r := ArcKubernetesProvisionedClusterInstanceResource{} data.ResourceSequentialTest(t, r, []acceptance.TestStep{ { Config: r.complete(data), @@ -70,9 +70,9 @@ func testAccArcKubernetesProvisionedCluster_complete(t *testing.T) { }) } -func testAccArcKubernetesProvisionedCluster_update(t *testing.T) { - data := acceptance.BuildTestData(t, "azurerm_arc_kubernetes_provisioned_cluster", "test") - r := ArcKubernetesProvisionedClusterResource{} +func testAccArcKubernetesProvisionedClusterInstance_update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_arc_kubernetes_provisioned_cluster_instance", "test") + r := ArcKubernetesProvisionedClusterInstanceResource{} data.ResourceSequentialTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), @@ -98,9 +98,9 @@ func testAccArcKubernetesProvisionedCluster_update(t *testing.T) { }) } -func testAccArcKubernetesProvisionedCluster_requiresImport(t *testing.T) { - data := acceptance.BuildTestData(t, "azurerm_arc_kubernetes_provisioned_cluster", "test") - r := ArcKubernetesProvisionedClusterResource{} +func testAccArcKubernetesProvisionedClusterInstance_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_arc_kubernetes_provisioned_cluster_instance", "test") + r := ArcKubernetesProvisionedClusterInstanceResource{} data.ResourceSequentialTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), @@ -115,10 +115,8 @@ func testAccArcKubernetesProvisionedCluster_requiresImport(t *testing.T) { }) } -func (r ArcKubernetesProvisionedClusterResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - client := clients.ArcKubernetes.ProvisionedClusterInstancesClient - - id, err := parse.ArcKubernetesProvisionedClusterID(state.ID) +func (r ArcKubernetesProvisionedClusterInstanceResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := parse.ArcKubernetesProvisionedClusterInstanceID(state.ID) if err != nil { return nil, err } @@ -126,7 +124,7 @@ func (r ArcKubernetesProvisionedClusterResource) Exists(ctx context.Context, cli connectedClusterId := connectedclusters.NewConnectedClusterID(id.SubscriptionId, id.ResourceGroup, id.ConnectedClusterName) scopeId := commonids.NewScopeID(connectedClusterId.ID()) - resp, err := client.ProvisionedClusterInstancesGet(ctx, scopeId) + resp, err := clients.ArcKubernetes.ProvisionedClusterInstancesClient.ProvisionedClusterInstancesGet(ctx, scopeId) if err != nil { return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } @@ -134,13 +132,13 @@ func (r ArcKubernetesProvisionedClusterResource) Exists(ctx context.Context, cli return pointer.To(resp.Model != nil), nil } -func (r ArcKubernetesProvisionedClusterResource) basic(data acceptance.TestData) string { +func (r ArcKubernetesProvisionedClusterInstanceResource) basic(data acceptance.TestData) string { template := r.template(data) return fmt.Sprintf(` %[1]s -resource "azurerm_arc_kubernetes_provisioned_cluster" "test" { - cluster_id = azurerm_arc_kubernetes_cluster.test.id +resource "azurerm_arc_kubernetes_provisioned_cluster_instance" "test" { + cluster_id = azurerm_arc_kubernetes_provisioned_cluster.test.id custom_location_id = "%[3]s" kubernetes_version = "1.28.5" @@ -179,14 +177,14 @@ resource "azurerm_arc_kubernetes_provisioned_cluster" "test" { `, template, data.RandomInteger, os.Getenv(customLocationIdEnv)) } -func (r ArcKubernetesProvisionedClusterResource) requiresImport(data acceptance.TestData) string { +func (r ArcKubernetesProvisionedClusterInstanceResource) requiresImport(data acceptance.TestData) string { config := r.basic(data) return fmt.Sprintf(` %s -resource "azurerm_arc_kubernetes_provisioned_cluster" "import" { - cluster_id = azurerm_arc_kubernetes_provisioned_cluster.test.cluster_id - custom_location_id = azurerm_arc_kubernetes_provisioned_cluster.test.custom_location_id +resource "azurerm_arc_kubernetes_provisioned_cluster_instance" "import" { + cluster_id = azurerm_arc_kubernetes_provisioned_cluster_instance.test.cluster_id + custom_location_id = azurerm_arc_kubernetes_provisioned_cluster_instance.test.custom_location_id kubernetes_version = "1.28.5" agent_pool_profile { @@ -224,13 +222,13 @@ resource "azurerm_arc_kubernetes_provisioned_cluster" "import" { `, config) } -func (r ArcKubernetesProvisionedClusterResource) complete(data acceptance.TestData) string { +func (r ArcKubernetesProvisionedClusterInstanceResource) complete(data acceptance.TestData) string { template := r.template(data) return fmt.Sprintf(` %[1]s -resource "azurerm_arc_kubernetes_provisioned_cluster" "test" { - cluster_id = azurerm_arc_kubernetes_cluster.test.id +resource "azurerm_arc_kubernetes_provisioned_cluster_instance" "test" { + cluster_id = azurerm_arc_kubernetes_provisioned_cluster.test.id custom_location_id = "%[3]s" kubernetes_version = "1.28.5" @@ -289,7 +287,7 @@ resource "azurerm_arc_kubernetes_provisioned_cluster" "test" { `, template, data.RandomInteger, os.Getenv(customLocationIdEnv)) } -func (r ArcKubernetesProvisionedClusterResource) template(data acceptance.TestData) string { +func (r ArcKubernetesProvisionedClusterInstanceResource) template(data acceptance.TestData) string { return fmt.Sprintf(` resource "tls_private_key" "rsaKey" { algorithm = "RSA" @@ -323,11 +321,10 @@ resource "azurerm_stack_hci_logical_network" "test" { } } -resource "azurerm_arc_kubernetes_cluster" "test" { +resource "azurerm_arc_kubernetes_provisioned_cluster" "test" { name = "acctest-akcc-%[1]d" resource_group_name = azurerm_resource_group.test.name location = azurerm_resource_group.test.location - kind = "ProvisionedCluster" identity { type = "SystemAssigned" } diff --git a/internal/services/arckubernetes/parse/arc_kubernetes_provisioned_cluster.go b/internal/services/arckubernetes/parse/arc_kubernetes_provisioned_cluster_instance.go similarity index 74% rename from internal/services/arckubernetes/parse/arc_kubernetes_provisioned_cluster.go rename to internal/services/arckubernetes/parse/arc_kubernetes_provisioned_cluster_instance.go index 4076346c7fd0..86f365bc7c63 100644 --- a/internal/services/arckubernetes/parse/arc_kubernetes_provisioned_cluster.go +++ b/internal/services/arckubernetes/parse/arc_kubernetes_provisioned_cluster_instance.go @@ -13,15 +13,15 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" ) -type ArcKubernetesProvisionedClusterId struct { +type ArcKubernetesProvisionedClusterInstanceId struct { SubscriptionId string ResourceGroup string ConnectedClusterName string ProvisionedClusterInstanceName string } -func NewArcKubernetesProvisionedClusterID(subscriptionId, resourceGroup, connectedClusterName, provisionedClusterInstanceName string) ArcKubernetesProvisionedClusterId { - return ArcKubernetesProvisionedClusterId{ +func NewArcKubernetesProvisionedClusterInstanceID(subscriptionId, resourceGroup, connectedClusterName, provisionedClusterInstanceName string) ArcKubernetesProvisionedClusterInstanceId { + return ArcKubernetesProvisionedClusterInstanceId{ SubscriptionId: subscriptionId, ResourceGroup: resourceGroup, ConnectedClusterName: connectedClusterName, @@ -29,29 +29,29 @@ func NewArcKubernetesProvisionedClusterID(subscriptionId, resourceGroup, connect } } -func (id ArcKubernetesProvisionedClusterId) String() string { +func (id ArcKubernetesProvisionedClusterInstanceId) String() string { segments := []string{ fmt.Sprintf("Provisioned Cluster Instance Name %q", id.ProvisionedClusterInstanceName), fmt.Sprintf("Connected Cluster Name %q", id.ConnectedClusterName), fmt.Sprintf("Resource Group %q", id.ResourceGroup), } segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Arc Kubernetes Provisioned Cluster", segmentsStr) + return fmt.Sprintf("%s: (%s)", "Arc Kubernetes Provisioned Cluster Instance", segmentsStr) } -func (id ArcKubernetesProvisionedClusterId) ID() string { +func (id ArcKubernetesProvisionedClusterInstanceId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Kubernetes/connectedClusters/%s/providers/Microsoft.HybridContainerService/provisionedClusterInstances/%s" return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.ConnectedClusterName, id.ProvisionedClusterInstanceName) } -// ArcKubernetesProvisionedClusterID parses a ArcKubernetesProvisionedCluster ID into an ArcKubernetesProvisionedClusterId struct -func ArcKubernetesProvisionedClusterID(input string) (*ArcKubernetesProvisionedClusterId, error) { +// ArcKubernetesProvisionedClusterInstanceID parses a ArcKubernetesProvisionedClusterInstance ID into an ArcKubernetesProvisionedClusterInstanceId struct +func ArcKubernetesProvisionedClusterInstanceID(input string) (*ArcKubernetesProvisionedClusterInstanceId, error) { id, err := resourceids.ParseAzureResourceID(input) if err != nil { - return nil, fmt.Errorf("parsing %q as an ArcKubernetesProvisionedCluster ID: %+v", input, err) + return nil, fmt.Errorf("parsing %q as an ArcKubernetesProvisionedClusterInstance ID: %+v", input, err) } - resourceId := ArcKubernetesProvisionedClusterId{ + resourceId := ArcKubernetesProvisionedClusterInstanceId{ SubscriptionId: id.SubscriptionID, ResourceGroup: id.ResourceGroup, } @@ -78,19 +78,19 @@ func ArcKubernetesProvisionedClusterID(input string) (*ArcKubernetesProvisionedC return &resourceId, nil } -// ArcKubernetesProvisionedClusterIDInsensitively parses an ArcKubernetesProvisionedCluster ID into an ArcKubernetesProvisionedClusterId struct, insensitively -// This should only be used to parse an ID for rewriting, the ArcKubernetesProvisionedClusterID +// ArcKubernetesProvisionedClusterInstanceIDInsensitively parses an ArcKubernetesProvisionedClusterInstance ID into an ArcKubernetesProvisionedClusterInstanceId struct, insensitively +// This should only be used to parse an ID for rewriting, the ArcKubernetesProvisionedClusterInstanceID // method should be used instead for validation etc. // // Whilst this may seem strange, this enables Terraform have consistent casing // which works around issues in Core, whilst handling broken API responses. -func ArcKubernetesProvisionedClusterIDInsensitively(input string) (*ArcKubernetesProvisionedClusterId, error) { +func ArcKubernetesProvisionedClusterInstanceIDInsensitively(input string) (*ArcKubernetesProvisionedClusterInstanceId, error) { id, err := resourceids.ParseAzureResourceID(input) if err != nil { return nil, err } - resourceId := ArcKubernetesProvisionedClusterId{ + resourceId := ArcKubernetesProvisionedClusterInstanceId{ SubscriptionId: id.SubscriptionID, ResourceGroup: id.ResourceGroup, } diff --git a/internal/services/arckubernetes/parse/arc_kubernetes_provisioned_cluster_test.go b/internal/services/arckubernetes/parse/arc_kubernetes_provisioned_cluster_instance_test.go similarity index 89% rename from internal/services/arckubernetes/parse/arc_kubernetes_provisioned_cluster_test.go rename to internal/services/arckubernetes/parse/arc_kubernetes_provisioned_cluster_instance_test.go index a69742d855c4..c14b2344649a 100644 --- a/internal/services/arckubernetes/parse/arc_kubernetes_provisioned_cluster_test.go +++ b/internal/services/arckubernetes/parse/arc_kubernetes_provisioned_cluster_instance_test.go @@ -11,21 +11,21 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" ) -var _ resourceids.Id = ArcKubernetesProvisionedClusterId{} +var _ resourceids.Id = ArcKubernetesProvisionedClusterInstanceId{} -func TestArcKubernetesProvisionedClusterIDFormatter(t *testing.T) { - actual := NewArcKubernetesProvisionedClusterID("12345678-1234-9876-4563-123456789012", "group1", "cluster1", "default").ID() +func TestArcKubernetesProvisionedClusterInstanceIDFormatter(t *testing.T) { + actual := NewArcKubernetesProvisionedClusterInstanceID("12345678-1234-9876-4563-123456789012", "group1", "cluster1", "default").ID() expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Kubernetes/connectedClusters/cluster1/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default" if actual != expected { t.Fatalf("Expected %q but got %q", expected, actual) } } -func TestArcKubernetesProvisionedClusterID(t *testing.T) { +func TestArcKubernetesProvisionedClusterInstanceID(t *testing.T) { testData := []struct { Input string Error bool - Expected *ArcKubernetesProvisionedClusterId + Expected *ArcKubernetesProvisionedClusterInstanceId }{ { // empty @@ -84,7 +84,7 @@ func TestArcKubernetesProvisionedClusterID(t *testing.T) { { // valid Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Kubernetes/connectedClusters/cluster1/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default", - Expected: &ArcKubernetesProvisionedClusterId{ + Expected: &ArcKubernetesProvisionedClusterInstanceId{ SubscriptionId: "12345678-1234-9876-4563-123456789012", ResourceGroup: "group1", ConnectedClusterName: "cluster1", @@ -102,7 +102,7 @@ func TestArcKubernetesProvisionedClusterID(t *testing.T) { for _, v := range testData { t.Logf("[DEBUG] Testing %q", v.Input) - actual, err := ArcKubernetesProvisionedClusterID(v.Input) + actual, err := ArcKubernetesProvisionedClusterInstanceID(v.Input) if err != nil { if v.Error { continue @@ -129,11 +129,11 @@ func TestArcKubernetesProvisionedClusterID(t *testing.T) { } } -func TestArcKubernetesProvisionedClusterIDInsensitively(t *testing.T) { +func TestArcKubernetesProvisionedClusterInstanceIDInsensitively(t *testing.T) { testData := []struct { Input string Error bool - Expected *ArcKubernetesProvisionedClusterId + Expected *ArcKubernetesProvisionedClusterInstanceId }{ { // empty @@ -192,7 +192,7 @@ func TestArcKubernetesProvisionedClusterIDInsensitively(t *testing.T) { { // valid Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Kubernetes/connectedClusters/cluster1/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default", - Expected: &ArcKubernetesProvisionedClusterId{ + Expected: &ArcKubernetesProvisionedClusterInstanceId{ SubscriptionId: "12345678-1234-9876-4563-123456789012", ResourceGroup: "group1", ConnectedClusterName: "cluster1", @@ -203,7 +203,7 @@ func TestArcKubernetesProvisionedClusterIDInsensitively(t *testing.T) { { // lower-cased segment names Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Kubernetes/connectedclusters/cluster1/providers/Microsoft.HybridContainerService/provisionedclusterinstances/default", - Expected: &ArcKubernetesProvisionedClusterId{ + Expected: &ArcKubernetesProvisionedClusterInstanceId{ SubscriptionId: "12345678-1234-9876-4563-123456789012", ResourceGroup: "group1", ConnectedClusterName: "cluster1", @@ -214,7 +214,7 @@ func TestArcKubernetesProvisionedClusterIDInsensitively(t *testing.T) { { // upper-cased segment names Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Kubernetes/CONNECTEDCLUSTERS/cluster1/providers/Microsoft.HybridContainerService/PROVISIONEDCLUSTERINSTANCES/default", - Expected: &ArcKubernetesProvisionedClusterId{ + Expected: &ArcKubernetesProvisionedClusterInstanceId{ SubscriptionId: "12345678-1234-9876-4563-123456789012", ResourceGroup: "group1", ConnectedClusterName: "cluster1", @@ -225,7 +225,7 @@ func TestArcKubernetesProvisionedClusterIDInsensitively(t *testing.T) { { // mixed-cased segment names Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Kubernetes/CoNnEcTeDcLuStErS/cluster1/providers/Microsoft.HybridContainerService/PrOvIsIoNeDcLuStErInStAnCeS/default", - Expected: &ArcKubernetesProvisionedClusterId{ + Expected: &ArcKubernetesProvisionedClusterInstanceId{ SubscriptionId: "12345678-1234-9876-4563-123456789012", ResourceGroup: "group1", ConnectedClusterName: "cluster1", @@ -237,7 +237,7 @@ func TestArcKubernetesProvisionedClusterIDInsensitively(t *testing.T) { for _, v := range testData { t.Logf("[DEBUG] Testing %q", v.Input) - actual, err := ArcKubernetesProvisionedClusterIDInsensitively(v.Input) + actual, err := ArcKubernetesProvisionedClusterInstanceIDInsensitively(v.Input) if err != nil { if v.Error { continue diff --git a/internal/services/arckubernetes/registration.go b/internal/services/arckubernetes/registration.go index 4422a0007245..eb6de1af129c 100644 --- a/internal/services/arckubernetes/registration.go +++ b/internal/services/arckubernetes/registration.go @@ -11,8 +11,8 @@ import ( type Registration struct{} var ( - _ sdk.TypedServiceRegistration = Registration{} - _ sdk.UntypedServiceRegistration = Registration{} + _ sdk.TypedServiceRegistrationWithAGitHubLabel = Registration{} + _ sdk.UntypedServiceRegistrationWithAGitHubLabel = Registration{} ) // Name is the name of this Service @@ -27,6 +27,10 @@ func (r Registration) WebsiteCategories() []string { } } +func (r Registration) AssociatedGitHubLabel() string { + return "service/arc-kubernetes" +} + // SupportedDataSources returns the supported Data Sources supported by this Service func (r Registration) SupportedDataSources() map[string]*pluginsdk.Resource { return map[string]*pluginsdk.Resource{} @@ -47,6 +51,6 @@ func (r Registration) Resources() []sdk.Resource { return []sdk.Resource{ ArcKubernetesClusterExtensionResource{}, ArcKubernetesFluxConfigurationResource{}, - ArcKubernetesProvisionedClusterResource{}, + ArcKubernetesProvisionedClusterInstanceResource{}, } } diff --git a/internal/services/arckubernetes/resourceids.go b/internal/services/arckubernetes/resourceids.go index 993179d8904a..dfe6ee3e1bd1 100644 --- a/internal/services/arckubernetes/resourceids.go +++ b/internal/services/arckubernetes/resourceids.go @@ -1,3 +1,3 @@ package arckubernetes -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ArcKubernetesProvisionedCluster -rewrite=true -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Kubernetes/connectedClusters/cluster1/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ArcKubernetesProvisionedClusterInstance -rewrite=true -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Kubernetes/connectedClusters/cluster1/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default diff --git a/internal/services/arckubernetes/validate/arc_kubernetes_provisioned_cluster_id.go b/internal/services/arckubernetes/validate/arc_kubernetes_provisioned_cluster_instance_id.go similarity index 69% rename from internal/services/arckubernetes/validate/arc_kubernetes_provisioned_cluster_id.go rename to internal/services/arckubernetes/validate/arc_kubernetes_provisioned_cluster_instance_id.go index a03a592470b5..f37d237ad5c2 100644 --- a/internal/services/arckubernetes/validate/arc_kubernetes_provisioned_cluster_id.go +++ b/internal/services/arckubernetes/validate/arc_kubernetes_provisioned_cluster_instance_id.go @@ -11,14 +11,14 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/arckubernetes/parse" ) -func ArcKubernetesProvisionedClusterID(input interface{}, key string) (warnings []string, errors []error) { +func ArcKubernetesProvisionedClusterInstanceID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) if !ok { errors = append(errors, fmt.Errorf("expected %q to be a string", key)) return } - if _, err := parse.ArcKubernetesProvisionedClusterID(v); err != nil { + if _, err := parse.ArcKubernetesProvisionedClusterInstanceID(v); err != nil { errors = append(errors, err) } diff --git a/internal/services/arckubernetes/validate/arc_kubernetes_provisioned_cluster_id_test.go b/internal/services/arckubernetes/validate/arc_kubernetes_provisioned_cluster_instance_id_test.go similarity index 94% rename from internal/services/arckubernetes/validate/arc_kubernetes_provisioned_cluster_id_test.go rename to internal/services/arckubernetes/validate/arc_kubernetes_provisioned_cluster_instance_id_test.go index 33439ae9d59c..7f7e2b9f1279 100644 --- a/internal/services/arckubernetes/validate/arc_kubernetes_provisioned_cluster_id_test.go +++ b/internal/services/arckubernetes/validate/arc_kubernetes_provisioned_cluster_instance_id_test.go @@ -7,7 +7,7 @@ package validate import "testing" -func TestArcKubernetesProvisionedClusterID(t *testing.T) { +func TestArcKubernetesProvisionedClusterInstanceID(t *testing.T) { cases := []struct { Input string Valid bool @@ -80,7 +80,7 @@ func TestArcKubernetesProvisionedClusterID(t *testing.T) { } for _, tc := range cases { t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := ArcKubernetesProvisionedClusterID(tc.Input, "test") + _, errors := ArcKubernetesProvisionedClusterInstanceID(tc.Input, "test") valid := len(errors) == 0 if tc.Valid != valid { diff --git a/website/docs/r/arc_kubernetes_provisioned_cluster_instance.html.markdown b/website/docs/r/arc_kubernetes_provisioned_cluster_instance.html.markdown index 578db4bb4d36..559e17451ef0 100644 --- a/website/docs/r/arc_kubernetes_provisioned_cluster_instance.html.markdown +++ b/website/docs/r/arc_kubernetes_provisioned_cluster_instance.html.markdown @@ -1,12 +1,12 @@ --- subcategory: "ArcKubernetes" layout: "azurerm" -page_title: "Azure Resource Manager: azurerm_arc_kubernetes_provisioned_cluster" +page_title: "Azure Resource Manager: azurerm_arc_kubernetes_provisioned_cluster_instance" description: |- Manages an Arc Kubernetes Provisioned Cluster Instance. --- -# azurerm_arc_kubernetes_provisioned_cluster +# azurerm_arc_kubernetes_provisioned_cluster_instance Manages an Arc Kubernetes Provisioned Cluster Instance. @@ -46,18 +46,17 @@ resource "azurerm_stack_hci_logical_network" "example" { } } -resource "azurerm_arc_kubernetes_cluster" "example" { +resource "azurerm_arc_kubernetes_provisioned_cluster" "example" { name = "example-akc" resource_group_name = azurerm_resource_group.example.name location = azurerm_resource_group.example.location - kind = "ProvisionedCluster" identity { type = "SystemAssigned" } } -resource "azurerm_arc_kubernetes_provisioned_cluster" "example" { - cluster_id = azurerm_arc_kubernetes_cluster.example.id +resource "azurerm_arc_kubernetes_provisioned_cluster_instance" "example" { + cluster_id = azurerm_arc_kubernetes_provisioned_cluster.example.id custom_location_id = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ExtendedLocation/customLocations/cl1" kubernetes_version = "1.28.5" @@ -123,7 +122,7 @@ The following arguments are supported: * `cloud_provider_profile` - (Required) A `cloud_provider_profile` block as defined below. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. -* `cluster_id` - (Required) The ID of the Arc Kubernetes Cluster. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. +* `cluster_id` - (Required) The ID of the Arc Kubernetes Provisioned Cluster. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. * `control_plane_profile` - (Required) A `control_plane_profile` block as defined below. @@ -145,7 +144,7 @@ The following arguments are supported: --- -A `agent_pool_profile` block supports the following: +An `agent_pool_profile` block supports the following: * `name` - (Required) The name which should be used for this Agent Pool. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. @@ -173,7 +172,7 @@ A `agent_pool_profile` block supports the following: A `cloud_provider_profile` block supports the following: -* `infra_network_profile` - (Required) A `infra_network_profile` block as defined below. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. +* `infra_network_profile` - (Required) An `infra_network_profile` block as defined below. Changing this forces a new Arc Kubernetes Provisioned Cluster Instance to be created. --- @@ -195,7 +194,7 @@ A `control_plane_profile` block supports the following: --- -A `infra_network_profile` block supports the following: +An `infra_network_profile` block supports the following: * `vnet_subnet_ids` - (Required) Specifies a list of ARM resource IDs for the infrastructure network object with `Microsoft.AzureStackHCI/logicalNetworks` or `Microsoft.HybridContainerService/virtualNetworks` resource type. @@ -257,5 +256,5 @@ The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/l Arc Kubernetes Provisioned Cluster Instances can be imported using the `resource id`, e.g. ```shell -terraform import azurerm_arc_kubernetes_provisioned_cluster.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Kubernetes/connectedClusters/cluster1/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default +terraform import azurerm_arc_kubernetes_provisioned_cluster_instance.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Kubernetes/connectedClusters/cluster1/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default ``` From 99c29495eb4d9b9d51346950316a1ba93232faea Mon Sep 17 00:00:00 2001 From: teowa <104055472+teowa@users.noreply.github.com> Date: Wed, 11 Dec 2024 07:52:44 +0000 Subject: [PATCH 17/17] add provider block in test config --- ...bernetes_provisioned_cluster_instance_resource_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_instance_resource_test.go b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_instance_resource_test.go index ceb0c8ddaf6f..f5ccd75eaafc 100644 --- a/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_instance_resource_test.go +++ b/internal/services/arckubernetes/arc_kubernetes_provisioned_cluster_instance_resource_test.go @@ -135,6 +135,10 @@ func (r ArcKubernetesProvisionedClusterInstanceResource) Exists(ctx context.Cont func (r ArcKubernetesProvisionedClusterInstanceResource) basic(data acceptance.TestData) string { template := r.template(data) return fmt.Sprintf(` +provider "azurerm" { + features {} +} + %[1]s resource "azurerm_arc_kubernetes_provisioned_cluster_instance" "test" { @@ -225,6 +229,10 @@ resource "azurerm_arc_kubernetes_provisioned_cluster_instance" "import" { func (r ArcKubernetesProvisionedClusterInstanceResource) complete(data acceptance.TestData) string { template := r.template(data) return fmt.Sprintf(` +provider "azurerm" { + features {} +} + %[1]s resource "azurerm_arc_kubernetes_provisioned_cluster_instance" "test" {