|
1 | | -// Licensed to the Apache Software Foundation (ASF) under one |
2 | | -// or more contributor license agreements. See the NOTICE file |
3 | | -// distributed with this work for additional information |
4 | | -// regarding copyright ownership. The ASF licenses this file |
5 | | -// to you under the Apache License, Version 2.0 (the |
6 | | -// "License"); you may not use this file except in compliance |
7 | | -// with the License. You may obtain a copy of the License at |
8 | | -// |
9 | | -// http://www.apache.org/licenses/LICENSE-2.0 |
10 | | -// |
11 | | -// Unless required by applicable law or agreed to in writing, |
12 | | -// software distributed under the License is distributed on an |
13 | | -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
14 | | -// KIND, either express or implied. See the License for the |
15 | | -// specific language governing permissions and limitations |
16 | | -// under the License. |
17 | | -package org.apache.cloudstack.iam.api; |
18 | | - |
19 | | -import java.util.List; |
20 | | - |
21 | | -import org.apache.cloudstack.iam.api.IAMPolicyPermission.Permission; |
22 | | - |
23 | | -import com.cloud.utils.Pair; |
24 | | - |
25 | | -public interface IAMService { |
26 | | - |
27 | | - /* IAM group related interfaces */ |
28 | | - IAMGroup createIAMGroup(String iamGroupName, String description, String path); |
29 | | - |
30 | | - boolean deleteIAMGroup(Long iamGroupId); |
31 | | - |
32 | | - List<IAMGroup> listIAMGroups(long accountId); |
33 | | - |
34 | | - IAMGroup addAccountsToGroup(List<Long> acctIds, Long groupId); |
35 | | - |
36 | | - IAMGroup removeAccountsFromGroup(List<Long> acctIds, Long groupId); |
37 | | - |
38 | | - List<Long> listAccountsByGroup(long groupId); |
39 | | - |
40 | | - Pair<List<IAMGroup>, Integer> listIAMGroups(Long iamGroupId, String iamGroupName, String path, Long startIndex, Long pageSize); |
41 | | - |
42 | | - /* IAM Policy related interfaces */ |
43 | | - IAMPolicy createIAMPolicy(String iamPolicyName, String description, Long parentPolicyId, String path); |
44 | | - |
45 | | - boolean deleteIAMPolicy(long iamPolicyId); |
46 | | - |
47 | | - List<IAMPolicy> listIAMPolicies(long accountId); |
48 | | - |
49 | | - List<IAMPolicy> listIAMPoliciesByGroup(long groupId); |
50 | | - |
51 | | - Pair<List<IAMPolicy>, Integer> listIAMPolicies(Long iamPolicyId, String iamPolicyName, String path, Long startIndex, Long pageSize); |
52 | | - |
53 | | - IAMGroup attachIAMPoliciesToGroup(List<Long> policyIds, Long groupId); |
54 | | - |
55 | | - IAMGroup removeIAMPoliciesFromGroup(List<Long> policyIds, Long groupId); |
56 | | - |
57 | | - void attachIAMPolicyToAccounts(Long policyId, List<Long> acctIds); |
58 | | - |
59 | | - void removeIAMPolicyFromAccounts(Long policyId, List<Long> acctIds); |
60 | | - |
61 | | - IAMPolicy addIAMPermissionToIAMPolicy(long iamPolicyId, String entityType, String scope, Long scopeId, |
62 | | - String action, String accessType, Permission perm, Boolean recursive); |
63 | | - |
64 | | - IAMPolicy removeIAMPermissionFromIAMPolicy(long iamPolicyId, String entityType, String scope, Long scopeId, |
65 | | - String action); |
66 | | - |
67 | | - void removeIAMPermissionForEntity(final String entityType, final Long entityId); |
68 | | - |
69 | | - IAMPolicy getResourceGrantPolicy(String entityType, Long entityId, String accessType, String action); |
70 | | - |
71 | | - IAMPolicy getResourceOwnerPolicy(); |
72 | | - |
73 | | - List<IAMPolicyPermission> listPolicyPermissions(long policyId); |
74 | | - |
75 | | - List<IAMPolicyPermission> listPolicyPermissionsByScope(long policyId, String action, String scope, String accessType); |
76 | | - |
77 | | - List<IAMPolicyPermission> listPolicyPermissionByActionAndEntity(long policyId, String action, String entityType); |
78 | | - |
79 | | - boolean isActionAllowedForPolicies(String action, List<IAMPolicy> policies); |
80 | | - |
81 | | - List<Long> getGrantedEntities(long accountId, String action, String scope); |
82 | | - |
83 | | - IAMPolicy resetIAMPolicy(long iamPolicyId); |
84 | | - |
85 | | - List<IAMPolicyPermission> listPolicyPermissionByAccessAndEntity(long policyId, String accessType, |
86 | | - String entityType); |
87 | | - |
88 | | - List<IAMGroup> listParentIAMGroups(long groupId); |
89 | | - |
90 | | - List<IAMPolicy> listRecursiveIAMPoliciesByGroup(long groupId); |
91 | | - |
92 | | - /* Interface used for cache IAM checkAccess result */ |
93 | | - void addToIAMCache(Object accessKey, Object allowDeny); |
94 | | - |
95 | | - Object getFromIAMCache(Object accessKey); |
96 | | - |
97 | | - void invalidateIAMCache(); |
98 | | - |
99 | | -} |
| 1 | +// Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +// or more contributor license agreements. See the NOTICE file |
| 3 | +// distributed with this work for additional information |
| 4 | +// regarding copyright ownership. The ASF licenses this file |
| 5 | +// to you under the Apache License, Version 2.0 (the |
| 6 | +// "License"); you may not use this file except in compliance |
| 7 | +// with the License. You may obtain a copy of the License at |
| 8 | +// |
| 9 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +// |
| 11 | +// Unless required by applicable law or agreed to in writing, |
| 12 | +// software distributed under the License is distributed on an |
| 13 | +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +// KIND, either express or implied. See the License for the |
| 15 | +// specific language governing permissions and limitations |
| 16 | +// under the License. |
| 17 | +package org.apache.cloudstack.iam.api; |
| 18 | + |
| 19 | +import java.util.List; |
| 20 | + |
| 21 | +import org.apache.cloudstack.iam.api.IAMPolicyPermission.Permission; |
| 22 | + |
| 23 | +import com.cloud.utils.Pair; |
| 24 | + |
| 25 | +public interface IAMService { |
| 26 | + |
| 27 | + /* IAM group related interfaces */ |
| 28 | + IAMGroup createIAMGroup(String iamGroupName, String description, String path); |
| 29 | + |
| 30 | + boolean deleteIAMGroup(Long iamGroupId); |
| 31 | + |
| 32 | + List<IAMGroup> listIAMGroups(long accountId); |
| 33 | + |
| 34 | + IAMGroup addAccountsToGroup(List<Long> acctIds, Long groupId); |
| 35 | + |
| 36 | + IAMGroup removeAccountsFromGroup(List<Long> acctIds, Long groupId); |
| 37 | + |
| 38 | + List<Long> listAccountsByGroup(long groupId); |
| 39 | + |
| 40 | + Pair<List<IAMGroup>, Integer> listIAMGroups(Long iamGroupId, String iamGroupName, String path, Long startIndex, Long pageSize); |
| 41 | + |
| 42 | + /* IAM Policy related interfaces */ |
| 43 | + IAMPolicy createIAMPolicy(String iamPolicyName, String description, Long parentPolicyId, String path); |
| 44 | + |
| 45 | + boolean deleteIAMPolicy(long iamPolicyId); |
| 46 | + |
| 47 | + List<IAMPolicy> listIAMPolicies(long accountId); |
| 48 | + |
| 49 | + List<IAMPolicy> listIAMPoliciesByGroup(long groupId); |
| 50 | + |
| 51 | + Pair<List<IAMPolicy>, Integer> listIAMPolicies(Long iamPolicyId, String iamPolicyName, String path, Long startIndex, Long pageSize); |
| 52 | + |
| 53 | + IAMGroup attachIAMPoliciesToGroup(List<Long> policyIds, Long groupId); |
| 54 | + |
| 55 | + IAMGroup removeIAMPoliciesFromGroup(List<Long> policyIds, Long groupId); |
| 56 | + |
| 57 | + void attachIAMPolicyToAccounts(Long policyId, List<Long> acctIds); |
| 58 | + |
| 59 | + void removeIAMPolicyFromAccounts(Long policyId, List<Long> acctIds); |
| 60 | + |
| 61 | + IAMPolicy addIAMPermissionToIAMPolicy(long iamPolicyId, String entityType, String scope, Long scopeId, |
| 62 | + String action, String accessType, Permission perm, Boolean recursive); |
| 63 | + |
| 64 | + IAMPolicy removeIAMPermissionFromIAMPolicy(long iamPolicyId, String entityType, String scope, Long scopeId, |
| 65 | + String action); |
| 66 | + |
| 67 | + void removeIAMPermissionForEntity(final String entityType, final Long entityId); |
| 68 | + |
| 69 | + IAMPolicy getResourceGrantPolicy(String entityType, Long entityId, String accessType, String action); |
| 70 | + |
| 71 | + IAMPolicy getResourceOwnerPolicy(); |
| 72 | + |
| 73 | + List<IAMPolicyPermission> listPolicyPermissions(long policyId); |
| 74 | + |
| 75 | + List<IAMPolicyPermission> listPolicyPermissionsByScope(long policyId, String action, String scope, String accessType); |
| 76 | + |
| 77 | + List<IAMPolicyPermission> listPolicyPermissionByActionAndEntity(long policyId, String action, String entityType); |
| 78 | + |
| 79 | + boolean isActionAllowedForPolicies(String action, List<IAMPolicy> policies); |
| 80 | + |
| 81 | + List<Long> getGrantedEntities(long accountId, String action, String scope); |
| 82 | + |
| 83 | + IAMPolicy resetIAMPolicy(long iamPolicyId); |
| 84 | + |
| 85 | + List<IAMPolicyPermission> listPolicyPermissionByAccessAndEntity(long policyId, String accessType, |
| 86 | + String entityType); |
| 87 | + |
| 88 | + List<IAMGroup> listParentIAMGroups(long groupId); |
| 89 | + |
| 90 | + List<IAMPolicy> listRecursiveIAMPoliciesByGroup(long groupId); |
| 91 | + |
| 92 | + /* Interface used for cache IAM checkAccess result */ |
| 93 | + void addToIAMCache(Object accessKey, Object allowDeny); |
| 94 | + |
| 95 | + Object getFromIAMCache(Object accessKey); |
| 96 | + |
| 97 | + void invalidateIAMCache(); |
| 98 | + |
| 99 | +} |
0 commit comments