Used to create a hosted service within a given subscription
Inheritance: Elastacloud.AzureManagement.Fluent.Commands.Services.ServiceCommand
Ejemplo n.º 1
0
 /// <summary>
 /// Updates the config with the current compute config
 /// </summary>
 public void Update()
 {
     var updateCommand = new UpdateWebsiteConfigCommand(WebsiteProperties)
                             {
                                 SubscriptionId = SubscriptionId,
                                 Certificate = ManagementCertificate
                             };
     updateCommand.Execute();
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a default website with nothing deployed
        /// </summary>
        /// <param name="website">the website which will be created</param>
        /// <param name="scm"></param>
        public void Create(Website website, ScmType scm = ScmType.LocalGit)
        {
            website.WebsiteParameters.CurrentNumberOfWorkers = website.WebsiteParameters.CurrentNumberOfWorkers != 0 ?
                website.WebsiteParameters.CurrentNumberOfWorkers : 1;

            website.Enabled = true;
            website.State = WebsiteState.Ready;
            website.Webspace = website.Webspace ?? WebspaceLocationConstants.NorthEuropeWebSpace;
            if (!String.IsNullOrEmpty(website.Webspace))
            {
                ValidateWebSpace(website.Webspace);
            }
            SetScalePotential(website);
            // check to see whether this is dedicate first
               // if((website.ServerFarm != null && website.ServerFarm.InstanceCount))

            // create the website
            var command = new CreateWebsiteCommand(website)
                              {
                                  SubscriptionId = SubscriptionId,
                                  Certificate = ManagementCertificate
                              };
            command.Execute();
            // create the website repo
            // do this only if local git is selected
            var repoCommand = new CreateWebsiteRepositoryCommand(website)
                                    {
                                        SubscriptionId = SubscriptionId,
                                        Certificate = ManagementCertificate
                                    };
            repoCommand.Execute();
            WebsiteProperties = website;

            // TODO: fix this value in code!!!!
            website.WebsiteParameters.NumberOfWorkers = website.WebsiteParameters.NumberOfWorkers == 0
                                                            ? website.WebsiteParameters.CurrentNumberOfWorkers
                                                            : website.WebsiteParameters.NumberOfWorkers;
            WebsiteProperties = GetWebsiteIfExists();

            var command2 = new UpdateWebsiteConfigCommand(WebsiteProperties)
            {
                SubscriptionId = SubscriptionId,
                Certificate = ManagementCertificate
            };
            command2.Execute();
            WebsiteProperties = GetWebsiteIfExists();
        }