private static void ShowSnapshot(EvsClient client)
        {
            ShowSnapshotRequest req = new ShowSnapshotRequest()
            {
                SnapshotId = "fc5281ca-5a1b-4193-814f-514cb5d303e7"
            };

            try
            {
                ShowSnapshotResponse resp = client.ShowSnapshot(req);
                Console.WriteLine(resp.Snapshot);
                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);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 查询单个云硬盘快照详细信息
        /// </summary>
        public ShowSnapshotResponse ShowSnapshot(ShowSnapshotRequest showSnapshotRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();

            urlParam.Add("snapshot_id", showSnapshotRequest.SnapshotId.ToString());
            string              urlPath  = HttpUtils.AddUrlPath("/v2/{project_id}/cloudsnapshots/{snapshot_id}", urlParam);
            SdkRequest          request  = HttpUtils.InitSdkRequest(urlPath, "application/json", showSnapshotRequest);
            HttpResponseMessage response = DoHttpRequestSync("GET", request);

            return(JsonUtils.DeSerialize <ShowSnapshotResponse>(response));
        }