in v2/api/containerservice/v1api20210501/storage/managed_cluster_types_gen.go [752:1168]
func (cluster *ManagedCluster_Spec) AssignProperties_To_ManagedCluster_Spec(destination *storage.ManagedCluster_Spec) error {
// Clone the existing property bag
propertyBag := genruntime.NewPropertyBag(cluster.PropertyBag)
// AadProfile
if cluster.AadProfile != nil {
var aadProfile storage.ManagedClusterAADProfile
err := cluster.AadProfile.AssignProperties_To_ManagedClusterAADProfile(&aadProfile)
if err != nil {
return eris.Wrap(err, "calling AssignProperties_To_ManagedClusterAADProfile() to populate field AadProfile")
}
destination.AadProfile = &aadProfile
} else {
destination.AadProfile = nil
}
// AddonProfiles
if cluster.AddonProfiles != nil {
addonProfileMap := make(map[string]storage.ManagedClusterAddonProfile, len(cluster.AddonProfiles))
for addonProfileKey, addonProfileValue := range cluster.AddonProfiles {
// Shadow the loop variable to avoid aliasing
addonProfileValue := addonProfileValue
var addonProfile storage.ManagedClusterAddonProfile
err := addonProfileValue.AssignProperties_To_ManagedClusterAddonProfile(&addonProfile)
if err != nil {
return eris.Wrap(err, "calling AssignProperties_To_ManagedClusterAddonProfile() to populate field AddonProfiles")
}
addonProfileMap[addonProfileKey] = addonProfile
}
destination.AddonProfiles = addonProfileMap
} else {
destination.AddonProfiles = nil
}
// AgentPoolProfiles
if cluster.AgentPoolProfiles != nil {
agentPoolProfileList := make([]storage.ManagedClusterAgentPoolProfile, len(cluster.AgentPoolProfiles))
for agentPoolProfileIndex, agentPoolProfileItem := range cluster.AgentPoolProfiles {
// Shadow the loop variable to avoid aliasing
agentPoolProfileItem := agentPoolProfileItem
var agentPoolProfile storage.ManagedClusterAgentPoolProfile
err := agentPoolProfileItem.AssignProperties_To_ManagedClusterAgentPoolProfile(&agentPoolProfile)
if err != nil {
return eris.Wrap(err, "calling AssignProperties_To_ManagedClusterAgentPoolProfile() to populate field AgentPoolProfiles")
}
agentPoolProfileList[agentPoolProfileIndex] = agentPoolProfile
}
destination.AgentPoolProfiles = agentPoolProfileList
} else {
destination.AgentPoolProfiles = nil
}
// ApiServerAccessProfile
if cluster.ApiServerAccessProfile != nil {
var apiServerAccessProfile storage.ManagedClusterAPIServerAccessProfile
err := cluster.ApiServerAccessProfile.AssignProperties_To_ManagedClusterAPIServerAccessProfile(&apiServerAccessProfile)
if err != nil {
return eris.Wrap(err, "calling AssignProperties_To_ManagedClusterAPIServerAccessProfile() to populate field ApiServerAccessProfile")
}
destination.ApiServerAccessProfile = &apiServerAccessProfile
} else {
destination.ApiServerAccessProfile = nil
}
// AutoScalerProfile
if cluster.AutoScalerProfile != nil {
var autoScalerProfile storage.ManagedClusterProperties_AutoScalerProfile
err := cluster.AutoScalerProfile.AssignProperties_To_ManagedClusterProperties_AutoScalerProfile(&autoScalerProfile)
if err != nil {
return eris.Wrap(err, "calling AssignProperties_To_ManagedClusterProperties_AutoScalerProfile() to populate field AutoScalerProfile")
}
destination.AutoScalerProfile = &autoScalerProfile
} else {
destination.AutoScalerProfile = nil
}
// AutoUpgradeProfile
if cluster.AutoUpgradeProfile != nil {
var autoUpgradeProfile storage.ManagedClusterAutoUpgradeProfile
err := cluster.AutoUpgradeProfile.AssignProperties_To_ManagedClusterAutoUpgradeProfile(&autoUpgradeProfile)
if err != nil {
return eris.Wrap(err, "calling AssignProperties_To_ManagedClusterAutoUpgradeProfile() to populate field AutoUpgradeProfile")
}
destination.AutoUpgradeProfile = &autoUpgradeProfile
} else {
destination.AutoUpgradeProfile = nil
}
// AzureMonitorProfile
if propertyBag.Contains("AzureMonitorProfile") {
var azureMonitorProfile storage.ManagedClusterAzureMonitorProfile
err := propertyBag.Pull("AzureMonitorProfile", &azureMonitorProfile)
if err != nil {
return eris.Wrap(err, "pulling 'AzureMonitorProfile' from propertyBag")
}
destination.AzureMonitorProfile = &azureMonitorProfile
} else {
destination.AzureMonitorProfile = nil
}
// AzureName
destination.AzureName = cluster.AzureName
// DisableLocalAccounts
if cluster.DisableLocalAccounts != nil {
disableLocalAccount := *cluster.DisableLocalAccounts
destination.DisableLocalAccounts = &disableLocalAccount
} else {
destination.DisableLocalAccounts = nil
}
// DiskEncryptionSetIDReference
if cluster.DiskEncryptionSetIDReference != nil {
propertyBag.Add("DiskEncryptionSetIDReference", *cluster.DiskEncryptionSetIDReference)
} else {
propertyBag.Remove("DiskEncryptionSetIDReference")
}
// DiskEncryptionSetReference
if propertyBag.Contains("DiskEncryptionSetReference") {
var diskEncryptionSetReference genruntime.ResourceReference
err := propertyBag.Pull("DiskEncryptionSetReference", &diskEncryptionSetReference)
if err != nil {
return eris.Wrap(err, "pulling 'DiskEncryptionSetReference' from propertyBag")
}
destination.DiskEncryptionSetReference = &diskEncryptionSetReference
} else {
destination.DiskEncryptionSetReference = nil
}
// DnsPrefix
destination.DnsPrefix = genruntime.ClonePointerToString(cluster.DnsPrefix)
// EnablePodSecurityPolicy
if cluster.EnablePodSecurityPolicy != nil {
enablePodSecurityPolicy := *cluster.EnablePodSecurityPolicy
destination.EnablePodSecurityPolicy = &enablePodSecurityPolicy
} else {
destination.EnablePodSecurityPolicy = nil
}
// EnableRBAC
if cluster.EnableRBAC != nil {
enableRBAC := *cluster.EnableRBAC
destination.EnableRBAC = &enableRBAC
} else {
destination.EnableRBAC = nil
}
// ExtendedLocation
if cluster.ExtendedLocation != nil {
var extendedLocation storage.ExtendedLocation
err := cluster.ExtendedLocation.AssignProperties_To_ExtendedLocation(&extendedLocation)
if err != nil {
return eris.Wrap(err, "calling AssignProperties_To_ExtendedLocation() to populate field ExtendedLocation")
}
destination.ExtendedLocation = &extendedLocation
} else {
destination.ExtendedLocation = nil
}
// FqdnSubdomain
destination.FqdnSubdomain = genruntime.ClonePointerToString(cluster.FqdnSubdomain)
// HttpProxyConfig
if cluster.HttpProxyConfig != nil {
var httpProxyConfig storage.ManagedClusterHTTPProxyConfig
err := cluster.HttpProxyConfig.AssignProperties_To_ManagedClusterHTTPProxyConfig(&httpProxyConfig)
if err != nil {
return eris.Wrap(err, "calling AssignProperties_To_ManagedClusterHTTPProxyConfig() to populate field HttpProxyConfig")
}
destination.HttpProxyConfig = &httpProxyConfig
} else {
destination.HttpProxyConfig = nil
}
// Identity
if cluster.Identity != nil {
var identity storage.ManagedClusterIdentity
err := cluster.Identity.AssignProperties_To_ManagedClusterIdentity(&identity)
if err != nil {
return eris.Wrap(err, "calling AssignProperties_To_ManagedClusterIdentity() to populate field Identity")
}
destination.Identity = &identity
} else {
destination.Identity = nil
}
// IdentityProfile
if cluster.IdentityProfile != nil {
identityProfileMap := make(map[string]storage.UserAssignedIdentity, len(cluster.IdentityProfile))
for identityProfileKey, identityProfileValue := range cluster.IdentityProfile {
// Shadow the loop variable to avoid aliasing
identityProfileValue := identityProfileValue
var identityProfile storage.UserAssignedIdentity
err := identityProfileValue.AssignProperties_To_UserAssignedIdentity(&identityProfile)
if err != nil {
return eris.Wrap(err, "calling AssignProperties_To_UserAssignedIdentity() to populate field IdentityProfile")
}
identityProfileMap[identityProfileKey] = identityProfile
}
destination.IdentityProfile = identityProfileMap
} else {
destination.IdentityProfile = nil
}
// KubernetesVersion
destination.KubernetesVersion = genruntime.ClonePointerToString(cluster.KubernetesVersion)
// LinuxProfile
if cluster.LinuxProfile != nil {
var linuxProfile storage.ContainerServiceLinuxProfile
err := cluster.LinuxProfile.AssignProperties_To_ContainerServiceLinuxProfile(&linuxProfile)
if err != nil {
return eris.Wrap(err, "calling AssignProperties_To_ContainerServiceLinuxProfile() to populate field LinuxProfile")
}
destination.LinuxProfile = &linuxProfile
} else {
destination.LinuxProfile = nil
}
// Location
destination.Location = genruntime.ClonePointerToString(cluster.Location)
// NetworkProfile
if cluster.NetworkProfile != nil {
var networkProfile storage.ContainerServiceNetworkProfile
err := cluster.NetworkProfile.AssignProperties_To_ContainerServiceNetworkProfile(&networkProfile)
if err != nil {
return eris.Wrap(err, "calling AssignProperties_To_ContainerServiceNetworkProfile() to populate field NetworkProfile")
}
destination.NetworkProfile = &networkProfile
} else {
destination.NetworkProfile = nil
}
// NodeResourceGroup
destination.NodeResourceGroup = genruntime.ClonePointerToString(cluster.NodeResourceGroup)
// OidcIssuerProfile
if propertyBag.Contains("OidcIssuerProfile") {
var oidcIssuerProfile storage.ManagedClusterOIDCIssuerProfile
err := propertyBag.Pull("OidcIssuerProfile", &oidcIssuerProfile)
if err != nil {
return eris.Wrap(err, "pulling 'OidcIssuerProfile' from propertyBag")
}
destination.OidcIssuerProfile = &oidcIssuerProfile
} else {
destination.OidcIssuerProfile = nil
}
// OperatorSpec
if cluster.OperatorSpec != nil {
var operatorSpec storage.ManagedClusterOperatorSpec
err := cluster.OperatorSpec.AssignProperties_To_ManagedClusterOperatorSpec(&operatorSpec)
if err != nil {
return eris.Wrap(err, "calling AssignProperties_To_ManagedClusterOperatorSpec() to populate field OperatorSpec")
}
destination.OperatorSpec = &operatorSpec
} else {
destination.OperatorSpec = nil
}
// OriginalVersion
destination.OriginalVersion = cluster.OriginalVersion
// Owner
if cluster.Owner != nil {
owner := cluster.Owner.Copy()
destination.Owner = &owner
} else {
destination.Owner = nil
}
// PodIdentityProfile
if cluster.PodIdentityProfile != nil {
var podIdentityProfile storage.ManagedClusterPodIdentityProfile
err := cluster.PodIdentityProfile.AssignProperties_To_ManagedClusterPodIdentityProfile(&podIdentityProfile)
if err != nil {
return eris.Wrap(err, "calling AssignProperties_To_ManagedClusterPodIdentityProfile() to populate field PodIdentityProfile")
}
destination.PodIdentityProfile = &podIdentityProfile
} else {
destination.PodIdentityProfile = nil
}
// PrivateLinkResources
if cluster.PrivateLinkResources != nil {
privateLinkResourceList := make([]storage.PrivateLinkResource, len(cluster.PrivateLinkResources))
for privateLinkResourceIndex, privateLinkResourceItem := range cluster.PrivateLinkResources {
// Shadow the loop variable to avoid aliasing
privateLinkResourceItem := privateLinkResourceItem
var privateLinkResource storage.PrivateLinkResource
err := privateLinkResourceItem.AssignProperties_To_PrivateLinkResource(&privateLinkResource)
if err != nil {
return eris.Wrap(err, "calling AssignProperties_To_PrivateLinkResource() to populate field PrivateLinkResources")
}
privateLinkResourceList[privateLinkResourceIndex] = privateLinkResource
}
destination.PrivateLinkResources = privateLinkResourceList
} else {
destination.PrivateLinkResources = nil
}
// PublicNetworkAccess
if propertyBag.Contains("PublicNetworkAccess") {
var publicNetworkAccess string
err := propertyBag.Pull("PublicNetworkAccess", &publicNetworkAccess)
if err != nil {
return eris.Wrap(err, "pulling 'PublicNetworkAccess' from propertyBag")
}
destination.PublicNetworkAccess = &publicNetworkAccess
} else {
destination.PublicNetworkAccess = nil
}
// SecurityProfile
if propertyBag.Contains("SecurityProfile") {
var securityProfile storage.ManagedClusterSecurityProfile
err := propertyBag.Pull("SecurityProfile", &securityProfile)
if err != nil {
return eris.Wrap(err, "pulling 'SecurityProfile' from propertyBag")
}
destination.SecurityProfile = &securityProfile
} else {
destination.SecurityProfile = nil
}
// ServicePrincipalProfile
if cluster.ServicePrincipalProfile != nil {
var servicePrincipalProfile storage.ManagedClusterServicePrincipalProfile
err := cluster.ServicePrincipalProfile.AssignProperties_To_ManagedClusterServicePrincipalProfile(&servicePrincipalProfile)
if err != nil {
return eris.Wrap(err, "calling AssignProperties_To_ManagedClusterServicePrincipalProfile() to populate field ServicePrincipalProfile")
}
destination.ServicePrincipalProfile = &servicePrincipalProfile
} else {
destination.ServicePrincipalProfile = nil
}
// Sku
if cluster.Sku != nil {
var sku storage.ManagedClusterSKU
err := cluster.Sku.AssignProperties_To_ManagedClusterSKU(&sku)
if err != nil {
return eris.Wrap(err, "calling AssignProperties_To_ManagedClusterSKU() to populate field Sku")
}
destination.Sku = &sku
} else {
destination.Sku = nil
}
// StorageProfile
if propertyBag.Contains("StorageProfile") {
var storageProfile storage.ManagedClusterStorageProfile
err := propertyBag.Pull("StorageProfile", &storageProfile)
if err != nil {
return eris.Wrap(err, "pulling 'StorageProfile' from propertyBag")
}
destination.StorageProfile = &storageProfile
} else {
destination.StorageProfile = nil
}
// Tags
destination.Tags = genruntime.CloneMapOfStringToString(cluster.Tags)
// WindowsProfile
if cluster.WindowsProfile != nil {
var windowsProfile storage.ManagedClusterWindowsProfile
err := cluster.WindowsProfile.AssignProperties_To_ManagedClusterWindowsProfile(&windowsProfile)
if err != nil {
return eris.Wrap(err, "calling AssignProperties_To_ManagedClusterWindowsProfile() to populate field WindowsProfile")
}
destination.WindowsProfile = &windowsProfile
} else {
destination.WindowsProfile = nil
}
// WorkloadAutoScalerProfile
if propertyBag.Contains("WorkloadAutoScalerProfile") {
var workloadAutoScalerProfile storage.ManagedClusterWorkloadAutoScalerProfile
err := propertyBag.Pull("WorkloadAutoScalerProfile", &workloadAutoScalerProfile)
if err != nil {
return eris.Wrap(err, "pulling 'WorkloadAutoScalerProfile' from propertyBag")
}
destination.WorkloadAutoScalerProfile = &workloadAutoScalerProfile
} else {
destination.WorkloadAutoScalerProfile = nil
}
// Update the property bag
if len(propertyBag) > 0 {
destination.PropertyBag = propertyBag
} else {
destination.PropertyBag = nil
}
// Invoke the augmentConversionForManagedCluster_Spec interface (if implemented) to customize the conversion
var clusterAsAny any = cluster
if augmentedCluster, ok := clusterAsAny.(augmentConversionForManagedCluster_Spec); ok {
err := augmentedCluster.AssignPropertiesTo(destination)
if err != nil {
return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
}
}
// No error
return nil
}