Esempio n. 1
0
 private static void GetProjectTags(KmsClient kmsClient)
 {
     try
     {
         var req = new ListKmsTagsRequest
         {
             VersionId = "v1.0"
         };
         var resp = kmsClient.ListKmsTags(req);
         foreach (var tag in resp.Tags)
         {
             Console.Write("key: " + tag.Key + " ");
             Console.Write("value: ");
             foreach (var value in tag.Values)
             {
                 Console.Write(" " + value + " ");
             }
             Console.WriteLine();
         }
     }
     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);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 查询项目标签
        /// </summary>
        public async Task <ListKmsTagsResponse> ListKmsTagsAsync(ListKmsTagsRequest listKmsTagsRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();

            urlParam.Add("version_id", listKmsTagsRequest.VersionId.ToString());
            string              urlPath  = HttpUtils.AddUrlPath("/{version_id}/{project_id}/kms/tags", urlParam);
            SdkRequest          request  = HttpUtils.InitSdkRequest(urlPath, "application/json", listKmsTagsRequest);
            HttpResponseMessage response = await DoHttpRequestAsync("GET", request);

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