/// <summary> /// Creates a test job schedule for use in Scenario tests. /// </summary> public static void CreateTestJobSchedule(BatchController controller, BatchAccountContext context, string jobScheduleId, TimeSpan?recurrenceInterval) { RequestInterceptor interceptor = CreateHttpRecordingInterceptor(); BatchClientBehavior[] behaviors = new BatchClientBehavior[] { interceptor }; BatchClient client = new BatchClient(controller.BatchManagementClient, controller.ResourceManagementClient); PSJobSpecification jobSpecification = new PSJobSpecification(); jobSpecification.PoolInformation = new PSPoolInformation(); jobSpecification.PoolInformation.PoolId = SharedPool; PSSchedule schedule = new PSSchedule(); if (recurrenceInterval != null) { schedule = new PSSchedule(); schedule.RecurrenceInterval = recurrenceInterval; } NewJobScheduleParameters parameters = new NewJobScheduleParameters(context, jobScheduleId, behaviors) { JobSpecification = jobSpecification, Schedule = schedule }; client.CreateJobSchedule(parameters); }
public override void ExecuteCmdlet() { NewJobScheduleParameters parameters = new NewJobScheduleParameters(this.BatchContext, this.Id, this.AdditionalBehaviors) { DisplayName = this.DisplayName, Schedule = this.Schedule, JobSpecification = this.JobSpecification, Metadata = this.Metadata }; BatchClient.CreateJobSchedule(parameters); }
protected override void ProcessRecord() { NewJobScheduleParameters parameters = new NewJobScheduleParameters(this.BatchContext, this.Id, this.AdditionalBehaviors) { DisplayName = this.DisplayName, Schedule = this.Schedule, JobSpecification = this.JobSpecification, Metadata = this.Metadata }; BatchClient.CreateJobSchedule(parameters); }