public override void ExecuteCmdlet() { if (string.IsNullOrWhiteSpace(Tier)) { Tier = "Free"; } if (string.IsNullOrWhiteSpace(WorkerSize)) { WorkerSize = "Small"; } var aseResourceGroupName = AseResourceGroupName; if (!string.IsNullOrEmpty(AseName) && string.IsNullOrEmpty(aseResourceGroupName)) { aseResourceGroupName = ResourceGroupName; } var capacity = NumberofWorkers < 1 ? 1 : NumberofWorkers; var skuName = CmdletHelpers.GetSkuName(Tier, WorkerSize); var sku = new SkuDescription { Tier = Tier, Name = skuName, Capacity = capacity }; WriteObject(WebsitesClient.CreateAppServicePlan(ResourceGroupName, Name, Location, null, sku, AseName, aseResourceGroupName, PerSiteScaling), true); }
protected override void ProcessRecord() { base.ProcessRecord(); switch (ParameterSetName) { case ParameterSet1Name: AppServicePlan = WebsitesClient.GetAppServicePlan(ResourceGroupName, Name); AppServicePlan.Sku.Tier = string.IsNullOrWhiteSpace(Tier) ? AppServicePlan.Sku.Tier : Tier; AppServicePlan.Sku.Capacity = NumberofWorkers > 0 ? NumberofWorkers : AppServicePlan.Sku.Capacity; var workerSizeAsNumber = int.Parse(AppServicePlan.Sku.Name.Substring(1, AppServicePlan.Sku.Name.Length - 1)); AppServicePlan.Sku.Name = string.IsNullOrWhiteSpace(WorkerSize) ? CmdletHelpers.GetSkuName(AppServicePlan.Sku.Tier, workerSizeAsNumber) : CmdletHelpers.GetSkuName(AppServicePlan.Sku.Tier, WorkerSize); break; } // Fix Server Farm SKU description AppServicePlan.Sku.Size = AppServicePlan.Sku.Name; AppServicePlan.Sku.Family = AppServicePlan.Sku.Name.Substring(0, 1); WriteObject(WebsitesClient.CreateAppServicePlan(ResourceGroupName, Name, AppServicePlan.Location, AdminSiteName, AppServicePlan.Sku), true); }
public override void ExecuteCmdlet() { base.ExecuteCmdlet(); switch (ParameterSetName) { case ParameterSet1Name: AppServicePlan = WebsitesClient.GetAppServicePlan(ResourceGroupName, Name); AppServicePlan.Sku.Tier = string.IsNullOrWhiteSpace(Tier) ? AppServicePlan.Sku.Tier : Tier; AppServicePlan.Sku.Capacity = NumberofWorkers > 0 ? NumberofWorkers : AppServicePlan.Sku.Capacity; int workerSizeAsNumber = 0; int.TryParse(Regex.Match(AppServicePlan.Sku.Name, @"\d+").Value, out workerSizeAsNumber); AppServicePlan.Sku.Name = string.IsNullOrWhiteSpace(WorkerSize) ? CmdletHelpers.GetSkuName(AppServicePlan.Sku.Tier, workerSizeAsNumber) : CmdletHelpers.GetSkuName(AppServicePlan.Sku.Tier, WorkerSize); AppServicePlan.PerSiteScaling = PerSiteScaling; break; } // Fix Server Farm SKU description AppServicePlan.Sku.Size = AppServicePlan.Sku.Name; AppServicePlan.Sku.Family = AppServicePlan.Sku.Name.Substring(0, 1); WriteObject(WebsitesClient.CreateAppServicePlan(ResourceGroupName, Name, AppServicePlan.Location, AdminSiteName, AppServicePlan.Sku, null, null, AppServicePlan.PerSiteScaling), true); }
protected override void ProcessRecord() { if (string.IsNullOrWhiteSpace(Tier)) { Tier = "Free"; } if (string.IsNullOrWhiteSpace(WorkerSize)) { WorkerSize = "Small"; } var capacity = NumberofWorkers < 1 ? 1 : NumberofWorkers; var skuName = CmdletHelpers.GetSkuName(Tier, WorkerSize); var sku = new SkuDescription { Tier = Tier, Name = skuName, Capacity = capacity }; WriteObject(WebsitesClient.CreateAppServicePlan(ResourceGroupName, Name, Location, null, sku), true); }
public override void ExecuteCmdlet() { //for now not asking admin site name need to implement in future string adminSiteName = null; //if Sku is not specified assume default to be Standard SkuOptions skuInput = SkuOptions.Standard; //if workerSize is not specified assume default to be small WorkerSizeOptions workerSizeInput = WorkerSizeOptions.Small; //if NumberofWorkers is not specified assume default to be 1 if (NumberofWorkers == 0) { NumberofWorkers = 1; } if (WorkerSize != null) { switch (WorkerSize.ToUpper()) { case "SMALL": workerSizeInput = WorkerSizeOptions.Small; break; case "MEDIUM": workerSizeInput = WorkerSizeOptions.Medium; break; case "LARGE": workerSizeInput = WorkerSizeOptions.Large; break; default: workerSizeInput = WorkerSizeOptions.Large; break; } } if (Sku != null) { switch (Sku.ToUpper()) { case "FREE": skuInput = SkuOptions.Free; break; case "SHARED": skuInput = SkuOptions.Shared; break; case "BASIC": skuInput = SkuOptions.Basic; break; case "PREMIUM": skuInput = SkuOptions.Premium; break; default: skuInput = SkuOptions.Standard; break; } } WriteObject(WebsitesClient.CreateAppServicePlan(ResourceGroupName, Name, Location, adminSiteName, NumberofWorkers, skuInput, workerSizeInput)); }