private static void RemoveDomainPermissionFromAgency(IamClient iamClient) { var removePermissionFromAgencyOnDomainRequest = new RemoveDomainPermissionFromAgencyRequest() { DomainId = "", AgencyId = "", RoleId = "" }; try { var removePermissionFromAgencyOnDomainResponse = iamClient.RemoveDomainPermissionFromAgency(removePermissionFromAgencyOnDomainRequest); Console.WriteLine(JsonConvert.SerializeObject(removePermissionFromAgencyOnDomainResponse.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> /// 移除委托的全局服务权限 /// </summary> public RemoveDomainPermissionFromAgencyResponse RemoveDomainPermissionFromAgency(RemoveDomainPermissionFromAgencyRequest removeDomainPermissionFromAgencyRequest) { Dictionary <string, string> urlParam = new Dictionary <string, string>(); urlParam.Add("domain_id", removeDomainPermissionFromAgencyRequest.DomainId.ToString()); urlParam.Add("agency_id", removeDomainPermissionFromAgencyRequest.AgencyId.ToString()); urlParam.Add("role_id", removeDomainPermissionFromAgencyRequest.RoleId.ToString()); string urlPath = HttpUtils.AddUrlPath("/v3.0/OS-AGENCY/domains/{domain_id}/agencies/{agency_id}/roles/{role_id}", urlParam); SdkRequest request = HttpUtils.InitSdkRequest(urlPath, removeDomainPermissionFromAgencyRequest); SdkResponse response = DoHttpRequest("DELETE", request); return(JsonUtils.DeSerializeNull <RemoveDomainPermissionFromAgencyResponse>(response)); }