public DownloadRemoteDesktopProtocolFileOptions(BatchAccountContext context, string poolId, string computeNodeId, PSComputeNode computeNode, string destinationPath,
            Stream stream, IEnumerable<BatchClientBehavior> additionalBehaviors = null) : base(context, poolId, computeNodeId, computeNode, additionalBehaviors)
        {
            if (string.IsNullOrWhiteSpace(destinationPath) && stream == null)
            {
                throw new ArgumentNullException(Resources.NoDownloadDestination);
            }

            this.DestinationPath = destinationPath;
            this.Stream = stream;
        }
        public RemoveComputeNodeParameters(BatchAccountContext context, string poolId, string[] computeNodeIds, PSComputeNode computeNode,
            IEnumerable<BatchClientBehavior> additionalBehaviors = null) : base(context, additionalBehaviors)
        {
            if ((string.IsNullOrWhiteSpace(poolId) || computeNodeIds == null) && computeNode == null)
            {
                throw new ArgumentNullException(Resources.NoComputeNode);
            }

            this.PoolId = poolId;
            this.ComputeNodeIds = computeNodeIds;
            this.ComputeNode = computeNode;
        }
 private void CopyRDPStream(Stream destinationStream, Microsoft.Azure.Batch.BatchClient client, string poolId, string computeNodeId,
                            PSComputeNode computeNode, IEnumerable <BatchClientBehavior> additionalBehaviors = null)
 {
     if (computeNode == null)
     {
         PoolOperations poolOperations = client.PoolOperations;
         poolOperations.GetRDPFile(poolId, computeNodeId, destinationStream, additionalBehaviors);
     }
     else
     {
         computeNode.omObject.GetRDPFile(destinationStream, additionalBehaviors);
     }
 }
Exemple #4
0
        /// <summary>
        /// Lists the compute nodes matching the specified filter options.
        /// </summary>
        /// <param name="options">The options to use when querying for compute nodes.</param>
        /// <returns>The compute nodes matching the specified filter options.</returns>
        public IEnumerable <PSComputeNode> ListComputeNodes(ListComputeNodeOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            string poolId = options.Pool == null ? options.PoolId : options.Pool.Id;

            // Get the single compute node matching the specified id
            if (!string.IsNullOrEmpty(options.ComputeNodeId))
            {
                WriteVerbose(string.Format(Resources.GetComputeNodeById, options.ComputeNodeId, poolId));
                PoolOperations   poolOperations = options.Context.BatchOMClient.PoolOperations;
                ODATADetailLevel getDetailLevel = new ODATADetailLevel(selectClause: options.Select);
                ComputeNode      computeNode    = poolOperations.GetComputeNode(poolId, options.ComputeNodeId, detailLevel: getDetailLevel, additionalBehaviors: options.AdditionalBehaviors);
                PSComputeNode    psComputeNode  = new PSComputeNode(computeNode);
                return(new PSComputeNode[] { psComputeNode });
            }
            // List compute nodes using the specified filter
            else
            {
                string           verboseLogString = null;
                ODATADetailLevel listDetailLevel  = new ODATADetailLevel(selectClause: options.Select);
                if (!string.IsNullOrEmpty(options.Filter))
                {
                    verboseLogString             = string.Format(Resources.GetComputeNodeByOData, poolId);
                    listDetailLevel.FilterClause = options.Filter;
                }
                else
                {
                    verboseLogString = string.Format(Resources.GetComputeNodeNoFilter, poolId);
                }
                WriteVerbose(verboseLogString);

                PoolOperations poolOperations = options.Context.BatchOMClient.PoolOperations;
                IPagedEnumerable <ComputeNode> computeNodes = poolOperations.ListComputeNodes(poolId, listDetailLevel, options.AdditionalBehaviors);
                return(PSPagedEnumerable <PSComputeNode, ComputeNode> .CreateWithMaxCount
                       (
                           computeNodes,
                           c => { return new PSComputeNode(c); },
                           options.MaxCount,
                           () => WriteMaxCount(options.MaxCount)
                       ));
            }
        }
        /// <summary>
        /// Lists the compute nodes matching the specified filter options.
        /// </summary>
        /// <param name="options">The options to use when querying for compute nodes.</param>
        /// <returns>The compute nodes matching the specified filter options.</returns>
        public IEnumerable<PSComputeNode> ListComputeNodes(ListComputeNodeOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            string poolId = options.Pool == null ? options.PoolId : options.Pool.Id;

            // Get the single compute node matching the specified id
            if (!string.IsNullOrEmpty(options.ComputeNodeId))
            {
                WriteVerbose(string.Format(Resources.GetComputeNodeById, options.ComputeNodeId, poolId));
                PoolOperations poolOperations = options.Context.BatchOMClient.PoolOperations;
                ODATADetailLevel getDetailLevel = new ODATADetailLevel(selectClause: options.Select);
                ComputeNode computeNode = poolOperations.GetComputeNode(poolId, options.ComputeNodeId, detailLevel: getDetailLevel, additionalBehaviors: options.AdditionalBehaviors);
                PSComputeNode psComputeNode = new PSComputeNode(computeNode);
                return new PSComputeNode[] { psComputeNode };
            }
            // List compute nodes using the specified filter
            else
            {
                string verboseLogString = null;
                ODATADetailLevel listDetailLevel = new ODATADetailLevel(selectClause: options.Select);
                if (!string.IsNullOrEmpty(options.Filter))
                {
                    verboseLogString = string.Format(Resources.GetComputeNodeByOData, poolId);
                    listDetailLevel.FilterClause = options.Filter;
                }
                else
                {
                    verboseLogString = string.Format(Resources.GetComputeNodeNoFilter, poolId);
                }
                WriteVerbose(verboseLogString);

                PoolOperations poolOperations = options.Context.BatchOMClient.PoolOperations;
                IPagedEnumerable<ComputeNode> computeNodes = poolOperations.ListComputeNodes(poolId, listDetailLevel, options.AdditionalBehaviors);
                Func<ComputeNode, PSComputeNode> mappingFunction = c => { return new PSComputeNode(c); };
                return PSPagedEnumerable<PSComputeNode, ComputeNode>.CreateWithMaxCount(
                    computeNodes, mappingFunction, options.MaxCount, () => WriteVerbose(string.Format(Resources.MaxCount, options.MaxCount)));
            }
        }
        /// <summary>
        /// Lists the compute nodes matching the specified filter options.
        /// </summary>
        /// <param name="options">The options to use when querying for compute nodes.</param>
        /// <returns>The compute nodes matching the specified filter options.</returns>
        public IEnumerable <PSComputeNode> ListComputeNodes(ListComputeNodeOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            string poolId = options.Pool == null ? options.PoolId : options.Pool.Id;

            // Get the single compute node matching the specified id
            if (!string.IsNullOrEmpty(options.ComputeNodeId))
            {
                WriteVerbose(string.Format(Resources.GBCN_GetById, options.ComputeNodeId, poolId));
                PoolOperations poolOperations = options.Context.BatchOMClient.PoolOperations;
                ComputeNode    computeNode    = poolOperations.GetComputeNode(poolId, options.ComputeNodeId, additionalBehaviors: options.AdditionalBehaviors);
                PSComputeNode  psComputeNode  = new PSComputeNode(computeNode);
                return(new PSComputeNode[] { psComputeNode });
            }
            // List compute nodes using the specified filter
            else
            {
                ODATADetailLevel odata            = null;
                string           verboseLogString = null;
                if (!string.IsNullOrEmpty(options.Filter))
                {
                    verboseLogString = string.Format(Resources.GBCN_GetByOData, poolId);
                    odata            = new ODATADetailLevel(filterClause: options.Filter);
                }
                else
                {
                    verboseLogString = string.Format(Resources.GBCN_NoFilter, poolId);
                }
                WriteVerbose(verboseLogString);

                PoolOperations poolOperations = options.Context.BatchOMClient.PoolOperations;
                IPagedEnumerable <ComputeNode>    computeNodes    = poolOperations.ListComputeNodes(poolId, odata, options.AdditionalBehaviors);
                Func <ComputeNode, PSComputeNode> mappingFunction = c => { return(new PSComputeNode(c)); };
                return(PSPagedEnumerable <PSComputeNode, ComputeNode> .CreateWithMaxCount(
                           computeNodes, mappingFunction, options.MaxCount, () => WriteVerbose(string.Format(Resources.MaxCount, options.MaxCount))));
            }
        }
        public ListNodeFileOptions(BatchAccountContext context, string jobId, string taskId, PSCloudTask task, string poolId, string computeNodeId, PSComputeNode computeNode,
            IEnumerable<BatchClientBehavior> additionalBehaviors = null) : base(context, additionalBehaviors)
        {
            if ((!string.IsNullOrWhiteSpace(jobId) && !string.IsNullOrWhiteSpace(taskId)) || task != null)
            {
                this.NodeFileType = PSNodeFileType.Task;
            }
            else if ((!string.IsNullOrWhiteSpace(poolId) && !string.IsNullOrWhiteSpace(computeNodeId)) || computeNode != null)
            {
                this.NodeFileType = PSNodeFileType.ComputeNode;
            }
            else
            {
                throw new ArgumentException(Resources.NoNodeFileParent);
            }

            this.JobId = jobId;
            this.TaskId = taskId;
            this.Task = task;
            this.PoolId = poolId;
            this.ComputeNodeId = computeNodeId;
            this.ComputeNode = computeNode;
        }
        public StartComputeNodeServiceLogUploadParameters(BatchAccountContext context,
                                                          string poolId,
                                                          string computeNodeId,
                                                          PSComputeNode computeNode,
                                                          string containerUrl,
                                                          DateTime startTime,
                                                          DateTime?endTime,
                                                          IEnumerable <BatchClientBehavior> additionalBehaviors = null)
            : base(context, poolId, computeNodeId, computeNode, additionalBehaviors)
        {
            if (string.IsNullOrWhiteSpace(containerUrl))
            {
                throw new ArgumentNullException(nameof(containerUrl), Properties.Resources.NoContainerUrl);
            }

            if (startTime <= DateTime.MinValue)
            {
                throw new ArgumentException(nameof(startTime), Properties.Resources.NoStartTime);
            }

            this.ContainerUrl = containerUrl;
            this.StartTime    = startTime;
            this.EndTime      = endTime;
        }
 private void CopyRDPStream(Stream destinationStream, Microsoft.Azure.Batch.BatchClient client, string poolId, string computeNodeId,
     PSComputeNode computeNode, IEnumerable<BatchClientBehavior> additionalBehaviors = null)
 {
     if (computeNode == null)
     {
         PoolOperations poolOperations = client.PoolOperations;
         poolOperations.GetRDPFile(poolId, computeNodeId, destinationStream, additionalBehaviors);
     }
     else
     {
         computeNode.omObject.GetRDPFile(destinationStream, additionalBehaviors);
     }
 }
        public ComputeNodeOperationParameters(BatchAccountContext context, string poolId, string computeNodeId, PSComputeNode computeNode,
                                              IEnumerable <BatchClientBehavior> additionalBehaviors = null) : base(context, additionalBehaviors)
        {
            if ((string.IsNullOrWhiteSpace(poolId) || string.IsNullOrWhiteSpace(computeNodeId)) && computeNode == null)
            {
                throw new ArgumentNullException(Resources.NoComputeNode);
            }

            this.PoolId        = poolId;
            this.ComputeNodeId = computeNodeId;
            this.ComputeNode   = computeNode;
        }
        public DownloadRemoteDesktopProtocolFileOptions(BatchAccountContext context, string poolId, string computeNodeId, PSComputeNode computeNode, string destinationPath,
                                                        Stream stream, IEnumerable <BatchClientBehavior> additionalBehaviors = null) : base(context, poolId, computeNodeId, computeNode, additionalBehaviors)
        {
            if (string.IsNullOrWhiteSpace(destinationPath) && stream == null)
            {
                throw new ArgumentNullException(Resources.NoDownloadDestination);
            }

            this.DestinationPath = destinationPath;
            this.Stream          = stream;
        }
        public ListNodeFileOptions(BatchAccountContext context, string jobId, string taskId, PSCloudTask task, string poolId, string computeNodeId, PSComputeNode computeNode,
                                   IEnumerable <BatchClientBehavior> additionalBehaviors = null) : base(context, additionalBehaviors)
        {
            if ((!string.IsNullOrWhiteSpace(jobId) && !string.IsNullOrWhiteSpace(taskId)) || task != null)
            {
                this.NodeFileType = PSNodeFileType.Task;
            }
            else if ((!string.IsNullOrWhiteSpace(poolId) && !string.IsNullOrWhiteSpace(computeNodeId)) || computeNode != null)
            {
                this.NodeFileType = PSNodeFileType.ComputeNode;
            }
            else
            {
                throw new ArgumentException(Resources.NoNodeFileParent);
            }

            this.JobId         = jobId;
            this.TaskId        = taskId;
            this.Task          = task;
            this.PoolId        = poolId;
            this.ComputeNodeId = computeNodeId;
            this.ComputeNode   = computeNode;
        }
 public DisableComputeNodeSchedulingParameters(BatchAccountContext context, string poolId, string computeNodeId,
     PSComputeNode computeNode, IEnumerable<BatchClientBehavior> additionalBehaviors = null)
     : base(context, poolId, computeNodeId, computeNode, additionalBehaviors)
 { }
Exemple #14
0
 public NewComputeNodeUserParameters(BatchAccountContext context, string poolId, string computeNodeId, PSComputeNode computeNode,
                                     IEnumerable <BatchClientBehavior> additionalBehaviors = null)
     : base(context, poolId, computeNodeId, computeNode, additionalBehaviors)
 {
 }