public Interface(Mapping.Interface iface, DataCenter[] dataCenters = null, IpAddress[] ips = null) { this.Id = iface.Id; this.DataCenterId = iface.DataCenterId; if (dataCenters != null) this.DataCenter = dataCenters.SingleOrDefault(d => d.Id == iface.DataCenterId); this.Created = iface.Created; this.LastUpdated = iface.LastUpdated; if (iface.Num != null) this.Index = Convert.ToInt32(iface.Num); this.Status = Converter.ToInterfaceStatus(iface.State); this.Bandwidth = iface.Bandwidth; this.Type = Converter.ToInterfaceType(iface.Type); if (iface.VirtualMachineId != null) this.VirtualMachineId = Convert.ToInt32(iface.VirtualMachineId); this.VirtualMachine = null; this.IpAddressIds = iface.IpAddressIds; if (ips != null) { List<IpAddress> ipList = new List<IpAddress>(); foreach (int ipId in iface.IpAddressIds) { IpAddress ipAddress = ips.SingleOrDefault(i => i.Id == ipId); if (ipAddress.Interface == null) ipAddress.Interface = this; ipList.Add(ipAddress); } this.IpAddresses = ipList.ToArray(); } }
public VirtualMachine Single(int virtualMachineId, DataCenter[] dataCenters = null, Interface[] interfaces = null, Disk[] disks = null) { Mapping.VirtualMachine mappingVirtualMachine = this.service.VirtualMachineInfo(this.apiKey, virtualMachineId); if (mappingVirtualMachine != null) return new VirtualMachine(mappingVirtualMachine, dataCenters, interfaces, disks); else return null; }
public Disk Single(int diskId, DataCenter[] dataCenters = null) { Mapping.Disk mappingDisk = this.service.DiskInfo(this.apiKey, diskId); if (mappingDisk != null) return new Disk(mappingDisk, dataCenters); else return null; }
public IpAddress Single(int ipAddressId, DataCenter[] dataCenters = null) { Mapping.IpAddress mappingIpAddress = this.service.IpAddressInfo(this.apiKey, ipAddressId); if (mappingIpAddress != null) return new IpAddress(mappingIpAddress, dataCenters); else return null; }
public Interface Single(int interfaceId, DataCenter[] dataCenters = null, IpAddress[] ipAddresses = null) { Mapping.Interface mappingInterface = this.service.InterfaceInfo(this.apiKey, interfaceId); if (mappingInterface != null) return new Interface(mappingInterface, dataCenters, ipAddresses); else return null; }
public VirtualMachine[] List(DataCenter[] dataCenters, Interface[] interfaces, Disk[] disks) { Mapping.VirtualMachine[] mappingVirtualMachines = this.service.VirtualMachineList(this.apiKey); List<VirtualMachine> virtualMachineList = new List<VirtualMachine>(); foreach (Mapping.VirtualMachine mappingVirtualMachine in mappingVirtualMachines) virtualMachineList.Add(new VirtualMachine(mappingVirtualMachine, dataCenters, interfaces, disks)); VirtualMachine[] virtualMachines = virtualMachineList.ToArray(); return virtualMachines; }
public Disk[] List(DataCenter[] dataCenters = null) { Mapping.Disk[] mappingDisks = this.service.DiskList(this.apiKey); List<Disk> diskList = new List<Disk>(); foreach (Mapping.Disk mappingDisk in mappingDisks) diskList.Add(new Disk(mappingDisk, dataCenters)); Disk[] disks = diskList.ToArray(); return disks; }
public IpAddress[] List(DataCenter[] dataCenters = null) { Mapping.IpAddress[] mappingIpAddresses = this.service.IpAddressList(this.apiKey); List<IpAddress> ipAddressList = new List<IpAddress>(); foreach (Mapping.IpAddress mappingIpAddress in mappingIpAddresses) ipAddressList.Add(new IpAddress(mappingIpAddress, dataCenters)); IpAddress[] ipAddresses = ipAddressList.ToArray(); return ipAddresses; }
public Interface[] List(DataCenter[] dataCenters = null, IpAddress[] ipAddresses = null) { Mapping.Interface[] mappingInterfaces = this.service.InterfaceList(this.apiKey); List<Interface> interfaceList = new List<Interface>(); foreach (Mapping.Interface mappingInterface in mappingInterfaces) interfaceList.Add(new Interface(mappingInterface, dataCenters, ipAddresses)); Interface[] interfaces = interfaceList.ToArray(); return interfaces; }
public Image(Mapping.Image image, DataCenter[] dataCenters = null, Disk[] disks = null) { this.Id = image.Id; this.Label = image.Label; this.DataCenterId = image.DataCenterId; if (dataCenters != null) this.DataCenter = dataCenters.SingleOrDefault(d => d.Id == image.DataCenterId); this.DiskId = image.DiskId; if (disks != null) this.Disk = disks.SingleOrDefault(d => d.Id == image.DiskId); this.Visibility = Converter.ToImageVisibility(image.Visibility); this.Architecture = Converter.ToImageArchitecture(image.OsArchitecture); this.AuthorId = image.AuthorId; }
public IpAddress(Mapping.IpAddress ipAddress, DataCenter[] dataCenters = null) { this.Id = ipAddress.Id; this.DataCenterId = ipAddress.DataCenterId; if (dataCenters != null) this.DataCenter = dataCenters.SingleOrDefault(d => d.Id == ipAddress.DataCenterId); if (ipAddress.InterfaceId != null) this.InterfaceId = Convert.ToInt32(ipAddress.InterfaceId); this.Interface = null; this.Created = ipAddress.Created; this.LastUpdated = ipAddress.LastUpdated; this.Ip = IPAddress.Parse(ipAddress.Ip); this.Reverse = ipAddress.Reverse; this.Status = Converter.ToIpAddressStatus(ipAddress.State); this.Version = Converter.ToIpVersion(ipAddress.Version); }
public Disk(Mapping.Disk disk, DataCenter[] dataCenters = null) { this.Id = disk.Id; this.Name = disk.Name; this.Created = disk.Created; this.LastUpdated = disk.LastUpdated; this.Size = disk.Size; this.State = disk.State; if (disk.Source != null) this.Source = Convert.ToInt32(disk.Source); this.Visibility = disk.Visibility; this.Type = Converter.ToDiskType(disk.Type); this.IsBootDisk = disk.IsBootDisk; this.VirtualMachineIds = disk.VirtualMachineIds; this.VirtualMachines = null; this.KernelVersion = disk.KernelVersion; this.Label = disk.Label; this.DataCenterId = disk.DataCenterId; if (dataCenters != null) this.DataCenter = dataCenters.SingleOrDefault(d => d.Id == disk.DataCenterId); }
public DataCenterResourceDetail(DataCenter dataCenter) { this.Value = String.Format(DataCenterResourceDetail.ValueTemplate, dataCenter.Name, dataCenter.Country); }