/// <summary>
        /// 更新用户组
        /// </summary>
        public KeystoneUpdateGroupResponse KeystoneUpdateGroup(KeystoneUpdateGroupRequest keystoneUpdateGroupRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();

            urlParam.Add("group_id", keystoneUpdateGroupRequest.GroupId.ToString());
            string      urlPath  = HttpUtils.AddUrlPath("/v3/groups/{group_id}", urlParam);
            SdkRequest  request  = HttpUtils.InitSdkRequest(urlPath, "application/json;charset=UTF-8", keystoneUpdateGroupRequest);
            SdkResponse response = DoHttpRequest("PATCH", request);

            return(JsonUtils.DeSerialize <KeystoneUpdateGroupResponse>(response));
        }
예제 #2
0
        private static void KeystoneUpdateGroup(IamClient iamClient)
        {
            var keystoneUpdateGroupRequest = new KeystoneUpdateGroupRequest()
            {
                GroupId = "",
                Body    = new KeystoneUpdateGroupRequestBody()
                {
                    Group = new KeystoneUpdateGroupOption()
                    {
                        Description = "",
                        DomainId    = "",
                        Name        = ""
                    }
                }
            };

            try
            {
                var keystoneUpdateGroupResponse = iamClient.KeystoneUpdateGroup(keystoneUpdateGroupRequest);
                Console.WriteLine(JsonConvert.SerializeObject(keystoneUpdateGroupResponse.Group));
            }
            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);
            }
        }