protected override void ExecuteCmdletImpl()
        {
            if (Tasks != null)
            {
                NewBulkTaskParameters parameters = new NewBulkTaskParameters(this.BatchContext, this.JobId, this.Job, this.Tasks, this.AdditionalBehaviors);
                BatchClient.AddTaskCollection(parameters);
            }
            else
            {
                NewTaskParameters parameters = new NewTaskParameters(this.BatchContext, this.JobId, this.Job,
                                                                     this.Id, this.AdditionalBehaviors)
                {
                    DisplayName                 = this.DisplayName,
                    CommandLine                 = this.CommandLine,
                    ResourceFiles               = this.ResourceFiles,
                    EnvironmentSettings         = this.EnvironmentSettings,
                    AuthenticationTokenSettings = this.AuthenticationTokenSettings,
                    UserIdentity                = this.UserIdentity,
                    AffinityInformation         = this.AffinityInformation,
                    Constraints                 = this.Constraints,
                    MultiInstanceSettings       = this.MultiInstanceSettings,
                    DependsOn = this.DependsOn,
                    ApplicationPackageReferences = this.ApplicationPackageReferences,
                    ExitConditions    = this.ExitConditions,
                    OutputFiles       = this.OutputFile,
                    ContainerSettings = this.ContainerSettings
                };

                BatchClient.CreateTask(parameters);
            }
        }
        public override void ExecuteCmdlet()
        {
            if (Tasks != null)
            {
                NewBulkTaskParameters parameters = new NewBulkTaskParameters(this.BatchContext, this.JobId, this.Job, this.Tasks, this.AdditionalBehaviors);
                BatchClient.AddTaskCollection(parameters);
            }
            else
            {
                NewTaskParameters parameters = new NewTaskParameters(this.BatchContext, this.JobId, this.Job,
                                                                     this.Id, this.AdditionalBehaviors)
                {
                    DisplayName                  = this.DisplayName,
                    CommandLine                  = this.CommandLine,
                    ResourceFiles                = this.ResourceFiles,
                    EnvironmentSettings          = this.EnvironmentSettings,
                    RunElevated                  = this.RunElevated.IsPresent,
                    AffinityInformation          = this.AffinityInformation,
                    Constraints                  = this.Constraints,
                    MultiInstanceSettings        = this.MultiInstanceSettings,
                    DependsOn                    = this.DependsOn,
                    ApplicationPackageReferences = this.ApplicationPackageReferences,
                    ExitConditions               = this.ExitConditions,
                };

                BatchClient.CreateTask(parameters);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Creates a test task for use in Scenario tests.
        /// </summary>
        public static void CreateTestTask(BatchController controller, BatchAccountContext context, string jobId, string taskId, string cmdLine = "cmd /c dir /s")
        {
            BatchClient client = new BatchClient(controller.BatchManagementClient, controller.ResourceManagementClient);

            NewTaskParameters parameters = new NewTaskParameters(context, jobId, null, taskId)
            {
                CommandLine = cmdLine,
                RunElevated = true
            };

            client.CreateTask(parameters);
        }
        /// <summary>
        /// Creates a test task for use in Scenario tests.
        /// </summary>
        public static void CreateTestTask(BatchController controller, BatchAccountContext context, string workItemName, string jobName, string taskName, string cmdLine = "cmd /c dir /s")
        {
            YieldInjectionInterceptor interceptor = CreateHttpRecordingInterceptor();

            BatchClientBehavior[] behaviors = new BatchClientBehavior[] { interceptor };
            BatchClient           client    = new BatchClient(controller.BatchManagementClient, controller.ResourceManagementClient);

            NewTaskParameters parameters = new NewTaskParameters(context, workItemName, jobName, null, taskName, behaviors)
            {
                CommandLine = cmdLine,
                RunElevated = true
            };

            client.CreateTask(parameters);
        }
        public override void ExecuteCmdlet()
        {
            NewTaskParameters parameters = new NewTaskParameters(this.BatchContext, this.WorkItemName, this.JobName, this.Job,
                                                                 this.Name, this.AdditionalBehaviors)
            {
                CommandLine         = this.CommandLine,
                ResourceFiles       = this.ResourceFiles,
                EnvironmentSettings = this.EnvironmentSettings,
                RunElevated         = this.RunElevated.IsPresent,
                AffinityInformation = this.AffinityInformation,
                TaskConstraints     = this.TaskConstraints
            };

            BatchClient.CreateTask(parameters);
        }
        protected override void ProcessRecord()
        {
            NewTaskParameters parameters = new NewTaskParameters(this.BatchContext, this.JobId, this.Job,
                                                                 this.Id, this.AdditionalBehaviors)
            {
                DisplayName         = this.DisplayName,
                CommandLine         = this.CommandLine,
                ResourceFiles       = this.ResourceFiles,
                EnvironmentSettings = this.EnvironmentSettings,
                RunElevated         = this.RunElevated.IsPresent,
                AffinityInformation = this.AffinityInformation,
                Constraints         = this.Constraints
            };

            BatchClient.CreateTask(parameters);
        }
Beispiel #7
0
        public override void ExecuteCmdlet()
        {
            NewTaskParameters parameters = new NewTaskParameters(this.BatchContext, this.JobId, this.Job,
                                                                 this.Id, this.AdditionalBehaviors)
            {
                DisplayName           = this.DisplayName,
                CommandLine           = this.CommandLine,
                ResourceFiles         = this.ResourceFiles,
                EnvironmentSettings   = this.EnvironmentSettings,
                RunElevated           = this.RunElevated.IsPresent,
                AffinityInformation   = this.AffinityInformation,
                Constraints           = this.Constraints,
                MultiInstanceSettings = this.MultiInstanceSettings
            };

            BatchClient.CreateTask(parameters);
        }
        /// <summary>
        /// Creates a test task for use in Scenario tests.
        /// </summary>
        public static void CreateTestTask(BatchController controller, BatchAccountContext context, string jobId, string taskId, string cmdLine = "cmd /c dir /s", int numInstances = 0)
        {
            BatchClient client = new BatchClient(controller.BatchManagementClient, controller.ResourceManagementClient);

            PSMultiInstanceSettings multiInstanceSettings = null;

            if (numInstances > 1)
            {
                multiInstanceSettings = new PSMultiInstanceSettings("cmd /c echo coordinating", numInstances);
            }

            NewTaskParameters parameters = new NewTaskParameters(context, jobId, null, taskId)
            {
                CommandLine           = cmdLine,
                MultiInstanceSettings = multiInstanceSettings,
                UserIdentity          = new PSUserIdentity(new PSAutoUserSpecification(AutoUserScope.Task, numInstances <= 1 ? ElevationLevel.Admin : ElevationLevel.NonAdmin))
            };

            client.CreateTask(parameters);
        }
Beispiel #9
0
        /// <summary>
        /// Creates a test task for use in Scenario tests.
        /// </summary>
        public static void CreateTestTask(BatchController controller, BatchAccountContext context, string jobId, string taskId, string cmdLine = "cmd /c dir /s", int numInstances = 0)
        {
            BatchClient client = new BatchClient(controller.BatchManagementClient, controller.ResourceManagementClient);

            PSMultiInstanceSettings multiInstanceSettings = null;

            if (numInstances > 1)
            {
                multiInstanceSettings = new PSMultiInstanceSettings(numInstances);
                multiInstanceSettings.CoordinationCommandLine = "cmd /c echo coordinating";
            }

            NewTaskParameters parameters = new NewTaskParameters(context, jobId, null, taskId)
            {
                CommandLine           = cmdLine,
                MultiInstanceSettings = multiInstanceSettings,
                RunElevated           = numInstances <= 1
            };

            client.CreateTask(parameters);
        }