in internal/api/v20240610preview/nodepools_methods.go [33:117]
func (h *NodePool) Normalize(out *api.HCPOpenShiftClusterNodePool) {
if h.ID != nil {
out.ID = *h.ID
}
if h.Name != nil {
out.Name = *h.Name
}
if h.Type != nil {
out.Type = *h.Type
}
if h.SystemData != nil {
out.SystemData = &arm.SystemData{
CreatedAt: h.SystemData.CreatedAt,
LastModifiedAt: h.SystemData.LastModifiedAt,
}
if h.SystemData.CreatedBy != nil {
out.SystemData.CreatedBy = *h.SystemData.CreatedBy
}
if h.SystemData.CreatedByType != nil {
out.SystemData.CreatedByType = arm.CreatedByType(*h.SystemData.CreatedByType)
}
if h.SystemData.LastModifiedBy != nil {
out.SystemData.LastModifiedBy = *h.SystemData.LastModifiedBy
}
if h.SystemData.LastModifiedByType != nil {
out.SystemData.LastModifiedByType = arm.CreatedByType(*h.SystemData.LastModifiedByType)
}
}
if h.Location != nil {
out.Location = *h.Location
}
// Per RPC-Patch-V1-04, the Tags field does NOT follow
// JSON merge-patch (RFC 7396) semantics:
//
// When Tags are patched, the tags from the request
// replace all existing tags for the resource
//
out.Tags = api.StringPtrMapToStringMap(h.Tags)
if h.Properties != nil {
if h.Properties.ProvisioningState != nil {
out.Properties.ProvisioningState = arm.ProvisioningState(*h.Properties.ProvisioningState)
}
if h.Properties != nil {
if h.Properties.AutoRepair != nil {
out.Properties.AutoRepair = *h.Properties.AutoRepair
}
if h.Properties.Version != nil {
normalizeNodePoolVersion(h.Properties.Version, &out.Properties.Version)
}
if h.Properties.Replicas != nil {
out.Properties.Replicas = *h.Properties.Replicas
}
}
if h.Properties.Platform != nil {
normalizeNodePoolPlatform(h.Properties.Platform, &out.Properties.Platform)
}
if h.Properties.AutoScaling != nil {
out.Properties.AutoScaling = &api.NodePoolAutoScaling{}
if h.Properties.AutoScaling.Max != nil {
out.Properties.AutoScaling.Max = *h.Properties.AutoScaling.Max
}
if h.Properties.AutoScaling.Min != nil {
out.Properties.AutoScaling.Min = *h.Properties.AutoScaling.Min
}
}
out.Properties.Labels = make(map[string]string)
for _, v := range h.Properties.Labels {
if v != nil {
out.Properties.Labels[*v.Key] = *v.Value
}
}
out.Properties.Taints = make([]api.Taint, len(h.Properties.Taints))
for i := range h.Properties.Taints {
if h.Properties.Taints[i].Effect != nil {
out.Properties.Taints[i].Effect = api.Effect(*h.Properties.Taints[i].Effect)
}
if h.Properties.Taints[i].Key != nil {
out.Properties.Taints[i].Key = *h.Properties.Taints[i].Key
}
if h.Properties.Taints[i].Value != nil {
out.Properties.Taints[i].Value = *h.Properties.Taints[i].Value
}
}
}
}