public override void ExecuteCmdlet()
        {
            NewPoolParameters parameters = new NewPoolParameters(this.BatchContext, this.Id, this.AdditionalBehaviors)
            {
                VirtualMachineSize            = this.VirtualMachineSize,
                DisplayName                   = this.DisplayName,
                ResizeTimeout                 = this.ResizeTimeout,
                TargetDedicatedComputeNodes   = this.TargetDedicatedComputeNodes,
                TargetLowPriorityComputeNodes = this.TargetLowPriorityComputeNodes,
                AutoScaleEvaluationInterval   = this.AutoScaleEvaluationInterval,
                AutoScaleFormula              = this.AutoScaleFormula,
                MaxTasksPerComputeNode        = this.MaxTasksPerComputeNode,
                TaskSchedulingPolicy          = this.TaskSchedulingPolicy,
                Metadata = this.Metadata,
                InterComputeNodeCommunicationEnabled = this.InterComputeNodeCommunicationEnabled.IsPresent,
                StartTask                    = this.StartTask,
                CertificateReferences        = this.CertificateReferences,
                ApplicationPackageReferences = this.ApplicationPackageReferences,
                VirtualMachineConfiguration  = this.VirtualMachineConfiguration,
                CloudServiceConfiguration    = this.CloudServiceConfiguration,
                NetworkConfiguration         = this.NetworkConfiguration,
                UserAccounts                 = this.UserAccount,
                ApplicationLicenses          = this.ApplicationLicenses
            };

            if (ShouldProcess("AzureBatchPool"))
            {
                BatchClient.CreatePool(parameters);
            }
        }
Example #2
0
        /// <summary>
        /// Creates a test pool for use in Scenario tests.
        /// </summary>
        public static void CreateTestPool(BatchController controller, BatchAccountContext context, string poolId, int targetDedicated,
                                          CertificateReference certReference = null, StartTask startTask = null)
        {
            BatchClient client = new BatchClient(controller.BatchManagementClient, controller.ResourceManagementClient);

            PSCertificateReference[] certReferences = null;
            if (certReference != null)
            {
                certReferences = new PSCertificateReference[] { new PSCertificateReference(certReference) };
            }
            PSStartTask psStartTask = null;

            if (startTask != null)
            {
                psStartTask = new PSStartTask(startTask);
            }

            PSCloudServiceConfiguration paasConfiguration = new PSCloudServiceConfiguration("4", "*");

            NewPoolParameters parameters = new NewPoolParameters(context, poolId)
            {
                VirtualMachineSize        = "small",
                CloudServiceConfiguration = paasConfiguration,
                TargetDedicated           = targetDedicated,
                CertificateReferences     = certReferences,
                StartTask = psStartTask,
                InterComputeNodeCommunicationEnabled = true
            };

            client.CreatePool(parameters);
        }
        /// <summary>
        /// Creates a test pool for use in Scenario tests.
        /// </summary>
        public static void CreateTestPool(BatchController controller, BatchAccountContext context, string poolName)
        {
            YieldInjectionInterceptor interceptor = CreateHttpRecordingInterceptor();

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

            NewPoolParameters parameters = new NewPoolParameters(context, poolName, behaviors)
            {
                OSFamily        = "4",
                TargetOSVersion = "*",
                TargetDedicated = 1
            };

            client.CreatePool(parameters);
        }
Example #4
0
        /// <summary>
        /// Creates a test pool for use in Scenario tests.
        /// </summary>
        public static void CreateTestPool(BatchController controller, BatchAccountContext context, string poolId, int targetDedicated)
        {
            RequestInterceptor interceptor = CreateHttpRecordingInterceptor();

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

            NewPoolParameters parameters = new NewPoolParameters(context, poolId, behaviors)
            {
                VirtualMachineSize = "small",
                OSFamily           = "4",
                TargetOSVersion    = "*",
                TargetDedicated    = targetDedicated,
            };

            client.CreatePool(parameters);
        }
        public static void CreatePoolIfNotExists(
            BatchController controller,
            NewPoolParameters poolParameters)
        {
            BatchClient client = new BatchClient(controller.BatchManagementClient, controller.ResourceManagementClient);

            try
            {
                client.CreatePool(poolParameters);
            }
            catch (BatchException e)
            {
                if (e.RequestInformation.BatchError.Code != "PoolAlreadyExists")
                {
                    throw;
                }
            }
        }
Example #6
0
        public override void ExecuteCmdlet()
        {
            NewPoolParameters parameters = new NewPoolParameters(this.BatchContext, this.Name, this.AdditionalBehaviors)
            {
                VMSize                = this.VMSize,
                OSFamily              = this.OSFamily,
                TargetOSVersion       = this.TargetOSVersion,
                ResizeTimeout         = this.ResizeTimeout,
                TargetDedicated       = this.TargetDedicated,
                AutoScaleFormula      = this.AutoScaleFormula,
                MaxTasksPerVM         = this.MaxTasksPerVM,
                SchedulingPolicy      = this.SchedulingPolicy,
                Metadata              = this.Metadata,
                Communication         = this.CommunicationEnabled.IsPresent,
                StartTask             = this.StartTask,
                CertificateReferences = this.CertificateReferences
            };

            BatchClient.CreatePool(parameters);
        }
Example #7
0
        /// <summary>
        /// Creates a test pool for use in Scenario tests.
        /// </summary>
        public static void CreateTestPool(BatchController controller, BatchAccountContext context, string poolId, int targetDedicated, CertificateReference certReference = null)
        {
            BatchClient client = new BatchClient(controller.BatchManagementClient, controller.ResourceManagementClient);

            PSCertificateReference[] certReferences = null;
            if (certReference != null)
            {
                certReferences = new PSCertificateReference[] { new PSCertificateReference(certReference) };
            }

            NewPoolParameters parameters = new NewPoolParameters(context, poolId)
            {
                VirtualMachineSize    = "small",
                OSFamily              = "4",
                TargetOSVersion       = "*",
                TargetDedicated       = targetDedicated,
                CertificateReferences = certReferences,
            };

            client.CreatePool(parameters);
        }
        protected override void ProcessRecord()
        {
            NewPoolParameters parameters = new NewPoolParameters(this.BatchContext, this.Id, this.AdditionalBehaviors)
            {
                VirtualMachineSize     = this.VirtualMachineSize,
                OSFamily               = this.OSFamily,
                DisplayName            = this.DisplayName,
                TargetOSVersion        = this.TargetOSVersion,
                ResizeTimeout          = this.ResizeTimeout,
                TargetDedicated        = this.TargetDedicated,
                AutoScaleFormula       = this.AutoScaleFormula,
                MaxTasksPerComputeNode = this.MaxTasksPerComputeNode,
                TaskSchedulingPolicy   = this.TaskSchedulingPolicy,
                Metadata               = this.Metadata,
                InterComputeNodeCommunicationEnabled = this.InterComputeNodeCommunicationEnabled.IsPresent,
                StartTask             = this.StartTask,
                CertificateReferences = this.CertificateReferences
            };

            BatchClient.CreatePool(parameters);
        }
        public override void ExecuteCmdlet()
        {
            NewPoolParameters parameters = new NewPoolParameters(this.BatchContext, this.Id, this.AdditionalBehaviors)
            {
                VirtualMachineSize          = this.VirtualMachineSize,
                DisplayName                 = this.DisplayName,
                ResizeTimeout               = this.ResizeTimeout,
                TargetDedicated             = this.TargetDedicated,
                AutoScaleEvaluationInterval = this.AutoScaleEvaluationInterval,
                AutoScaleFormula            = this.AutoScaleFormula,
                MaxTasksPerComputeNode      = this.MaxTasksPerComputeNode,
                TaskSchedulingPolicy        = this.TaskSchedulingPolicy,
                Metadata = this.Metadata,
                InterComputeNodeCommunicationEnabled = this.InterComputeNodeCommunicationEnabled.IsPresent,
                StartTask                   = this.StartTask,
                CertificateReferences       = this.CertificateReferences,
                VirtualMachineConfiguration = this.VirtualMachineConfiguration,
                CloudServiceConfiguration   = this.CloudServiceConfiguration
            };

            BatchClient.CreatePool(parameters);
        }
        /// <summary>
        /// Creates a test pool for use in Scenario tests.
        /// </summary>
        public static void CreateTestPool(
            BatchController controller,
            BatchAccountContext context,
            string poolId,
            int?targetDedicated,
            int?targetLowPriority,
            CertificateReference certReference = null,
            StartTask startTask = null)
        {
            PSCertificateReference[] certReferences = null;
            if (certReference != null)
            {
                certReferences = new PSCertificateReference[] { new PSCertificateReference(certReference) };
            }
            PSStartTask psStartTask = null;

            if (startTask != null)
            {
                psStartTask = new PSStartTask(startTask);
            }

            PSCloudServiceConfiguration paasConfiguration = new PSCloudServiceConfiguration("4", "*");

            NewPoolParameters parameters = new NewPoolParameters(context, poolId)
            {
                VirtualMachineSize            = "small",
                CloudServiceConfiguration     = paasConfiguration,
                TargetDedicatedComputeNodes   = targetDedicated,
                TargetLowPriorityComputeNodes = targetLowPriority,
                CertificateReferences         = certReferences,
                StartTask = psStartTask,
                InterComputeNodeCommunicationEnabled = true
            };

            CreatePoolIfNotExists(controller, parameters);
        }