コード例 #1
0
        // create whole image
        private static void CreateWholeImage(ImsClient imsV1Client)
        {
            CreateWholeImageRequest createWholeImsRequest = new CreateWholeImageRequest
            {
                Body = new CreateWholeImageRequestBody()
                {
                    Name       = "wholeImageByInstance",
                    InstanceId = "instance_id",
                    VaultId    = "vault_id"
                }
            };

            try
            {
                var exportImsResponse = imsV1Client.CreateWholeImage(createWholeImsRequest);
                Console.WriteLine(exportImsResponse.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);
            }
        }
コード例 #2
0
        /// <summary>
        /// 制作整机镜像
        /// </summary>
        public CreateWholeImageResponse CreateWholeImage(CreateWholeImageRequest createWholeImageRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();
            string              urlPath          = HttpUtils.AddUrlPath("/v1/cloudimages/wholeimages/action", urlParam);
            SdkRequest          request          = HttpUtils.InitSdkRequest(urlPath, "application/json;charset=UTF-8", createWholeImageRequest);
            HttpResponseMessage response         = DoHttpRequestSync("POST", request);

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