private void SetScalePotential(Website website) { // if the type hasn't been defined then set the default to free switch (website.ComputeMode) { case ComputeMode.Free: website.ComputeMode = ComputeMode.Shared; website.Mode = SiteMode.Limited; break; case ComputeMode.Shared: website.ComputeMode = ComputeMode.Shared; website.Mode = SiteMode.Basic; break; case ComputeMode.Dedicated: { website.ComputeMode = ComputeMode.Dedicated; website.Mode = SiteMode.Basic; // TODO: Create the default server farm here and add to config try { // check to see whether this has been set or not if (website.ServerFarm == null) { website.ServerFarm = new ServerFarm() { Name = "DefaultServerFarm" }; } // then use this to get or create the server farm var command = new GetServerFarmCommand(website) { SubscriptionId = SubscriptionId, Certificate = ManagementCertificate }; command.Execute(); WebsiteProperties = command.Website; } catch (Exception) { // if we get the exception here then this will most likely be a 404 - for the time being treat it as such ... try { var command = new CreateWebsiteServerFarmCommand(website) { SubscriptionId = SubscriptionId, Certificate = ManagementCertificate }; command.Execute(); } catch (Exception) { // if this fails we want to halt throw new FluentManagementException( "Subscription does not support a dedicated server farm", "WebsiteClient"); } } break; } } }
private void SetScalePotential(Website website) { // if the type hasn't been defined then set the default to free switch (website.ComputeMode) { case ComputeMode.Free: website.ComputeMode = ComputeMode.Shared; website.Mode = SiteMode.Limited; break; case ComputeMode.Shared: website.ComputeMode = ComputeMode.Shared; website.Mode = SiteMode.Basic; break; case ComputeMode.Dedicated: { website.ComputeMode = ComputeMode.Dedicated; website.Mode = SiteMode.Basic; // TODO: Create the default server farm here and add to config try { // check to see whether this has been set or not if (website.ServerFarm == null) { website.ServerFarm = new ServerFarm() {Name = "DefaultServerFarm"}; } // then use this to get or create the server farm var command = new GetServerFarmCommand(website) { SubscriptionId = SubscriptionId, Certificate = ManagementCertificate }; command.Execute(); WebsiteProperties = command.Website; } catch (Exception) { // if we get the exception here then this will most likely be a 404 - for the time being treat it as such ... try { var command = new CreateWebsiteServerFarmCommand(website) { SubscriptionId = SubscriptionId, Certificate = ManagementCertificate }; command.Execute(); } catch (Exception) { // if this fails we want to halt throw new FluentManagementException( "Subscription does not support a dedicated server farm", "WebsiteClient"); } } break; } } }