/// <summary> /// 批量删除云服务器标签 /// </summary> public BatchDeleteServerTagsResponse BatchDeleteServerTags(BatchDeleteServerTagsRequest batchDeleteServerTagsRequest) { Dictionary <string, string> urlParam = new Dictionary <string, string>(); urlParam.Add("server_id", batchDeleteServerTagsRequest.ServerId.ToString()); string urlPath = HttpUtils.AddUrlPath("/v1/{project_id}/cloudservers/{server_id}/tags/action", urlParam); SdkRequest request = HttpUtils.InitSdkRequest(urlPath, "application/json;charset=UTF-8", batchDeleteServerTagsRequest); SdkResponse response = DoHttpRequest("POST", request); return(JsonUtils.DeSerializeNull <BatchDeleteServerTagsResponse>(response)); }
private static void BatchDeleteServerTags(EcsClient client) { var req = new BatchDeleteServerTagsRequest() { ServerId = "f0a34dd7-a103-400b-a448-9baad3077af2", Body = new BatchDeleteServerTagsRequestBody { Action = BatchDeleteServerTagsRequestBody.ActionEnum.DELETE, Tags = new List <ServerTag> { new ServerTag { Key = "key-5", Value = "value-5" }, new ServerTag { Key = "csharp-sdk-test-key1", Value = "csharp-sdk-test-value1" } } } }; try { var resp = client.BatchDeleteServerTags(req); var respStatusCode = resp.HttpStatusCode; Console.WriteLine(respStatusCode); } 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); } }