private static void CheckProjectPermissionForAgency(IamClient iamV3Client) { var checkPermissionForAgencyOnProjectRequest = new CheckProjectPermissionForAgencyRequest() { ProjectId = "", AgencyId = "", RoleId = "" }; try { var checkPermissionForAgencyOnProjectResponse = iamV3Client.CheckProjectPermissionForAgency(checkPermissionForAgencyOnProjectRequest); Console.WriteLine(JsonConvert.SerializeObject(checkPermissionForAgencyOnProjectResponse.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 CheckProjectPermissionForAgencyResponse CheckProjectPermissionForAgency(CheckProjectPermissionForAgencyRequest checkProjectPermissionForAgencyRequest) { Dictionary <string, string> urlParam = new Dictionary <string, string>(); urlParam.Add("project_id", checkProjectPermissionForAgencyRequest.ProjectId.ToString()); urlParam.Add("agency_id", checkProjectPermissionForAgencyRequest.AgencyId.ToString()); urlParam.Add("role_id", checkProjectPermissionForAgencyRequest.RoleId.ToString()); string urlPath = HttpUtils.AddUrlPath("/v3.0/OS-AGENCY/projects/{project_id}/agencies/{agency_id}/roles/{role_id}", urlParam); SdkRequest request = HttpUtils.InitSdkRequest(urlPath, checkProjectPermissionForAgencyRequest); SdkResponse response = DoHttpRequest("HEAD", request); return(JsonUtils.DeSerializeNull <CheckProjectPermissionForAgencyResponse>(response)); }