private void CreateSite(WebSpace webspace, SiteWithWebSpace website) { try { WebsitesClient.CreateWebsite(webspace.Name, website); Cache.AddSite(CurrentSubscription.SubscriptionId, website); SiteConfig websiteConfiguration = WebsitesClient.GetWebsiteConfiguration(Name); WriteObject(new SiteWithConfig(website, websiteConfiguration)); } catch (CloudException ex) { if (SiteAlreadyExists(ex) && (Git || GitHub)) { // Handle conflict - it's ok to attempt to use cmdlet on an // existing website if you're updating the source control stuff. WriteWarning(ex.Message); } else if (HostNameValidationFailed(ex)) { WriteExceptionError(new Exception(Resources.InvalidHostnameValidation)); } else if (BadPlan(ex)) { throw new EndpointNotFoundException(); } else { WriteExceptionError(new Exception(ex.Message)); } } }
private Site CreateSite(WebSpace webspace, SiteWithWebSpace website) { Site createdWebsite = null; try { if (WebsitesClient.WebsiteExists(website.Name) && !string.IsNullOrEmpty(Slot)) { createdWebsite = WebsitesClient.GetWebsite(website.Name); // Make sure that the website is in Standard mode if (createdWebsite.ComputeMode == WebSiteComputeMode.Dedicated) { WebsitesClient.CreateWebsite(webspace.Name, website, Slot); } else { throw new Exception("Can not create slot in a website not in Standard mode"); } } else { WebsitesClient.CreateWebsite(webspace.Name, website, null); } createdWebsite = WebsitesClient.GetWebsite(website.Name); Cache.AddSite(CurrentContext.Subscription.Id.ToString(), createdWebsite); SiteConfig websiteConfiguration = WebsitesClient.GetWebsiteConfiguration(createdWebsite.Name, Slot); WriteObject(new SiteWithConfig(createdWebsite, websiteConfiguration)); } catch (CloudException ex) { if (SiteAlreadyExists(ex) && (Git || GitHub)) { // Handle conflict - it's ok to attempt to use cmdlet on an // existing website if you're updating the source control stuff. WriteWarning(ex.Message); createdWebsite = WebsitesClient.GetWebsite(website.Name, null); } else if (HostNameValidationFailed(ex)) { WriteExceptionError(new Exception(Resources.InvalidHostnameValidation)); } else if (BadPlan(ex)) { throw new EndpointNotFoundException(); } else { WriteExceptionError(new Exception(ex.Message)); } } return(createdWebsite); }
protected override void ProcessRecord() { WriteObject(WebsitesClient.CreateWebsite(ResourceGroupName, Name, SlotName, Location, AppServicePlan)); }
public override void ExecuteCmdlet() { WriteObject(WebsitesClient.CreateWebsite(ResourceGroupName, Name, SlotName, Location, AppServicePlan)); }
public override void ExecuteCmdlet() { WriteObject(WebsitesClient.CreateWebsite(ResourceGroupName, WebsiteName, SlotName, Location, WebHostingPlan)); }