/// <summary> /// 查询项目标签 /// </summary> public static void QueryProjectTags(DdsClient client) { ListProjectTagsRequest req = new ListProjectTagsRequest(); try { ListProjectTagsResponse resp = client.ListProjectTags(req); foreach (var tag in resp.Tags) { Console.WriteLine(tag.Key); foreach (var value in tag.Values) { Console.WriteLine(value); } } Console.WriteLine("Query Project Tags Success!"); } 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> /// 查询指定project ID下实例的所有标签集合 /// </summary> public ListProjectTagsResponse ListProjectTags(ListProjectTagsRequest listProjectTagsRequest) { Dictionary <string, string> urlParam = new Dictionary <string, string>(); string urlPath = HttpUtils.AddUrlPath("/v3/{project_id}/tags", urlParam); SdkRequest request = HttpUtils.InitSdkRequest(urlPath, listProjectTagsRequest); SdkResponse response = DoHttpRequest("GET", request); return(JsonUtils.DeSerialize <ListProjectTagsResponse>(response)); }
/// <summary> /// 查询项目标签 /// </summary> public async Task <ListProjectTagsResponse> ListProjectTagsAsync(ListProjectTagsRequest listProjectTagsRequest) { Dictionary <string, string> urlParam = new Dictionary <string, string>(); string urlPath = HttpUtils.AddUrlPath("/v3/{project_id}/tags", urlParam); SdkRequest request = HttpUtils.InitSdkRequest(urlPath, "application/json", listProjectTagsRequest); HttpResponseMessage response = await DoHttpRequestAsync("GET", request); return(JsonUtils.DeSerialize <ListProjectTagsResponse>(response)); }