/// <summary> /// 批量关闭云服务器 /// </summary> public BatchStopServersResponse BatchStopServers(BatchStopServersRequest batchStopServersRequest) { Dictionary <string, string> urlParam = new Dictionary <string, string>(); string urlPath = HttpUtils.AddUrlPath("/v1/{project_id}/cloudservers/action", urlParam); SdkRequest request = HttpUtils.InitSdkRequest(urlPath, "application/json;charset=UTF-8", batchStopServersRequest); SdkResponse response = DoHttpRequest("POST", request); return(JsonUtils.DeSerialize <BatchStopServersResponse>(response)); }
private static void BatchStopServers(EcsClient client) { var req = new BatchStopServersRequest { Body = new BatchStopServersRequestBody { OsStop = new BatchStopServersOption { Type = BatchStopServersOption.TypeEnum.SOFT, Servers = new List <ServerId> { new ServerId { Id = "f0a34dd7-a103-400b-a448-9baad3077af2" } } } } }; try { var resp = client.BatchStopServers(req); var respStatusCode = resp.HttpStatusCode; var jobId = resp.JobId; Console.WriteLine(respStatusCode); Console.WriteLine(jobId); } 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); } }