private static void GetQuotas(KmsClient kmsClient) { try { var req = new ShowUserQuotasRequest { VersionId = "v1.0" }; var resp = kmsClient.ShowUserQuotas(req); Console.WriteLine(resp.ToString()); } 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); } }
/// <summary> /// 查询配额 /// </summary> public async Task <ShowUserQuotasResponse> ShowUserQuotasAsync(ShowUserQuotasRequest showUserQuotasRequest) { Dictionary <string, string> urlParam = new Dictionary <string, string>(); urlParam.Add("version_id", showUserQuotasRequest.VersionId.ToString()); string urlPath = HttpUtils.AddUrlPath("/{version_id}/{project_id}/kms/user-quotas", urlParam); SdkRequest request = HttpUtils.InitSdkRequest(urlPath, "application/json", showUserQuotasRequest); HttpResponseMessage response = await DoHttpRequestAsync("GET", request); return(JsonUtils.DeSerialize <ShowUserQuotasResponse>(response)); }