コード例 #1
0
 internal static object FromDto(MachineDto20183 dto)
 {
     return(new Machine
     {
         Id = dto.Id,
         LicenseKey = dto.LicenseKey,
         Name = dto.Name,
         NonProductionSlots = dto.NonProductionSlots,
         UnattendedSlots = dto.UnattendedSlots,
         Type = dto.Type
     });
 }
コード例 #2
0
        private void AddMachine20183()
        {
            var machine = new MachineDto20183
            {
                Name = Name,
                NonProductionSlots = NonProductionSlots,
                UnattendedSlots    = UnattendedSlots,
                Type = (MachineDtoType)Enum.Parse(typeof(MachineDtoType), Type ?? nameof(MachineDtoType.Standard))
            };

            if (MyInvocation.BoundParameters.ContainsKey(nameof(LicenseKey)))
            {
                machine.LicenseKey = LicenseKey.ToString();
            }
            var response = HandleHttpOperationException(() => Api_18_3.Machines.Post(machine));

            WriteObject(Machine.FromDto(response));
        }