// queryTagsByResourceId private static void ListScalingTagInfosByResourceId(AsClient asClient) { var listScalingTagInfosByResourceIdRequest = new ListScalingTagInfosByResourceIdRequest { ResourceType = ListScalingTagInfosByResourceIdRequest.ResourceTypeEnum.SCALING_GROUP_TAG, ResourceId = "2a8a1a58-077e-462e-ad50-d2283ebe607f" }; try { var listScalingTagInfosByResourceIdResponse = asClient.ListScalingTagInfosByResourceId(listScalingTagInfosByResourceIdRequest); Console.WriteLine(listScalingTagInfosByResourceIdResponse.GetHttpBody()); } 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 ListScalingTagInfosByResourceIdResponse ListScalingTagInfosByResourceId(ListScalingTagInfosByResourceIdRequest listScalingTagInfosByResourceIdRequest) { Dictionary <string, string> urlParam = new Dictionary <string, string>(); urlParam.Add("resource_type", listScalingTagInfosByResourceIdRequest.ResourceType.ToString()); urlParam.Add("resource_id", listScalingTagInfosByResourceIdRequest.ResourceId.ToString()); string urlPath = HttpUtils.AddUrlPath("/autoscaling-api/v1/{project_id}/{resource_type}/{resource_id}/tags", urlParam); SdkRequest request = HttpUtils.InitSdkRequest(urlPath, listScalingTagInfosByResourceIdRequest); SdkResponse response = DoHttpRequest("GET", request); return(JsonUtils.DeSerialize <ListScalingTagInfosByResourceIdResponse>(response)); }