internal static ProcessSchedule FromDto(ProcessScheduleDto dto) { return(new ProcessSchedule { Id = dto.Id, EnvironmentName = dto.EnvironmentName, Enabled = dto.Enabled, Name = dto.Name, PackageName = dto.PackageName, ReleaseKey = dto.ReleaseKey, ReleaseName = dto.ReleaseName, StartProcessCron = dto.StartProcessCron, StartProcessCronSummary = dto.StartProcessCronSummary, StopProcessCron = dto.StopProcessExpression, TimeZoneIana = dto.TimeZoneIana, TimeZoneId = dto.TimeZoneId, StopStrategy = dto.StopStrategy.ToString(), ExecutorRobots = dto.ExecutorRobots?.Select(re => Robot.FromDto(re)).ToList(), ExternalJobKey = dto.ExternalJobKey }); }
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)); }
/// <summary> /// Edits a process schedule. /// </summary> /// <remarks> /// Required permissions: Schedules.Edit. /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='id'> /// key: Id /// </param> /// <param name='processScheduleDto'> /// The entity to put /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <ProcessScheduleDto> PutByIdAsync(this IProcessSchedules operations, long id, ProcessScheduleDto processScheduleDto, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { using (var _result = await operations.PutByIdWithHttpMessagesAsync(id, processScheduleDto, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Edits a process schedule. /// </summary> /// <remarks> /// Required permissions: Schedules.Edit. /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='id'> /// key: Id /// </param> /// <param name='processScheduleDto'> /// The entity to put /// </param> public static ProcessScheduleDto PutById(this IProcessSchedules operations, long id, ProcessScheduleDto processScheduleDto) { return(operations.PutByIdAsync(id, processScheduleDto).GetAwaiter().GetResult()); }
/// <summary> /// Creates a new process schedule. /// </summary> /// <remarks> /// Required permissions: Schedules.Create. /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='processScheduleDto'> /// The entity to post /// </param> public static ProcessScheduleDto Post(this IProcessSchedules operations, ProcessScheduleDto processScheduleDto) { return(operations.PostAsync(processScheduleDto).GetAwaiter().GetResult()); }
/// <summary> /// Edits a process schedule. /// </summary> /// <remarks> /// Client Credentials Flow required permissions: Jobs or Jobs.Write. /// /// Required permissions: Schedules.Edit. /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='id'> /// key: Id /// </param> /// <param name='processScheduleDto'> /// The entity to put /// </param> /// <param name='xUIPATHOrganizationUnitId'> /// Folder/OrganizationUnit Id /// </param> public static ProcessScheduleDto PutById(this IProcessSchedules operations, long id, ProcessScheduleDto processScheduleDto, long?xUIPATHOrganizationUnitId = default(long?)) { return(operations.PutByIdAsync(id, processScheduleDto, xUIPATHOrganizationUnitId).GetAwaiter().GetResult()); }
/// <summary> /// Creates a new process schedule. /// </summary> /// <remarks> /// Client Credentials Flow required permissions: Jobs or Jobs.Write. /// /// Required permissions: Schedules.Create. /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='processScheduleDto'> /// The entity to post /// </param> /// <param name='xUIPATHOrganizationUnitId'> /// Folder/OrganizationUnit Id /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <ProcessScheduleDto> PostAsync(this IProcessSchedules operations, ProcessScheduleDto processScheduleDto, long?xUIPATHOrganizationUnitId = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { using (var _result = await operations.PostWithHttpMessagesAsync(processScheduleDto, xUIPATHOrganizationUnitId, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Edits a process schedule. /// </summary> /// <remarks> /// Client Credentials Flow required permissions: Jobs or Jobs.Write. /// /// Required permissions: Schedules.Edit. /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='key'> /// </param> /// <param name='body'> /// </param> /// <param name='xUIPATHOrganizationUnitId'> /// Folder/OrganizationUnit Id /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <ProcessScheduleDto> PutByIdAsync(this IProcessSchedules operations, long key, ProcessScheduleDto body = default(ProcessScheduleDto), long?xUIPATHOrganizationUnitId = default(long?), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.PutByIdWithHttpMessagesAsync(key, body, xUIPATHOrganizationUnitId, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Edits a process schedule. /// </summary> /// <remarks> /// Client Credentials Flow required permissions: Jobs or Jobs.Write. /// /// Required permissions: Schedules.Edit. /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='key'> /// </param> /// <param name='body'> /// </param> /// <param name='xUIPATHOrganizationUnitId'> /// Folder/OrganizationUnit Id /// </param> public static ProcessScheduleDto PutById(this IProcessSchedules operations, long key, ProcessScheduleDto body = default(ProcessScheduleDto), long?xUIPATHOrganizationUnitId = default(long?)) { return(operations.PutByIdAsync(key, body, xUIPATHOrganizationUnitId).GetAwaiter().GetResult()); }