/// <summary> /// Initializes a new instance of the <see cref="OneTimeSchedule"/> class. /// </summary> /// <param name="schedule"> /// The schedule. /// </param> public OneTimeSchedule(Azure.Management.Automation.Models.Schedule schedule) { Requires.Argument("schedule", schedule).NotNull(); this.Id = new Guid(schedule.Id); this.AccountId = new Guid(schedule.AccountId); this.Name = schedule.Name; this.Description = schedule.Description; this.StartTime = DateTime.SpecifyKind(schedule.StartTime, DateTimeKind.Utc).ToLocalTime(); this.ExpiryTime = DateTime.SpecifyKind(schedule.ExpiryTime, DateTimeKind.Utc).ToLocalTime(); this.CreationTime = DateTime.SpecifyKind(schedule.CreationTime, DateTimeKind.Utc).ToLocalTime(); this.LastModifiedTime = DateTime.SpecifyKind(schedule.LastModifiedTime, DateTimeKind.Utc).ToLocalTime(); this.IsEnabled = schedule.IsEnabled; this.NextRun = schedule.NextRun.HasValue ? DateTime.SpecifyKind(schedule.NextRun.Value, DateTimeKind.Utc).ToLocalTime() : this.NextRun; }
/// <summary> /// Initializes a new instance of the <see cref="Schedule"/> class. /// </summary> /// <param name="schedule"> /// The schedule. /// </param> public Schedule(string automationAccountName, Azure.Management.Automation.Models.Schedule schedule) { Requires.Argument("schedule", schedule).NotNull(); this.AutomationAccountName = automationAccountName; this.Name = schedule.Name; this.Description = schedule.Properties.Description; this.StartTime = schedule.Properties.StartTime.ToLocalTime(); this.ExpiryTime = schedule.Properties.ExpiryTime.ToLocalTime(); this.CreationTime = schedule.Properties.CreationTime.ToLocalTime(); this.LastModifiedTime = schedule.Properties.LastModifiedTime.ToLocalTime(); this.IsEnabled = schedule.Properties.IsEnabled; this.NextRun = schedule.Properties.NextRun.HasValue ? schedule.Properties.NextRun.Value.ToLocalTime() : this.NextRun; this.Interval = schedule.Properties.Interval.HasValue ? schedule.Properties.Interval.Value : this.Interval; this.Frequency = (ScheduleFrequency)Enum.Parse(typeof(ScheduleFrequency), schedule.Properties.Frequency, true); }
/// <summary> /// Initializes a new instance of the <see cref="Schedule"/> class. /// </summary> /// <param name="resourceGroupName"> /// The resource group name. /// </param> /// <param name="automationAccountName"> /// The automation account name. /// </param> /// <param name="schedule"> /// The schedule. /// </param> public Schedule(string resourceGroupName, string automationAccountName, Azure.Management.Automation.Models.Schedule schedule) { Requires.Argument("schedule", schedule).NotNull(); this.ResourceGroupName = resourceGroupName; this.AutomationAccountName = automationAccountName; this.Name = schedule.Name; this.Description = schedule.Properties.Description; this.StartTime = AdjustOffset(schedule.Properties.StartTime, schedule.Properties.StartTimeOffsetMinutes); this.ExpiryTime = AdjustOffset(schedule.Properties.ExpiryTime, schedule.Properties.ExpiryTimeOffsetMinutes); this.CreationTime = schedule.Properties.CreationTime.ToLocalTime(); this.LastModifiedTime = schedule.Properties.LastModifiedTime.ToLocalTime(); this.IsEnabled = schedule.Properties.IsEnabled; this.NextRun = AdjustOffset(schedule.Properties.NextRun, schedule.Properties.NextRunOffsetMinutes); this.Interval = schedule.Properties.Interval ?? this.Interval; this.Frequency = (ScheduleFrequency)Enum.Parse(typeof(ScheduleFrequency), schedule.Properties.Frequency, true); this.WeeklyScheduleOptions = this.CreateWeeklyScheduleOptions(schedule); this.MonthlyScheduleOptions = this.CreateMonthlyScheduleOptions(schedule); this.TimeZone = schedule.Properties.TimeZone; }
/// <summary> /// Initializes a new instance of the <see cref="DailySchedule"/> class. /// </summary> /// <param name="schedule"> /// The schedule. /// </param> public DailySchedule(Azure.Management.Automation.Models.Schedule schedule) { Requires.Argument("schedule", schedule).NotNull(); if (!schedule.DayInterval.HasValue) { throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, Resources.InvalidDailyScheduleModel, schedule.Name)); } this.Id = new Guid(schedule.Id); this.AccountId = new Guid(schedule.AccountId); this.Name = schedule.Name; this.Description = schedule.Description; this.StartTime = DateTime.SpecifyKind(schedule.StartTime, DateTimeKind.Utc).ToLocalTime(); this.ExpiryTime = DateTime.SpecifyKind(schedule.ExpiryTime, DateTimeKind.Utc).ToLocalTime(); this.CreationTime = DateTime.SpecifyKind(schedule.CreationTime, DateTimeKind.Utc).ToLocalTime(); this.LastModifiedTime = DateTime.SpecifyKind(schedule.LastModifiedTime, DateTimeKind.Utc).ToLocalTime(); this.IsEnabled = schedule.IsEnabled; this.NextRun = schedule.NextRun.HasValue ? DateTime.SpecifyKind(schedule.NextRun.Value, DateTimeKind.Utc).ToLocalTime() : this.NextRun; this.DayInterval = schedule.DayInterval.Value; }