private static void ShowVolume(EvsClient client) { ShowVolumeRequest req = new ShowVolumeRequest() { VolumeId = "8da11134-0614-40e2-8792-3437c66cc90d" }; try { ShowVolumeResponse resp = client.ShowVolume(req); Console.WriteLine(resp.Volume); Console.WriteLine(resp.HttpStatusCode); } 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 ShowVolumeResponse ShowVolume(ShowVolumeRequest showVolumeRequest) { Dictionary <string, string> urlParam = new Dictionary <string, string>(); urlParam.Add("volume_id", showVolumeRequest.VolumeId.ToString()); string urlPath = HttpUtils.AddUrlPath("/v2/{project_id}/cloudvolumes/{volume_id}", urlParam); SdkRequest request = HttpUtils.InitSdkRequest(urlPath, "application/json", showVolumeRequest); HttpResponseMessage response = DoHttpRequestSync("GET", request); return(JsonUtils.DeSerialize <ShowVolumeResponse>(response)); }