Ejemplo n.º 1
0
        private static void CinderListQuotas(EvsClient client)
        {
            CinderListQuotasRequest req = new CinderListQuotasRequest()
            {
                TargetProjectId = "0605767c2e80d5762fd0c0146a10aaf2",
                Usage           = CinderListQuotasRequest.UsageEnum.TRUE
            };

            try
            {
                CinderListQuotasResponse resp = client.CinderListQuotas(req);
                Console.WriteLine(resp.QuotaSet);
                Console.WriteLine(resp.HttpStatusCode);
            }
            catch (RequestTimeoutException requestTimeoutException)
            {
                Console.WriteLine(requestTimeoutException.ErrorMessage);
            }
            catch (ServiceResponseException clientRequestException)
            {
                Console.WriteLine(clientRequestException.HttpStatusCode);
                Console.WriteLine(clientRequestException.ErrorCode);
                Console.WriteLine(clientRequestException.ErrorMsg);
            }
            catch (ConnectionException connectionException)
            {
                Console.WriteLine(connectionException.ErrorMessage);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 查询租户的详细配额
        /// </summary>
        public CinderListQuotasResponse CinderListQuotas(CinderListQuotasRequest cinderListQuotasRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();

            urlParam.Add("target_project_id", cinderListQuotasRequest.TargetProjectId.ToString());
            string              urlPath  = HttpUtils.AddUrlPath("/v2/{project_id}/os-quota-sets/{target_project_id}", urlParam);
            SdkRequest          request  = HttpUtils.InitSdkRequest(urlPath, "application/json", cinderListQuotasRequest);
            HttpResponseMessage response = DoHttpRequestSync("GET", request);

            return(JsonUtils.DeSerialize <CinderListQuotasResponse>(response));
        }