protected override void ProcessRecord() { ProcessImpl( filter => Api.ProcessSchedules.GetProcessSchedules(filter: filter).Value, id => Api.ProcessSchedules.GetById(id), dto => ProcessSchedule.FromDto(dto)); }
protected override void ProcessRecord() { ProcessImpl( (filter, top, skip) => Api.ProcessSchedules.GetProcessSchedules(filter: filter, top: top, skip: skip, count: false), id => Api.ProcessSchedules.GetById(id), dto => ProcessSchedule.FromDto(dto)); }
protected override void ProcessRecord() { if (Supports(OrchestratorProtocolVersion.V19_10)) { ProcessImpl( (filter, top, skip) => HandleHttpResponseException(() => Api_19_10.ProcessSchedules.GetProcessSchedulesWithHttpMessagesAsync(filter: filter, top: top, skip: skip, count: false)), id => HandleHttpResponseException(() => Api_19_10.ProcessSchedules.GetByIdWithHttpMessagesAsync(id)), dto => ProcessSchedule.FromDto(dto)); } else { ProcessImpl( (filter, top, skip) => Api.ProcessSchedules.GetProcessSchedules(filter: filter, top: top, skip: skip, count: false), id => Api.ProcessSchedules.GetById(id), dto => ProcessSchedule.FromDto(dto)); } }
private void AddQueueSchedule() { var dto = new ProcessSchedule201910Dto { Name = Name, QueueDefinitionId = Queue.Id, ReleaseId = Process.Id, ItemsActivationThreshold = ItemsActivationThreshold, ItemsPerJobActivationTarget = ItemsPerJobActivationTarget, MaxJobsForActivation = MaxJobsForActivation, TimeZoneId = TimeZoneId, StartProcessCron = StartProcessCron, StartProcessCronDetails = "{\"type\": 5, \"advancedCronExpression\":\"" + StartProcessCron + "\"}", StartStrategy = -1, }; var schedule = HandleHttpResponseException(() => Api_19_10.ProcessSchedules.PostWithHttpMessagesAsync(dto)); WriteObject(ProcessSchedule.FromDto(schedule)); }
protected override void ProcessRecord() { var dto = new ProcessScheduleDto { Name = Name, StartProcessCron = StartProcessCron, StartProcessCronDetails = "{\"type\": 5, \"advancedCronExpression\":\"" + StartProcessCron + "\"}", ReleaseId = Process.Id, TimeZoneId = TimeZoneId }; if (StopAfterMinutes.HasValue) { dto.StopProcessExpression = TimeSpan.FromMinutes(StopAfterMinutes.Value).TotalSeconds.ToString(); dto.StopStrategy = (ProcessScheduleDtoStopStrategy)Enum.Parse(typeof(ProcessScheduleDtoStopStrategy), StopStrategy); } if (ParameterSetName == AllRobotsSet) { dto.StartStrategy = -1; } else if (ParameterSetName == RobotCountSet) { dto.StartStrategy = RobotCount; } else if (ParameterSetName == SpecificRobotsSet) { dto.StartStrategy = 0; dto.ExecutorRobots = Robots.Select(r => new RobotExecutorDto { Id = r.Id }).ToList(); } var schedule = HandleHttpOperationException(() => Api.ProcessSchedules.Post(dto)); WriteObject(ProcessSchedule.FromDto(schedule)); }
public void ScheduleAddRemove() { using (var runspace = PowershellFactory.CreateAuthenticatedSession(TestContext)) { ProcessSchedule schedule = null; Process process = null; var name = TestRandom.RandomString(); var description = TestRandom.RandomString(); using (var cmdlet = PowershellFactory.CreateCmdlet(runspace)) { cmdlet.AddCommand(UiPathStrings.GetUiPathProcess) .AddParameter(UiPathStrings.Id, 2); var processes = Invoke <Process>(cmdlet); process = processes[0]; } using (var cmdlet = PowershellFactory.CreateCmdlet(runspace)) { cmdlet.AddCommand(UiPathStrings.AddUiPathProcessSchedule) .AddParameter(UiPathStrings.Name, name) .AddParameter(UiPathStrings.Process, process) .AddParameter(UiPathStrings.StartProcessCron, TestCron) .AddParameter(UiPathStrings.TimeZoneId, TimeZone.CurrentTimeZone.StandardName) .AddParameter(UiPathStrings.RobotCount, 1); var schedules = Invoke <ProcessSchedule>(cmdlet); schedule = schedules[0]; } using (var cmdlet = PowershellFactory.CreateCmdlet(runspace)) { cmdlet.AddCommand(UiPathStrings.RemoveUiPathProcessSchedule) .AddParameter(UiPathStrings.Id, schedule.Id); Invoke(cmdlet); } } }