func()

in internal/api/v20240610preview/hcpopenshiftclusters_methods.go [105:149]


func (v version) NewHCPOpenShiftCluster(from *api.HCPOpenShiftCluster) api.VersionedHCPOpenShiftCluster {
	if from == nil {
		from = api.NewDefaultHCPOpenShiftCluster()
	}

	out := &HcpOpenShiftCluster{
		generated.HcpOpenShiftCluster{
			ID:       api.Ptr(from.ID),
			Name:     api.Ptr(from.Name),
			Type:     api.Ptr(from.Type),
			Location: api.Ptr(from.Location),
			Tags:     api.StringMapToStringPtrMap(from.Tags),
			Identity: &generated.ManagedServiceIdentity{
				Type:        api.Ptr(generated.ManagedServiceIdentityType(from.Identity.Type)),
				PrincipalID: api.Ptr(from.Identity.PrincipalID),
				TenantID:    api.Ptr(from.Identity.TenantID),
				//as UserAssignedIdentities is of a different type so using convertUserAssignedIdentities instead of StringMapToStringPtrMap
				UserAssignedIdentities: convertUserAssignedIdentities(from.Identity.UserAssignedIdentities),
			},
			Properties: &generated.HcpOpenShiftClusterProperties{
				ProvisioningState: api.Ptr(generated.ProvisioningState(from.Properties.ProvisioningState)),
				Version:           newVersionProfile(&from.Properties.Version),
				DNS:               newDNSProfile(&from.Properties.DNS),
				Network:           newNetworkProfile(&from.Properties.Network),
				Console:           newConsoleProfile(&from.Properties.Console),
				API:               newAPIProfile(&from.Properties.API),
				Platform:          newPlatformProfile(&from.Properties.Platform),
				Capabilities:      newClusterCapabilitiesProfile(&from.Properties.Capabilities),
			},
		},
	}

	if from.SystemData != nil {
		out.SystemData = &generated.SystemData{
			CreatedBy:          api.Ptr(from.SystemData.CreatedBy),
			CreatedByType:      api.Ptr(generated.CreatedByType(from.SystemData.CreatedByType)),
			CreatedAt:          from.SystemData.CreatedAt,
			LastModifiedBy:     api.Ptr(from.SystemData.LastModifiedBy),
			LastModifiedByType: api.Ptr(generated.CreatedByType(from.SystemData.LastModifiedByType)),
			LastModifiedAt:     from.SystemData.LastModifiedAt,
		}
	}

	return out
}