Inheritance: Microsoft.Azure.Commands.Batch.Models.ComputeNodeOperationParameters
コード例 #1
0
        /// <summary>
        /// Creates a new compute node user.
        /// </summary>
        /// <param name="options">The options to use when creating the compute node user.</param>
        public void CreateComputeNodeUser(NewComputeNodeUserParameters options)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            ComputeNodeUser user = null;
            string computeNodeId = null;
            if (options.ComputeNode != null)
            {
                user = options.ComputeNode.omObject.CreateComputeNodeUser();
                computeNodeId = options.ComputeNode.Id;
            }
            else
            {
                PoolOperations poolOperations = options.Context.BatchOMClient.PoolOperations;
                user = poolOperations.CreateComputeNodeUser(options.PoolId, options.ComputeNodeId);
                computeNodeId = options.ComputeNodeId;
            }

            user.Name = options.ComputeNodeUserName;
            user.Password = options.Password;
            user.ExpiryTime = options.ExpiryTime;
            user.IsAdmin = options.IsAdmin;

            WriteVerbose(string.Format(Resources.CreatingComputeNodeUser, user.Name, computeNodeId));

            user.Commit(ComputeNodeUserCommitSemantics.AddUser, options.AdditionalBehaviors);
        }
コード例 #2
0
        /// <summary>
        /// Creates a new compute node user.
        /// </summary>
        /// <param name="options">The options to use when creating the compute node user.</param>
        public void CreateComputeNodeUser(NewComputeNodeUserParameters options)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            ComputeNodeUser user          = null;
            string          computeNodeId = null;

            if (options.ComputeNode != null)
            {
                user          = options.ComputeNode.omObject.CreateComputeNodeUser();
                computeNodeId = options.ComputeNode.Id;
            }
            else
            {
                PoolOperations poolOperations = options.Context.BatchOMClient.PoolOperations;
                user          = poolOperations.CreateComputeNodeUser(options.PoolId, options.ComputeNodeId);
                computeNodeId = options.ComputeNodeId;
            }

            user.Name       = options.ComputeNodeUserName;
            user.Password   = options.Password;
            user.ExpiryTime = options.ExpiryTime;
            user.IsAdmin    = options.IsAdmin;

            WriteVerbose(string.Format(Resources.CreatingComputeNodeUser, user.Name, computeNodeId));

            user.Commit(ComputeNodeUserCommitSemantics.AddUser, options.AdditionalBehaviors);
        }
コード例 #3
0
        public override void ExecuteCmdlet()
        {
            NewComputeNodeUserParameters parameters = new NewComputeNodeUserParameters(this.BatchContext, this.PoolId, this.ComputeNodeId,
                this.ComputeNode, this.AdditionalBehaviors)
            {
                ComputeNodeUserName = this.Name,
                Password = this.Password,
                ExpiryTime = this.ExpiryTime,
                IsAdmin = this.IsAdmin.IsPresent
            };

            BatchClient.CreateComputeNodeUser(parameters);
        }
コード例 #4
0
        /// <summary>
        /// Creates a test user for use in Scenario tests.
        /// </summary>
        public static void CreateComputeNodeUser(BatchController controller, BatchAccountContext context, string poolId, string computeNodeId, string computeNodeUserName)
        {
            RequestInterceptor interceptor = CreateHttpRecordingInterceptor();
            BatchClientBehavior[] behaviors = new BatchClientBehavior[] { interceptor };
            BatchClient client = new BatchClient(controller.BatchManagementClient, controller.ResourceManagementClient);

            NewComputeNodeUserParameters parameters = new NewComputeNodeUserParameters(context, poolId, computeNodeId, null, behaviors)
            {
                ComputeNodeUserName = computeNodeUserName,
                Password = "******",
            };

            client.CreateComputeNodeUser(parameters);
        }
コード例 #5
0
        /// <summary>
        /// Creates a compute node user for use in Scenario tests.
        /// </summary>
        public static void CreateComputeNodeUser(BatchController controller, BatchAccountContext context, string poolId, string computeNodeId, string computeNodeUserName)
        {
            BatchClient client = new BatchClient(controller.BatchManagementClient, controller.ResourceManagementClient);

            NewComputeNodeUserParameters parameters = new NewComputeNodeUserParameters(context, poolId, computeNodeId, null)
            {
                ComputeNodeUserName = computeNodeUserName,
                Password = "******",
            };

            client.CreateComputeNodeUser(parameters);
        }