/// <summary> /// 修改委托 /// </summary> public UpdateAgencyResponse UpdateAgency(UpdateAgencyRequest updateAgencyRequest) { Dictionary <string, string> urlParam = new Dictionary <string, string>(); urlParam.Add("agency_id", updateAgencyRequest.AgencyId.ToString()); string urlPath = HttpUtils.AddUrlPath("/v3.0/OS-AGENCY/agencies/{agency_id}", urlParam); SdkRequest request = HttpUtils.InitSdkRequest(urlPath, "application/json;charset=UTF-8", updateAgencyRequest); SdkResponse response = DoHttpRequest("PUT", request); return(JsonUtils.DeSerialize <UpdateAgencyResponse>(response)); }
private static void UpdateAgency(IamClient iamClient) { var updateAgencyRequest = new UpdateAgencyRequest() { AgencyId = "", Body = new UpdateAgencyRequestBody() { Agency = new UpdateAgencyOption() { Description = "", Duration = UpdateAgencyOption.DurationEnum.ONEDAY, TrustDomainId = "", TrustDomainName = "" } } }; try { var updateAgencyResponse = iamClient.UpdateAgency(updateAgencyRequest); Console.WriteLine(JsonConvert.SerializeObject(updateAgencyResponse.Agency)); } 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); } }