Example #1
0
        public async Task UploadUserCode(string zipPackagePath)
        {
            await EnsureScmHttpClient();

            using (var response = await ScmClient.PutZipFile($"{ScmBaseUrl}/api/zip/LocalSiteRoot/funclite", zipPackagePath))
            {
                response.EnsureSuccessStatusCode();
            }
        }
Example #2
0
        protected internal override async Task <dynamic> SendRequest(object payload)
        {
            await EnsureScmHttpClient();

            using (var response = await ScmClient.PostAsJsonAsync($"{ScmBaseUrl}/funclite", payload))
            {
                response.EnsureSuccessStatusCode();

                return(await response.Content.ReadAsAsync <dynamic>());
            }
        }
Example #3
0
        async Task Restart()
        {
            // Just kill the scm site to restart it (faster than full site restart)
            await EnsureScmHttpClient();

            using (var response = await ScmClient.DeleteAsync($"{ScmBaseUrl}/api/processes/0"))
            {
                // Ignore errors as suiciding the scm w3wp can cause the delete request to fail (even though it still kills it)
                //response.EnsureSuccessStatusCode();
            }
        }
Example #4
0
        protected override async Task UploadLanguageHost()
        {
            _logger.LogInformation("UploadLanguageHost " + Name);
            await CreateKuduFolder(@"d:\home\SiteExtensions\FuncLite");

            await EnsureScmHttpClient();

            using (var response = await ScmClient.PutZipFile($"{ScmBaseUrl}/api/zip/SiteExtensions/FuncLite", $"{_config.DataFolder}/runtimes/node.zip"))
            {
                response.EnsureSuccessStatusCode();
            }
        }
Example #5
0
        public async Task SendWarmUpRequests()
        {
            // As a warmup request, create the folder where the user files will land, to make sure it's there is the site restarts
            await CreateKuduFolder(@"d:\local\funclite");

            await EnsureScmHttpClient();

            using (var response = await ScmClient.GetAsync($"{ScmBaseUrl}/funclite"))
            {
                response.EnsureSuccessStatusCode();
            }
        }
Example #6
0
        async Task RunKuduCommand(string command)
        {
            await EnsureScmHttpClient();

            using (var response = await ScmClient.PostAsJsonAsync(
                       $"{ScmBaseUrl}/api/command",
                       new
            {
                command = command
            }))
            {
                response.EnsureSuccessStatusCode();
            }
        }
Example #7
0
        public new async Task Delete()
        {
            using (var response = await Client.DeleteAsync(
                       $"/subscriptions/{_config.Subscription}/resourceGroups/{_config.ResourceGroup}/providers/Microsoft.Web/sites/{AppName}?api-version=2016-03-01"))
            {
                response.EnsureSuccessStatusCode();
            }

            if (ScmClient != null)
            {
                ScmClient.Dispose();
                ScmClient = null;
            }
        }
Example #8
0
        public async Task SendWarmUpRequests()
        {
            await EnsureScmHttpClient();

            using (var response = await ScmClient.GetAsync($"{ScmBaseUrl}"))
            {
                response.EnsureSuccessStatusCode();
            }

            using (var response = await Client.GetAsync($"{SiteUrl}"))
            {
                response.EnsureSuccessStatusCode();
            }
        }