public ListPoolNodeCountsOptions(BatchAccountContext context, string poolId, PSCloudPool pool, int maxCount, IEnumerable <BatchClientBehavior> additionalBehaviors = null)
     : base(context, additionalBehaviors)
 {
     this.MaxCount = maxCount;
     this.PoolId   = poolId;
     this.Pool     = pool;
 }
        public ChangeOSVersionParameters(BatchAccountContext context, string poolId, PSCloudPool pool, string targetOSVersion,
            IEnumerable<BatchClientBehavior> additionalBehaviors = null) : base(context, poolId, pool, additionalBehaviors)
        {
            if (string.IsNullOrWhiteSpace(targetOSVersion))
            {
                throw new ArgumentNullException("targetOSVersion");
            }

            this.TargetOSVersion = targetOSVersion;
        }
        public ChangeOSVersionParameters(BatchAccountContext context, string poolId, PSCloudPool pool, string targetOSVersion,
                                         IEnumerable <BatchClientBehavior> additionalBehaviors = null) : base(context, poolId, pool, additionalBehaviors)
        {
            if (string.IsNullOrWhiteSpace(targetOSVersion))
            {
                throw new ArgumentNullException("targetOSVersion");
            }

            this.TargetOSVersion = targetOSVersion;
        }
Пример #4
0
        public AutoScaleParameters(BatchAccountContext context, string poolId, PSCloudPool pool, string autoScaleFormula,
                                   IEnumerable <BatchClientBehavior> additionalBehaviors = null) : base(context, poolId, pool, additionalBehaviors)
        {
            if (string.IsNullOrWhiteSpace(autoScaleFormula))
            {
                throw new ArgumentNullException("autoScaleFormula");
            }

            this.AutoScaleFormula = autoScaleFormula;
        }
        public AutoScaleParameters(BatchAccountContext context, string poolId, PSCloudPool pool, string autoScaleFormula,
            IEnumerable<BatchClientBehavior> additionalBehaviors = null) : base(context, poolId, pool, additionalBehaviors)
        {
            if (string.IsNullOrWhiteSpace(autoScaleFormula))
            {
                throw new ArgumentNullException("autoScaleFormula");
            }

            this.AutoScaleFormula = autoScaleFormula;
        }
        public PoolOperationParameters(BatchAccountContext context, string poolName, PSCloudPool pool,
                                       IEnumerable <BatchClientBehavior> additionalBehaviors = null) : base(context, additionalBehaviors)
        {
            if (string.IsNullOrWhiteSpace(poolName) && pool == null)
            {
                throw new ArgumentNullException(Resources.NoPool);
            }

            this.PoolName = poolName;
            this.Pool     = pool;
        }
        public PoolOperationParameters(BatchAccountContext context, string poolName, PSCloudPool pool,
            IEnumerable<BatchClientBehavior> additionalBehaviors = null) : base(context, additionalBehaviors)
        {
            if (string.IsNullOrWhiteSpace(poolName) && pool == null)
            {
                throw new ArgumentNullException(Resources.NoPool);
            }

            this.PoolName = poolName;
            this.Pool = pool;
        }
        /// <summary>
        /// Commits changes to a PSCloudPool object to the Batch Service.
        /// </summary>
        /// <param name="context">The account to use.</param>
        /// <param name="pool">The PSCloudPool object representing the pool to update.</param>
        /// <param name="additionBehaviors">Additional client behaviors to perform.</param>
        public void UpdatePool(BatchAccountContext context, PSCloudPool pool, IEnumerable <BatchClientBehavior> additionBehaviors = null)
        {
            if (pool == null)
            {
                throw new ArgumentNullException("pool");
            }

            WriteVerbose(string.Format(Resources.UpdatingPool, pool.Id));

            Utils.Utils.BoundPoolSyncCollections(pool);
            pool.omObject.Commit(additionBehaviors);
        }
        /// <summary>
        /// Lists the pools matching the specified filter options
        /// </summary>
        /// <param name="options">The options to use when querying for pools</param>
        /// <returns>The pools matching the specified filter options</returns>
        public IEnumerable<PSCloudPool> ListPools(ListPoolOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            // Get the single pool matching the specified name
            if (!string.IsNullOrWhiteSpace(options.PoolName))
            {
                WriteVerbose(string.Format(Resources.GBP_GetByName, options.PoolName));
                using (IPoolManager poolManager = options.Context.BatchOMClient.OpenPoolManager())
                {
                    ICloudPool pool = poolManager.GetPool(options.PoolName, additionalBehaviors: options.AdditionalBehaviors);
                    PSCloudPool psPool = new PSCloudPool(pool);
                    return new PSCloudPool[] { psPool };
                }
            }
            // List pools using the specified filter
            else
            {
                ODATADetailLevel odata = null;
                string verboseLogString = null;
                if (!string.IsNullOrEmpty(options.Filter))
                {
                    verboseLogString = Resources.GBP_GetByOData;
                    odata = new ODATADetailLevel(filterClause: options.Filter);
                }
                else
                {
                    verboseLogString = Resources.GBP_NoFilter;
                }
                WriteVerbose(verboseLogString);

                using (IPoolManager poolManager = options.Context.BatchOMClient.OpenPoolManager())
                {
                    IEnumerableAsyncExtended<ICloudPool> pools = poolManager.ListPools(odata, options.AdditionalBehaviors);
                    Func<ICloudPool, PSCloudPool> mappingFunction = p => { return new PSCloudPool(p); };
                    return PSAsyncEnumerable<PSCloudPool, ICloudPool>.CreateWithMaxCount(
                        pools, mappingFunction, options.MaxCount, () => WriteVerbose(string.Format(Resources.MaxCount, options.MaxCount)));            
                }
            }
        }
Пример #10
0
        /// <summary>
        /// Lists the pools matching the specified filter options
        /// </summary>
        /// <param name="options">The options to use when querying for pools</param>
        /// <returns>The pools matching the specified filter options</returns>
        public IEnumerable <PSCloudPool> ListPools(ListPoolOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            // Get the single pool matching the specified name
            if (!string.IsNullOrWhiteSpace(options.PoolName))
            {
                WriteVerbose(string.Format(Resources.GBP_GetByName, options.PoolName));
                using (IPoolManager poolManager = options.Context.BatchOMClient.OpenPoolManager())
                {
                    ICloudPool  pool   = poolManager.GetPool(options.PoolName, additionalBehaviors: options.AdditionalBehaviors);
                    PSCloudPool psPool = new PSCloudPool(pool);
                    return(new PSCloudPool[] { psPool });
                }
            }
            // List pools using the specified filter
            else
            {
                ODATADetailLevel odata            = null;
                string           verboseLogString = null;
                if (!string.IsNullOrEmpty(options.Filter))
                {
                    verboseLogString = Resources.GBP_GetByOData;
                    odata            = new ODATADetailLevel(filterClause: options.Filter);
                }
                else
                {
                    verboseLogString = Resources.GBP_NoFilter;
                }
                WriteVerbose(verboseLogString);

                using (IPoolManager poolManager = options.Context.BatchOMClient.OpenPoolManager())
                {
                    IEnumerableAsyncExtended <ICloudPool> pools           = poolManager.ListPools(odata, options.AdditionalBehaviors);
                    Func <ICloudPool, PSCloudPool>        mappingFunction = p => { return(new PSCloudPool(p)); };
                    return(PSAsyncEnumerable <PSCloudPool, ICloudPool> .CreateWithMaxCount(
                               pools, mappingFunction, options.MaxCount, () => WriteVerbose(string.Format(Resources.MaxCount, options.MaxCount))));
                }
            }
        }
Пример #11
0
        /// <summary>
        /// Lists the pools matching the specified filter options.
        /// </summary>
        /// <param name="options">The options to use when querying for pools.</param>
        /// <returns>The pools matching the specified filter options.</returns>
        public IEnumerable <PSCloudPool> ListPools(ListPoolOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            // Get the single pool matching the specified id
            if (!string.IsNullOrWhiteSpace(options.PoolId))
            {
                WriteVerbose(string.Format(Resources.GetPoolById, options.PoolId));
                PoolOperations   poolOperations = options.Context.BatchOMClient.PoolOperations;
                ODATADetailLevel getDetailLevel = new ODATADetailLevel(selectClause: options.Select, expandClause: options.Expand);
                CloudPool        pool           = poolOperations.GetPool(options.PoolId, detailLevel: getDetailLevel, additionalBehaviors: options.AdditionalBehaviors);
                PSCloudPool      psPool         = new PSCloudPool(pool);
                return(new PSCloudPool[] { psPool });
            }
            // List pools using the specified filter
            else
            {
                string           verboseLogString = null;
                ODATADetailLevel listDetailLevel  = new ODATADetailLevel(selectClause: options.Select, expandClause: options.Expand);
                if (!string.IsNullOrEmpty(options.Filter))
                {
                    verboseLogString             = Resources.GetPoolByOData;
                    listDetailLevel.FilterClause = options.Filter;
                }
                else
                {
                    verboseLogString = Resources.GetPoolNoFilter;
                }
                WriteVerbose(verboseLogString);

                PoolOperations poolOperations                 = options.Context.BatchOMClient.PoolOperations;
                IPagedEnumerable <CloudPool>  pools           = poolOperations.ListPools(listDetailLevel, options.AdditionalBehaviors);
                Func <CloudPool, PSCloudPool> mappingFunction = p => { return(new PSCloudPool(p)); };
                return(PSPagedEnumerable <PSCloudPool, CloudPool> .CreateWithMaxCount(
                           pools, mappingFunction, options.MaxCount, () => WriteVerbose(string.Format(Resources.MaxCount, options.MaxCount))));
            }
        }
Пример #12
0
        /// <summary>
        /// Lists the pools matching the specified filter options.
        /// </summary>
        /// <param name="options">The options to use when querying for pools.</param>
        /// <returns>The pools matching the specified filter options.</returns>
        public IEnumerable<PSCloudPool> ListPools(ListPoolOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            // Get the single pool matching the specified id
            if (!string.IsNullOrWhiteSpace(options.PoolId))
            {
                WriteVerbose(string.Format(Resources.GetPoolById, options.PoolId));
                PoolOperations poolOperations = options.Context.BatchOMClient.PoolOperations;
                ODATADetailLevel getDetailLevel = new ODATADetailLevel(selectClause: options.Select, expandClause: options.Expand);
                CloudPool pool = poolOperations.GetPool(options.PoolId, detailLevel: getDetailLevel, additionalBehaviors: options.AdditionalBehaviors);
                PSCloudPool psPool = new PSCloudPool(pool);
                return new PSCloudPool[] { psPool };
            }
            // List pools using the specified filter
            else
            {
                string verboseLogString = null;
                ODATADetailLevel listDetailLevel = new ODATADetailLevel(selectClause: options.Select, expandClause: options.Expand);
                if (!string.IsNullOrEmpty(options.Filter))
                {
                    verboseLogString = Resources.GetPoolByOData;
                    listDetailLevel.FilterClause = options.Filter;
                }
                else
                {
                    verboseLogString = Resources.GetPoolNoFilter;
                }
                WriteVerbose(verboseLogString);

                PoolOperations poolOperations = options.Context.BatchOMClient.PoolOperations;
                IPagedEnumerable<CloudPool> pools = poolOperations.ListPools(listDetailLevel, options.AdditionalBehaviors);
                Func<CloudPool, PSCloudPool> mappingFunction = p => { return new PSCloudPool(p); };
                return PSPagedEnumerable<PSCloudPool, CloudPool>.CreateWithMaxCount(
                    pools, mappingFunction, options.MaxCount, () => WriteVerbose(string.Format(Resources.MaxCount, options.MaxCount)));
            }
        }
Пример #13
0
        /// <summary>
        /// Commits changes to a PSCloudPool object to the Batch Service.
        /// </summary>
        /// <param name="context">The account to use.</param>
        /// <param name="pool">The PSCloudPool object representing the pool to update.</param>
        /// <param name="additionBehaviors">Additional client behaviors to perform.</param>
        public void UpdatePool(BatchAccountContext context, PSCloudPool pool, IEnumerable<BatchClientBehavior> additionBehaviors = null)
        {
            if (pool == null)
            {
                throw new ArgumentNullException("pool");
            }

            WriteVerbose(string.Format(Resources.UpdatingPool, pool.Id));

            Utils.Utils.BoundPoolSyncCollections(pool);
            pool.omObject.Commit(additionBehaviors);
        }
 public PoolResizeParameters(BatchAccountContext context, string poolId, PSCloudPool pool, IEnumerable<BatchClientBehavior> additionalBehaviors = null)
     : base(context, poolId, pool, additionalBehaviors)
 { }
Пример #15
0
 public ListVMOptions(BatchAccountContext context, string poolName, PSCloudPool pool, IEnumerable<BatchClientBehavior> additionalBehaviors = null)
     : base(context, poolName, pool, additionalBehaviors)
 { }
Пример #16
0
 public ListVMOptions(BatchAccountContext context, string poolName, PSCloudPool pool, IEnumerable <BatchClientBehavior> additionalBehaviors = null)
     : base(context, poolName, pool, additionalBehaviors)
 {
 }
 public ListComputeNodeExtensionParameters(BatchAccountContext context, string poolId, PSCloudPool pool, string computeNodeId, IEnumerable <BatchClientBehavior> additionalBehaviors = null)
     : base(context, poolId, pool, additionalBehaviors)
 {
     ComputeNodeId = computeNodeId;
 }
Пример #18
0
 public PoolResizeParameters(BatchAccountContext context, string poolId, PSCloudPool pool, IEnumerable <BatchClientBehavior> additionalBehaviors = null)
     : base(context, poolId, pool, additionalBehaviors)
 {
 }
 public ListComputeNodeExtensionParameters(BatchAccountContext context, string poolId, PSCloudPool pool, string computeNodeId, string extensionName, IEnumerable <BatchClientBehavior> additionalBehaviors = null)
     : this(context, poolId, pool, computeNodeId, additionalBehaviors)
 {
     ExtensionName = extensionName;
 }