/// <param name='resourceId'> /// The resource id. /// </param> /// <param name='skuName'> /// The sku name. /// </param> /// <param name='skuTier'> /// The sku tier. /// </param> /// <param name='skuCapacity'> /// The sku capacity. /// </param> /// <param name='cancellationToken'> /// Cancellation token. /// </param> /// <returns> /// A standard service response including an HTTP status code and /// request ID. /// </returns> public Task <SkuUpdateResponse> UpdateCurrentSkuAsync(string resourceId, string skuName, string skuTier, int skuCapacity, CancellationToken cancellationToken) { // Validate if (resourceId == null) { throw new ArgumentNullException("resourceId"); } if (skuName == null) { throw new ArgumentNullException("skuName"); } if (skuTier == null) { throw new ArgumentNullException("skuTier"); } // Confirm resourceId is supported if (!IsSupportedResourceType(resourceId)) { throw new NotSupportedException(string.Format(CultureInfo.InvariantCulture, "Manual scaling not currently supported for resourceId {0}", resourceId)); } AntaresSkuUpdateRequest parameters = new AntaresSkuUpdateRequest { WorkerSize = SkuOperations.GetWorkerSize(skuName), Sku = skuTier, NumberOfWorkers = skuCapacity }; return(this.UpdateAntaresCurrentSkuInternalAsync(resourceId, parameters, cancellationToken)); }
internal static Task <SkuUpdateResponse> UpdateAntaresCurrentSkuAsync( SkuOperations skuOperations, string resourceId, SkuUpdateParameters parameters, string apiVersion, CancellationToken cancellationToken) { AntaresSkuUpdateRequest antaresUpdateParameters = new AntaresSkuUpdateRequest { WorkerSize = AntaresSkuOperations.GetAntaresWorkerSize(parameters.Sku.Name), Sku = parameters.Sku.Tier, NumberOfWorkers = parameters.Sku.Capacity }; return(skuOperations.UpdateAntaresCurrentSkuInternalAsync(resourceId, antaresUpdateParameters, apiVersion, cancellationToken)); }
internal async static Task <SkuGetResponse> GetAntaresCurrentSku(SkuOperations skuOperations, string resourceId, string apiVersion, CancellationToken cancellationToken) { AntaresSkuGetResponse response = await skuOperations.GetAntaresCurrentSkuInternalAsync(resourceId, apiVersion, cancellationToken); return(new SkuGetResponse { Properties = new SkuGetProperties { Sku = new CurrentSku { Name = AntaresSkuOperations.GetAnatresSkuName(response.Properties.CurrentWorkerSize, response.Properties.Sku), Tier = response.Properties.Sku, Capacity = response.Properties.CurrentNumberOfWorkers } } }); }
/// <param name='resourceId'> /// Required. The resource id. /// </param> /// <param name='cancellationToken'> /// Cancellation token. /// </param> /// <returns> /// A standard service response including an HTTP status code and /// request ID. /// </returns> public async Task <SkuGetResponse> GetCurrentSkuAsync(string resourceId, CancellationToken cancellationToken) { // Confirm resourceId is supported if (!IsSupportedResourceType(resourceId)) { throw new NotSupportedException(string.Format(CultureInfo.InvariantCulture, "Manual scaling not currently supported for resourceId {0}", resourceId)); } AntaresSkuGetResponse response = await this.GetAntaresCurrentSkuInternalAsync(resourceId, cancellationToken); return(new SkuGetResponse { Name = SkuOperations.GetSkuName(response.Properties.CurrentWorkerSize, response.Properties.Sku), Tier = response.Properties.Sku, Capacity = response.Properties.CurrentNumberOfWorkers }); }