Ejemplo n.º 1
0
 private static void deleteReplication(DcsClient dcsClient)
 {
     try
     {
         var deleteReplicationReq = new DeleteReplicationRequest()
         {
             NodeId     = "ff80808172977c00017297d6bd2a01bc",
             GroupId    = "97579592-6399-4d61-974b-d8b59efc0ca2",
             InstanceId = "975a54a5-ff73-499c-96bb-b217d69210f0"
         };
         // Console.WriteLine(createMigrationTaskRequest.ToString());
         var response = dcsClient.DeleteReplication(deleteReplicationReq);
         Console.WriteLine(response.GetHttpBody());
     }
     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 async Task <DeleteReplicationResponse> DeleteReplicationAsync(DeleteReplicationRequest deleteReplicationRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();

            urlParam.Add("instance_id", deleteReplicationRequest.InstanceId.ToString());
            urlParam.Add("group_id", deleteReplicationRequest.GroupId.ToString());
            urlParam.Add("node_id", deleteReplicationRequest.NodeId.ToString());
            string              urlPath  = HttpUtils.AddUrlPath("/v2/{project_id}/instances/{instance_id}/groups/{group_id}/replications/{node_id}", urlParam);
            SdkRequest          request  = HttpUtils.InitSdkRequest(urlPath, deleteReplicationRequest);
            HttpResponseMessage response = await DoHttpRequestAsync("DELETE", request);

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