示例#1
0
        //见解服务
        public async Task <object> GetAKSCPUMemoryInsight(AKSInsightsQueryParams queryParams, string access_token)
        {
            CreateQueryString createQueryString = new CreateQueryString();
            var requestmodel = new JObject
            {
                { "query", createQueryString.AKSCPUMemoryInsightsQuery(queryParams) }
            };
            string requestbody = JsonConvert.SerializeObject(requestmodel);
            string url         = string.Format("/subscriptions/{0}/resourcegroups/defaultresourcegroup-east2/providers/" +
                                               "microsoft.operationalinsights/workspaces/defaultworkspace-{0}-east2/query?api-version=2017-10-01",
                                               queryParams.subid);
            var request = new HttpRequestMessage(HttpMethod.Post, url);
            var client  = this._clientFactory.CreateClient("chinacloudapi");

            client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", access_token);
            request.Content = new StringContent(requestbody, UnicodeEncoding.UTF8, "application/json");
            var response = await client.SendAsync(request);

            string result = await response.Content.ReadAsStringAsync();

            if (response.IsSuccessStatusCode)
            {
                JObject job = (JObject)JsonConvert.DeserializeObject(result);
                return(job);
            }
            else
            {
                return(response.ReasonPhrase);
            }
        }
示例#2
0
        public async Task <object> GetAKSPodCountInsight(string email, AKSInsightsQueryParams queryParams)
        {
            string access_token = _tokenDto.GetTokenString(email, _tokenResource.Value.apilog);

            return(await _monitorDto.GetAKSPodCountInsight(queryParams, access_token));
        }
 public async Task <object> GetAKSPodCountInsight(string email, [FromBody] AKSInsightsQueryParams queryParams)
 {
     return(await _monitorBus.GetAKSPodCountInsight(email, queryParams));
 }