Exemple #1
0
        private static void KeystoneDeleteUser(IamClient iamClient)
        {
            var keystoneDeleteUserRequest = new KeystoneDeleteUserRequest()
            {
                UserId = ""
            };

            try
            {
                var keystoneDeleteUserResponse = iamClient.KeystoneDeleteUser(keystoneDeleteUserRequest);
                Console.WriteLine(keystoneDeleteUserResponse.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>
        /// 管理员删除IAM用户
        /// </summary>
        public KeystoneDeleteUserResponse KeystoneDeleteUser(KeystoneDeleteUserRequest keystoneDeleteUserRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();

            urlParam.Add("user_id", keystoneDeleteUserRequest.UserId.ToString());
            string      urlPath  = HttpUtils.AddUrlPath("/v3/users/{user_id}", urlParam);
            SdkRequest  request  = HttpUtils.InitSdkRequest(urlPath, keystoneDeleteUserRequest);
            SdkResponse response = DoHttpRequest("DELETE", request);

            return(JsonUtils.DeSerializeNull <KeystoneDeleteUserResponse>(response));
        }