protected override void ProcessRecord() { GetSession(); if (Record != null) { Mode = Record.mode; Properties = CommonCmdletFunctions.ConvertDictionaryToHashtable(Record.properties); } else if (HashTable != null) { Mode = (bond_mode)CommonCmdletFunctions.EnumParseDefault(typeof(bond_mode), Marshalling.ParseString(HashTable, "mode")); Properties = (Marshalling.ParseHashTable(HashTable, "properties")); } if (!ShouldProcess(session.Url, "Bond.create")) { return; } RunApiCall(() => { var contxt = _context as XenServerCmdletDynamicParameters; if (contxt != null && contxt.Async) { taskRef = XenAPI.Bond.async_create(session, Network, Members, MAC, Mode, CommonCmdletFunctions.ConvertHashTableToDictionary <string, string>(Properties)); if (PassThru) { XenAPI.Task taskObj = null; if (taskRef != "OpaqueRef:NULL") { taskObj = XenAPI.Task.get_record(session, taskRef.opaque_ref); taskObj.opaque_ref = taskRef.opaque_ref; } WriteObject(taskObj, true); } } else { string objRef = XenAPI.Bond.create(session, Network, Members, MAC, Mode, CommonCmdletFunctions.ConvertHashTableToDictionary <string, string>(Properties)); if (PassThru) { XenAPI.Bond obj = null; if (objRef != "OpaqueRef:NULL") { obj = XenAPI.Bond.get_record(session, objRef); obj.opaque_ref = objRef; } WriteObject(obj, true); } } }); UpdateSessions(); }
protected override void ProcessRecord() { GetSession(); if (Record != null) { NameLabel = Record.name_label; NameDescription = Record.name_description; PhysicalSize = Record.physical_size; Type = Record.type; ContentType = Record.content_type; Shared = Record.shared; SmConfig = CommonCmdletFunctions.ConvertDictionaryToHashtable(Record.sm_config); } else if (HashTable != null) { NameLabel = Marshalling.ParseString(HashTable, "name_label"); NameDescription = Marshalling.ParseString(HashTable, "name_description"); PhysicalSize = Marshalling.ParseLong(HashTable, "physical_size"); Type = Marshalling.ParseString(HashTable, "type"); ContentType = Marshalling.ParseString(HashTable, "content_type"); Shared = Marshalling.ParseBool(HashTable, "shared"); SmConfig = (Marshalling.ParseHashTable(HashTable, "sm_config")); } if (!ShouldProcess(session.Url, "SR.create")) { return; } RunApiCall(() => { var contxt = _context as XenServerCmdletDynamicParameters; if (contxt != null && contxt.Async) { taskRef = XenAPI.SR.async_create(session, XenHost, CommonCmdletFunctions.ConvertHashTableToDictionary <string, string>(DeviceConfig), PhysicalSize, NameLabel, NameDescription, Type, ContentType, Shared, CommonCmdletFunctions.ConvertHashTableToDictionary <string, string>(SmConfig)); if (PassThru) { XenAPI.Task taskObj = null; if (taskRef != "OpaqueRef:NULL") { taskObj = XenAPI.Task.get_record(session, taskRef.opaque_ref); taskObj.opaque_ref = taskRef.opaque_ref; } WriteObject(taskObj, true); } } else { string objRef = XenAPI.SR.create(session, XenHost, CommonCmdletFunctions.ConvertHashTableToDictionary <string, string>(DeviceConfig), PhysicalSize, NameLabel, NameDescription, Type, ContentType, Shared, CommonCmdletFunctions.ConvertHashTableToDictionary <string, string>(SmConfig)); if (PassThru) { XenAPI.SR obj = null; if (objRef != "OpaqueRef:NULL") { obj = XenAPI.SR.get_record(session, objRef); obj.opaque_ref = objRef; } WriteObject(obj, true); } } }); UpdateSessions(); }
protected override void ProcessRecord() { GetSession(); if (Record != null) { VM = Record.VM; USBGroup = Record.USB_group; OtherConfig = CommonCmdletFunctions.ConvertDictionaryToHashtable(Record.other_config); } else if (HashTable != null) { VM = Marshalling.ParseRef <VM>(HashTable, "VM"); USBGroup = Marshalling.ParseRef <USB_group>(HashTable, "USB_group"); OtherConfig = (Marshalling.ParseHashTable(HashTable, "other_config")); } if (!ShouldProcess(session.Url, "VUSB.create")) { return; } RunApiCall(() => { var contxt = _context as XenServerCmdletDynamicParameters; if (contxt != null && contxt.Async) { taskRef = XenAPI.VUSB.async_create(session, VM, USBGroup, CommonCmdletFunctions.ConvertHashTableToDictionary <string, string>(OtherConfig)); if (PassThru) { XenAPI.Task taskObj = null; if (taskRef != "OpaqueRef:NULL") { taskObj = XenAPI.Task.get_record(session, taskRef.opaque_ref); taskObj.opaque_ref = taskRef.opaque_ref; } WriteObject(taskObj, true); } } else { string objRef = XenAPI.VUSB.create(session, VM, USBGroup, CommonCmdletFunctions.ConvertHashTableToDictionary <string, string>(OtherConfig)); if (PassThru) { XenAPI.VUSB obj = null; if (objRef != "OpaqueRef:NULL") { obj = XenAPI.VUSB.get_record(session, objRef); obj.opaque_ref = objRef; } WriteObject(obj, true); } } }); UpdateSessions(); }
protected override void ProcessRecord() { GetSession(); if (Record != null) { NameLabel = Record.name_label; NameDescription = Record.name_description; OtherConfig = CommonCmdletFunctions.ConvertDictionaryToHashtable(Record.other_config); } else if (HashTable != null) { NameLabel = Marshalling.ParseString(HashTable, "name_label"); NameDescription = Marshalling.ParseString(HashTable, "name_description"); OtherConfig = (Marshalling.ParseHashTable(HashTable, "other_config")); } if (!ShouldProcess(session.Url, "GPU_group.create")) { return; } RunApiCall(() => { var contxt = _context as XenServerCmdletDynamicParameters; if (contxt != null && contxt.Async) { taskRef = XenAPI.GPU_group.async_create(session, NameLabel, NameDescription, CommonCmdletFunctions.ConvertHashTableToDictionary <string, string>(OtherConfig)); if (PassThru) { XenAPI.Task taskObj = null; if (taskRef != "OpaqueRef:NULL") { taskObj = XenAPI.Task.get_record(session, taskRef.opaque_ref); taskObj.opaque_ref = taskRef.opaque_ref; } WriteObject(taskObj, true); } } else { string objRef = XenAPI.GPU_group.create(session, NameLabel, NameDescription, CommonCmdletFunctions.ConvertHashTableToDictionary <string, string>(OtherConfig)); if (PassThru) { XenAPI.GPU_group obj = null; if (objRef != "OpaqueRef:NULL") { obj = XenAPI.GPU_group.get_record(session, objRef); obj.opaque_ref = objRef; } WriteObject(obj, true); } } }); UpdateSessions(); }