コード例 #1
0
        //batch delete members
        private static void BatchDeleteImageMembers(ImsClient imsV1Client)
        {
            BatchDeleteMembersRequest deleteImageMemberListRequest = new BatchDeleteMembersRequest()
            {
                Body = new BatchAddMembersRequestBody()
                {
                    Images = new List <string> {
                        "d164b5df-1bc3-4c3f-893e-3e471fd16e64"
                    },
                    Projects = new List <string> {
                        "9c61004714024f9586705d090530f9fa"
                    }
                }
            };

            try
            {
                var deleteImageMemberListResponse = imsV1Client.BatchDeleteMembers(deleteImageMemberListRequest);
                Console.WriteLine(deleteImageMemberListResponse.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 BatchDeleteMembersResponse BatchDeleteMembers(BatchDeleteMembersRequest batchDeleteMembersRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();
            string              urlPath          = HttpUtils.AddUrlPath("/v1/cloudimages/members", urlParam);
            SdkRequest          request          = HttpUtils.InitSdkRequest(urlPath, "application/json;charset=UTF-8", batchDeleteMembersRequest);
            HttpResponseMessage response         = DoHttpRequestSync("DELETE", request);

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