|
18 | 18 |
|
19 | 19 | import static com.google.common.base.Preconditions.checkNotNull; |
20 | 20 |
|
| 21 | +import com.google.gcloud.resourcemanager.ResourceManager.Permission; |
| 22 | + |
21 | 23 | import java.io.IOException; |
22 | 24 | import java.io.ObjectInputStream; |
| 25 | +import java.util.List; |
23 | 26 | import java.util.Map; |
24 | 27 | import java.util.Objects; |
25 | 28 |
|
@@ -198,6 +201,71 @@ public Project replace() { |
198 | 201 | return resourceManager.replace(this); |
199 | 202 | } |
200 | 203 |
|
| 204 | + /** |
| 205 | + * Returns the IAM access control policy for the specified project. Returns {@code null} if the |
| 206 | + * resource does not exist or if you do not have adequate permission to view the project or get |
| 207 | + * the policy. |
| 208 | + * |
| 209 | + * @throws ResourceManagerException upon failure |
| 210 | + * @see <a href= |
| 211 | + * "https://cloud.google.com/resource-manager/reference/rest/v1beta1/projects/getIamPolicy"> |
| 212 | + * Resource Manager getIamPolicy</a> |
| 213 | + */ |
| 214 | + public Policy getPolicy() { |
| 215 | + return resourceManager.getPolicy(projectId()); |
| 216 | + } |
| 217 | + |
| 218 | + /** |
| 219 | + * Sets the IAM access control policy for the specified project. Replaces any existing policy. |
| 220 | + * It is recommended that you use the read-modify-write pattern. See code samples and important |
| 221 | + * details of replacing policies in the documentation for {@link ResourceManager#replacePolicy}. |
| 222 | + * |
| 223 | + * @throws ResourceManagerException upon failure |
| 224 | + * @see ResourceManager#replacePolicy |
| 225 | + * @see <a href= |
| 226 | + * "https://cloud.google.com/resource-manager/reference/rest/v1beta1/projects/setIamPolicy"> |
| 227 | + * Resource Manager setIamPolicy</a> |
| 228 | + */ |
| 229 | + public Policy replacePolicy(Policy newPolicy) { |
| 230 | + return resourceManager.replacePolicy(projectId(), newPolicy); |
| 231 | + } |
| 232 | + |
| 233 | + /** |
| 234 | + * Returns the permissions that a caller has on this project. You typically don't call this method |
| 235 | + * if you're using Google Cloud Platform directly to manage permissions. This method is intended |
| 236 | + * for integration with your proprietary software, such as a customized graphical user interface. |
| 237 | + * For example, the Cloud Platform Console tests IAM permissions internally to determine which UI |
| 238 | + * should be available to the logged-in user. |
| 239 | + * |
| 240 | + * @return A list of booleans representing whether the caller has the permissions specified (in |
| 241 | + * the order of the given permissions) |
| 242 | + * @throws ResourceManagerException upon failure |
| 243 | + * @see <a href= |
| 244 | + * "https://cloud.google.com/resource-manager/reference/rest/v1beta1/projects/testIamPermissions"> |
| 245 | + * Resource Manager testIamPermissions</a> |
| 246 | + */ |
| 247 | + List<Boolean> testPermissions(List<Permission> permissions) { |
| 248 | + return resourceManager.testPermissions(projectId(), permissions); |
| 249 | + } |
| 250 | + |
| 251 | + /** |
| 252 | + * Returns the permissions that a caller has on this project. You typically don't call this method |
| 253 | + * if you're using Google Cloud Platform directly to manage permissions. This method is intended |
| 254 | + * for integration with your proprietary software, such as a customized graphical user interface. |
| 255 | + * For example, the Cloud Platform Console tests IAM permissions internally to determine which UI |
| 256 | + * should be available to the logged-in user. |
| 257 | + * |
| 258 | + * @return A list of booleans representing whether the caller has the permissions specified (in |
| 259 | + * the order of the given permissions) |
| 260 | + * @throws ResourceManagerException upon failure |
| 261 | + * @see <a href= |
| 262 | + * "https://cloud.google.com/resource-manager/reference/rest/v1beta1/projects/testIamPermissions"> |
| 263 | + * Resource Manager testIamPermissions</a> |
| 264 | + */ |
| 265 | + List<Boolean> testPermissions(Permission first, Permission... others) { |
| 266 | + return resourceManager.testPermissions(projectId(), first, others); |
| 267 | + } |
| 268 | + |
201 | 269 | @Override |
202 | 270 | public Builder toBuilder() { |
203 | 271 | return new Builder(this); |
|
0 commit comments