public override void Run() { // Login VapiAuthHelper = new VapiAuthenticationHelper(); SessionStubConfiguration = VapiAuthHelper.LoginByUsernameAndPassword( Server, UserName, Password); this.sataService = VapiAuthHelper.StubFactory.CreateStub <Sata>( SessionStubConfiguration); Console.WriteLine("\n\n#### Setup: Get the virtual machine id"); this.vmId = VmHelper.GetVm(VapiAuthHelper.StubFactory, SessionStubConfiguration, VmName); Console.WriteLine("Using VM: " + VmName + " (vmId=" + this.vmId + ") for SATA adapter configuration sample"); Console.WriteLine("\n\n#### Example: List of all SATA adapters " + "on the VM"); List <SataTypes.Summary> sataSummaries = this.sataService.List(this.vmId); sataSummaries.ForEach(i => Console.WriteLine(i)); Console.WriteLine("\n\n#### Display information about each " + "adapter"); foreach (SataTypes.Summary sataSummary in sataSummaries) { SataTypes.Info info = this.sataService.Get(this.vmId, sataSummary.GetAdapter()); Console.WriteLine(info); } Console.WriteLine("\n\n#### Example: Create SATA adapter with " + "defaults."); SataTypes.CreateSpec sataCreateSpec = new SataTypes.CreateSpec(); string sataId = this.sataService.Create(this.vmId, sataCreateSpec); Console.WriteLine(sataCreateSpec); SataTypes.Info sataInfo = this.sataService.Get(this.vmId, sataId); Console.WriteLine("SATA Adapter ID=" + sataId); Console.WriteLine(sataInfo); this.createdSataAdapters.Add(sataId); Console.WriteLine("\n\n#### Create SATA adapter with specific " + "bus"); sataCreateSpec = new SataTypes.CreateSpec(); sataCreateSpec.SetBus(2L); sataId = this.sataService.Create(this.vmId, sataCreateSpec); Console.WriteLine(sataCreateSpec); sataInfo = this.sataService.Get(this.vmId, sataId); Console.WriteLine("SATA Adapter ID=" + sataId); Console.WriteLine(sataInfo); this.createdSataAdapters.Add(sataId); // List all SATA adapters for a VM Console.WriteLine("\n\n#### List all SATA adapters on the VM"); sataSummaries = this.sataService.List(this.vmId); sataSummaries.ForEach(i => Console.WriteLine(i)); }
public override void Run() { // Login VapiAuthHelper = new VapiAuthenticationHelper(); SessionStubConfiguration = VapiAuthHelper.LoginByUsernameAndPassword( Server, UserName, Password); this.cdromService = VapiAuthHelper.StubFactory.CreateStub <Cdrom>( SessionStubConfiguration); this.powerService = VapiAuthHelper.StubFactory.CreateStub <Power>( SessionStubConfiguration); this.sataService = VapiAuthHelper.StubFactory.CreateStub <Sata>( SessionStubConfiguration); Console.WriteLine("\n\n#### Setup: Get the virtual machine id"); this.vmId = VmHelper.GetVm(VapiAuthHelper.StubFactory, SessionStubConfiguration, VmName); Console.WriteLine("Using VM: " + VmName + " (vmId=" + this.vmId + " ) for the CD-ROM configuration sample."); Console.WriteLine("\n\n#### Setup: Create SATA controller"); SataTypes.CreateSpec sataCreateSpec = new SataTypes.CreateSpec(); this.sataId = sataService.Create(this.vmId, sataCreateSpec); Console.WriteLine(sataCreateSpec); Console.WriteLine("\n\n### Example: List all CD-ROMs"); ListAllCdroms(); Console.WriteLine("\n\n### Example: Create CD-ROM with ISO_FILE" + " backing"); CreateCdrom(CdromTypes.BackingType.ISO_FILE); Console.WriteLine("\n\n### Example: Create CD-ROM with " + "CLIENT_DEVICE backing"); CreateCdrom(CdromTypes.BackingType.CLIENT_DEVICE); Console.WriteLine("\n\n### Example: Create SATA CD-ROM with" + " CLIENT_DEVICE backing"); CreateCdromForAdapterType(CdromTypes.HostBusAdapterType.SATA, CdromTypes.BackingType.CLIENT_DEVICE); Console.WriteLine("\n\n### Example: Create SATA CD-ROM on specific" + " bus with CLIENT_DEVICE backing"); CreateSataCdromAtSpecificLocation( CdromTypes.BackingType.CLIENT_DEVICE, 0L, null); Console.WriteLine("\n\n### Example: Create SATA CD-ROM on specific" + " bus and unit number with CLIENT_DEVICE " + "backing"); CreateSataCdromAtSpecificLocation( CdromTypes.BackingType.CLIENT_DEVICE, 0L, 10L); Console.WriteLine("\n\n### Example: Create IDE CD-ROM with" + " CLIENT_DEVICE backing"); CreateCdromForAdapterType(CdromTypes.HostBusAdapterType.IDE, CdromTypes.BackingType.CLIENT_DEVICE); Console.WriteLine("\n\n### Example: Create IDE CD-ROM as a slave" + " device with HOST_DEVICE backing"); CreateIdeCdromAsSpecificDevice( CdromTypes.BackingType.HOST_DEVICE, false); }