func ToNetworkSpaceInfos(allInfos SpaceInfos) network.SpaceInfos {
	res := make(network.SpaceInfos, len(allInfos.Infos))

	for i, si := range allInfos.Infos {
		mappedSubnets := make(network.SubnetInfos, len(si.Subnets))
		for j, subnetInfo := range si.Subnets {
			mappedSubnets[j] = network.SubnetInfo{
				ID:                network.Id(subnetInfo.ID),
				CIDR:              subnetInfo.CIDR,
				ProviderId:        network.Id(subnetInfo.ProviderId),
				ProviderSpaceId:   network.Id(subnetInfo.ProviderSpaceId),
				ProviderNetworkId: network.Id(subnetInfo.ProviderNetworkId),
				VLANTag:           subnetInfo.VLANTag,
				AvailabilityZones: subnetInfo.Zones,
				SpaceID:           subnetInfo.SpaceID,
				IsPublic:          subnetInfo.IsPublic,
				SpaceName:         si.Name,
			}

			if subnetInfo.FanInfo != nil {
				mappedSubnets[j].SetFan(subnetInfo.FanInfo.Underlay, subnetInfo.FanInfo.Overlay)
			}
		}

		res[i] = network.SpaceInfo{
			ID:         si.ID,
			Name:       network.SpaceName(si.Name),
			ProviderId: network.Id(si.ProviderID),
			Subnets:    mappedSubnets,
		}
	}

	return res
}
// ToNetworkSpaceInfos converts a serializable SpaceInfos payload into a
// network.SpaceInfos instance.
ToNetworkSpaceInfos converts a serializable SpaceInfos payload into a
network.SpaceInfos instance.
// ToNetworkSpaceInfos converts a serializable SpaceInfos payload into a // network . SpaceInfos instance .
func ToNetworkSpaceInfos(allInfos SpaceInfos) network.SpaceInfos {
	res := make(network.SpaceInfos, len(allInfos.Infos))
	for i, si := range allInfos.Infos {
		mappedSubnets := make(network.SubnetInfos, len(si.Subnets))
		for j, subnetInfo := range si.Subnets {
			mappedSubnets[j] = network.SubnetInfo{
				ID:                network.Id(subnetInfo.ID),
				CIDR:              subnetInfo.CIDR,
				ProviderId:        network.Id(subnetInfo.ProviderId),
				ProviderSpaceId:   network.Id(subnetInfo.ProviderSpaceId),
				ProviderNetworkId: network.Id(subnetInfo.ProviderNetworkId),
				VLANTag:           subnetInfo.VLANTag,
				AvailabilityZones: subnetInfo.Zones,
				SpaceID:           subnetInfo.SpaceID,
				IsPublic:          subnetInfo.IsPublic,
				SpaceName:         si.Name,
			}
			if subnetInfo.FanInfo != nil {
				mappedSubnets[j].SetFan(subnetInfo.FanInfo.Underlay, subnetInfo.FanInfo.Overlay)
			}
		}
		res[i] = network.SpaceInfo{
			ID:         si.ID,
			Name:       network.SpaceName(si.Name),
			ProviderId: network.Id(si.ProviderID),
			Subnets:    mappedSubnets,
		}
	}
	return res
}
func ToNetworkSpaceInfos ( allInfos SpaceInfos ) network . SpaceInfos { res := make ( network . SpaceInfos , len ( allInfos . Infos ) ) for i , si := range allInfos . Infos { mappedSubnets := make ( network . SubnetInfos , len ( si . Subnets ) ) for j , subnetInfo := range si . Subnets { mappedSubnets [ j ] = network . SubnetInfo { ID : network . Id ( subnetInfo . ID ) , CIDR : subnetInfo . CIDR , ProviderId : network . Id ( subnetInfo . ProviderId ) , ProviderSpaceId : network . Id ( subnetInfo . ProviderSpaceId ) , ProviderNetworkId : network . Id ( subnetInfo . ProviderNetworkId ) , VLANTag : subnetInfo . VLANTag , AvailabilityZones : subnetInfo . Zones , SpaceID : subnetInfo . SpaceID , IsPublic : subnetInfo . IsPublic , SpaceName : si . Name , } if subnetInfo . FanInfo != nil { mappedSubnets [ j ] . SetFan ( subnetInfo . FanInfo . Underlay , subnetInfo . FanInfo . Overlay ) } } res [ i ] = network . SpaceInfo { ID : si . ID , Name : network . SpaceName ( si . Name ) , ProviderId : network . Id ( si . ProviderID ) , Subnets : mappedSubnets , } } return res }
ToNetworkSpaceInfos converts a serializable SpaceInfos payload into a
network.SpaceInfos instance.
ToNetworkSpaceInfos converts a serializable SpaceInfos payload into a network . SpaceInfos instance .