func()

in v2/api/containerservice/v1api20230201/managed_clusters_agent_pool_types_gen.go [703:1078]


func (pool *ManagedClustersAgentPool_Spec) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error {
	typedInput, ok := armInput.(arm.ManagedClustersAgentPool_Spec)
	if !ok {
		return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.ManagedClustersAgentPool_Spec, got %T", armInput)
	}

	// Set property "AvailabilityZones":
	// copying flattened property:
	if typedInput.Properties != nil {
		for _, item := range typedInput.Properties.AvailabilityZones {
			pool.AvailabilityZones = append(pool.AvailabilityZones, item)
		}
	}

	// Set property "AzureName":
	pool.SetAzureName(genruntime.ExtractKubernetesResourceNameFromARMName(typedInput.Name))

	// Set property "Count":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Count != nil {
			count := *typedInput.Properties.Count
			pool.Count = &count
		}
	}

	// Set property "CreationData":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.CreationData != nil {
			var creationData1 CreationData
			err := creationData1.PopulateFromARM(owner, *typedInput.Properties.CreationData)
			if err != nil {
				return err
			}
			creationData := creationData1
			pool.CreationData = &creationData
		}
	}

	// Set property "EnableAutoScaling":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableAutoScaling != nil {
			enableAutoScaling := *typedInput.Properties.EnableAutoScaling
			pool.EnableAutoScaling = &enableAutoScaling
		}
	}

	// Set property "EnableEncryptionAtHost":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableEncryptionAtHost != nil {
			enableEncryptionAtHost := *typedInput.Properties.EnableEncryptionAtHost
			pool.EnableEncryptionAtHost = &enableEncryptionAtHost
		}
	}

	// Set property "EnableFIPS":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableFIPS != nil {
			enableFIPS := *typedInput.Properties.EnableFIPS
			pool.EnableFIPS = &enableFIPS
		}
	}

	// Set property "EnableNodePublicIP":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableNodePublicIP != nil {
			enableNodePublicIP := *typedInput.Properties.EnableNodePublicIP
			pool.EnableNodePublicIP = &enableNodePublicIP
		}
	}

	// Set property "EnableUltraSSD":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableUltraSSD != nil {
			enableUltraSSD := *typedInput.Properties.EnableUltraSSD
			pool.EnableUltraSSD = &enableUltraSSD
		}
	}

	// Set property "GpuInstanceProfile":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.GpuInstanceProfile != nil {
			var temp string
			temp = string(*typedInput.Properties.GpuInstanceProfile)
			gpuInstanceProfile := GPUInstanceProfile(temp)
			pool.GpuInstanceProfile = &gpuInstanceProfile
		}
	}

	// no assignment for property "HostGroupReference"

	// Set property "KubeletConfig":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.KubeletConfig != nil {
			var kubeletConfig1 KubeletConfig
			err := kubeletConfig1.PopulateFromARM(owner, *typedInput.Properties.KubeletConfig)
			if err != nil {
				return err
			}
			kubeletConfig := kubeletConfig1
			pool.KubeletConfig = &kubeletConfig
		}
	}

	// Set property "KubeletDiskType":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.KubeletDiskType != nil {
			var temp string
			temp = string(*typedInput.Properties.KubeletDiskType)
			kubeletDiskType := KubeletDiskType(temp)
			pool.KubeletDiskType = &kubeletDiskType
		}
	}

	// Set property "LinuxOSConfig":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.LinuxOSConfig != nil {
			var linuxOSConfig1 LinuxOSConfig
			err := linuxOSConfig1.PopulateFromARM(owner, *typedInput.Properties.LinuxOSConfig)
			if err != nil {
				return err
			}
			linuxOSConfig := linuxOSConfig1
			pool.LinuxOSConfig = &linuxOSConfig
		}
	}

	// Set property "MaxCount":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.MaxCount != nil {
			maxCount := *typedInput.Properties.MaxCount
			pool.MaxCount = &maxCount
		}
	}

	// Set property "MaxPods":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.MaxPods != nil {
			maxPods := *typedInput.Properties.MaxPods
			pool.MaxPods = &maxPods
		}
	}

	// Set property "MinCount":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.MinCount != nil {
			minCount := *typedInput.Properties.MinCount
			pool.MinCount = &minCount
		}
	}

	// Set property "Mode":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Mode != nil {
			var temp string
			temp = string(*typedInput.Properties.Mode)
			mode := AgentPoolMode(temp)
			pool.Mode = &mode
		}
	}

	// Set property "NodeLabels":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.NodeLabels != nil {
			pool.NodeLabels = make(map[string]string, len(typedInput.Properties.NodeLabels))
			for key, value := range typedInput.Properties.NodeLabels {
				pool.NodeLabels[key] = value
			}
		}
	}

	// no assignment for property "NodePublicIPPrefixReference"

	// Set property "NodeTaints":
	// copying flattened property:
	if typedInput.Properties != nil {
		for _, item := range typedInput.Properties.NodeTaints {
			pool.NodeTaints = append(pool.NodeTaints, item)
		}
	}

	// no assignment for property "OperatorSpec"

	// Set property "OrchestratorVersion":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.OrchestratorVersion != nil {
			orchestratorVersion := *typedInput.Properties.OrchestratorVersion
			pool.OrchestratorVersion = &orchestratorVersion
		}
	}

	// Set property "OsDiskSizeGB":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.OsDiskSizeGB != nil {
			osDiskSizeGB := ContainerServiceOSDisk(*typedInput.Properties.OsDiskSizeGB)
			pool.OsDiskSizeGB = &osDiskSizeGB
		}
	}

	// Set property "OsDiskType":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.OsDiskType != nil {
			var temp string
			temp = string(*typedInput.Properties.OsDiskType)
			osDiskType := OSDiskType(temp)
			pool.OsDiskType = &osDiskType
		}
	}

	// Set property "OsSKU":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.OsSKU != nil {
			var temp string
			temp = string(*typedInput.Properties.OsSKU)
			osSKU := OSSKU(temp)
			pool.OsSKU = &osSKU
		}
	}

	// Set property "OsType":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.OsType != nil {
			var temp string
			temp = string(*typedInput.Properties.OsType)
			osType := OSType(temp)
			pool.OsType = &osType
		}
	}

	// Set property "Owner":
	pool.Owner = &genruntime.KnownResourceReference{
		Name:  owner.Name,
		ARMID: owner.ARMID,
	}

	// no assignment for property "PodSubnetReference"

	// Set property "PowerState":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PowerState != nil {
			var powerState1 PowerState
			err := powerState1.PopulateFromARM(owner, *typedInput.Properties.PowerState)
			if err != nil {
				return err
			}
			powerState := powerState1
			pool.PowerState = &powerState
		}
	}

	// no assignment for property "ProximityPlacementGroupReference"

	// Set property "ScaleDownMode":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ScaleDownMode != nil {
			var temp string
			temp = string(*typedInput.Properties.ScaleDownMode)
			scaleDownMode := ScaleDownMode(temp)
			pool.ScaleDownMode = &scaleDownMode
		}
	}

	// Set property "ScaleSetEvictionPolicy":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ScaleSetEvictionPolicy != nil {
			var temp string
			temp = string(*typedInput.Properties.ScaleSetEvictionPolicy)
			scaleSetEvictionPolicy := ScaleSetEvictionPolicy(temp)
			pool.ScaleSetEvictionPolicy = &scaleSetEvictionPolicy
		}
	}

	// Set property "ScaleSetPriority":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ScaleSetPriority != nil {
			var temp string
			temp = string(*typedInput.Properties.ScaleSetPriority)
			scaleSetPriority := ScaleSetPriority(temp)
			pool.ScaleSetPriority = &scaleSetPriority
		}
	}

	// Set property "SpotMaxPrice":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.SpotMaxPrice != nil {
			spotMaxPrice := *typedInput.Properties.SpotMaxPrice
			pool.SpotMaxPrice = &spotMaxPrice
		}
	}

	// Set property "Tags":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Tags != nil {
			pool.Tags = make(map[string]string, len(typedInput.Properties.Tags))
			for key, value := range typedInput.Properties.Tags {
				pool.Tags[key] = value
			}
		}
	}

	// Set property "Type":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Type != nil {
			var temp string
			temp = string(*typedInput.Properties.Type)
			typeVar := AgentPoolType(temp)
			pool.Type = &typeVar
		}
	}

	// Set property "UpgradeSettings":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.UpgradeSettings != nil {
			var upgradeSettings1 AgentPoolUpgradeSettings
			err := upgradeSettings1.PopulateFromARM(owner, *typedInput.Properties.UpgradeSettings)
			if err != nil {
				return err
			}
			upgradeSettings := upgradeSettings1
			pool.UpgradeSettings = &upgradeSettings
		}
	}

	// Set property "VmSize":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.VmSize != nil {
			vmSize := *typedInput.Properties.VmSize
			pool.VmSize = &vmSize
		}
	}

	// no assignment for property "VnetSubnetReference"

	// Set property "WorkloadRuntime":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.WorkloadRuntime != nil {
			var temp string
			temp = string(*typedInput.Properties.WorkloadRuntime)
			workloadRuntime := WorkloadRuntime(temp)
			pool.WorkloadRuntime = &workloadRuntime
		}
	}

	// No error
	return nil
}