@Override public void delete(String projectId) { try { resourceManager.projects().delete(projectId).execute(); } catch (IOException ex) { throw translate(ex); } }
@Override public Operation call() { try { return resourceManager.operations().get(operation.getName()).execute(); } catch (IOException ex) { throw translate(ex); } } },
/** * The resource name of the Folder to retrieve. Must be of the form `folders/{folder_id}`. */ public Get setName(java.lang.String name) { if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(), "Parameter name must conform to the pattern " + "^folders/[^/]+$"); } this.name = name; return this; }
/** * Gets the latest state of a long-running operation. Clients can use this method to poll the * operation result at intervals as recommended by the API service. * * Create a request for the method "operations.get". * * This request holds the parameters needed by the cloudresourcemanager server. After setting any * optional parameters, call the {@link Get#execute()} method to invoke the remote operation. * * @param name The name of the operation resource. * @return the request */ public Get get(java.lang.String name) throws java.io.IOException { Get result = new Get(name); initialize(result); return result; }
/** Builds a new instance of {@link CloudResourceManager}. */ @Override public CloudResourceManager build() { return new CloudResourceManager(this); }
/** * The resource name of the Folder to undelete. Must be of the form `folders/{folder_id}`. */ public Undelete setName(java.lang.String name) { if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(), "Parameter name must conform to the pattern " + "^folders/[^/]+$"); } this.name = name; return this; }
/** * Search for folders that match specific filter criteria. Search provides an eventually consistent * view of the folders a user has access to which meet the specified filter criteria. * * This will only return folders on which the caller has the permission * `resourcemanager.folders.get`. * * Create a request for the method "folders.search". * * This request holds the parameters needed by the cloudresourcemanager server. After setting any * optional parameters, call the {@link Search#execute()} method to invoke the remote operation. * * @param content the {@link com.google.api.services.cloudresourcemanager.model.SearchFoldersRequest} * @return the request */ public Search search(com.google.api.services.cloudresourcemanager.model.SearchFoldersRequest content) throws java.io.IOException { Search result = new Search(content); initialize(result); return result; }
@Override public List<Boolean> testPermissions(String projectId, List<String> permissions) throws ResourceManagerException { try { TestIamPermissionsResponse response = resourceManager .projects() .testIamPermissions( projectId, new TestIamPermissionsRequest().setPermissions(permissions)) .execute(); Set<String> permissionsOwned = ImmutableSet.copyOf(firstNonNull(response.getPermissions(), ImmutableList.<String>of())); ImmutableList.Builder<Boolean> answer = ImmutableList.builder(); for (String p : permissions) { answer.add(permissionsOwned.contains(p)); } return answer.build(); } catch (IOException ex) { throw translate(ex); } } }
/** The name of the operation resource. */ public Get setName(java.lang.String name) { if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(), "Parameter name must conform to the pattern " + "^operations/.+$"); } this.name = name; return this; }
/** * Lists the Folders that are direct descendants of supplied parent resource. List provides a * strongly consistent view of the Folders underneath the specified parent resource. List returns * Folders sorted based upon the (ascending) lexical ordering of their display_name. The caller must * have `resourcemanager.folders.list` permission on the identified parent. * * Create a request for the method "folders.list". * * This request holds the parameters needed by the cloudresourcemanager server. After setting any * optional parameters, call the {@link List#execute()} method to invoke the remote operation. * * @return the request */ public List list() throws java.io.IOException { List result = new List(); initialize(result); return result; }
@Override public Project replace(Project project) { try { return resourceManager.projects().update(project.getProjectId(), project).execute(); } catch (IOException ex) { throw translate(ex); } }
/** * the resource name of the Folder to be deleted. Must be of the form `folders/{folder_id}`. */ public Delete setName(java.lang.String name) { if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(), "Parameter name must conform to the pattern " + "^folders/[^/]+$"); } this.name = name; return this; }
/** * Retrieves a Folder identified by the supplied resource name. Valid Folder resource names have the * format `folders/{folder_id}` (for example, `folders/1234`). The caller must have * `resourcemanager.folders.get` permission on the identified folder. * * Create a request for the method "folders.get". * * This request holds the parameters needed by the cloudresourcemanager server. After setting any * optional parameters, call the {@link Get#execute()} method to invoke the remote operation. * * @param name The resource name of the Folder to retrieve. Must be of the form `folders/{folder_id}`. * @return the request */ public Get get(java.lang.String name) throws java.io.IOException { Get result = new Get(name); initialize(result); return result; }
@Override public void undelete(String projectId) { try { resourceManager.projects().undelete(projectId, new UndeleteProjectRequest()).execute(); } catch (IOException ex) { throw translate(ex); } }
/** * REQUIRED: The resource for which the policy is being requested. See the operation * documentation for the appropriate value for this field. */ public GetIamPolicy setResource(java.lang.String resource) { if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(RESOURCE_PATTERN.matcher(resource).matches(), "Parameter resource must conform to the pattern " + "^folders/[^/]+$"); } this.resource = resource; return this; }
/** * Gets the access control policy for a Folder. The returned policy may be empty if no such policy * or resource exists. The `resource` field should be the Folder's resource name, e.g. * "folders/1234". The caller must have `resourcemanager.folders.getIamPolicy` permission on the * identified folder. * * Create a request for the method "folders.getIamPolicy". * * This request holds the parameters needed by the cloudresourcemanager server. After setting any * optional parameters, call the {@link GetIamPolicy#execute()} method to invoke the remote * operation. * * @param resource REQUIRED: The resource for which the policy is being requested. See the operation documentation for * the appropriate value for this field. * @param content the {@link com.google.api.services.cloudresourcemanager.model.GetIamPolicyRequest} * @return the request */ public GetIamPolicy getIamPolicy(java.lang.String resource, com.google.api.services.cloudresourcemanager.model.GetIamPolicyRequest content) throws java.io.IOException { GetIamPolicy result = new GetIamPolicy(resource, content); initialize(result); return result; }
@Override public Policy replacePolicy(String projectId, Policy newPolicy) throws ResourceManagerException { try { return resourceManager .projects() .setIamPolicy(projectId, new SetIamPolicyRequest().setPolicy(newPolicy)) .execute(); } catch (IOException ex) { throw translate(ex); } }
/** * Output only. The resource name of the Folder. Its format is `folders/{folder_id}`, for * example: "folders/1234". */ public Patch setName(java.lang.String name) { if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(), "Parameter name must conform to the pattern " + "^folders/[^/]+$"); } this.name = name; return this; }
/** * Returns permissions that a caller has on the specified Folder. The `resource` field should be the * Folder's resource name, e.g. "folders/1234". * * There are no permissions required for making this API call. * * Create a request for the method "folders.testIamPermissions". * * This request holds the parameters needed by the cloudresourcemanager server. After setting any * optional parameters, call the {@link TestIamPermissions#execute()} method to invoke the remote * operation. * * @param resource REQUIRED: The resource for which the policy detail is being requested. See the operation * documentation for the appropriate value for this field. * @param content the {@link com.google.api.services.cloudresourcemanager.model.TestIamPermissionsRequest} * @return the request */ public TestIamPermissions testIamPermissions(java.lang.String resource, com.google.api.services.cloudresourcemanager.model.TestIamPermissionsRequest content) throws java.io.IOException { TestIamPermissions result = new TestIamPermissions(resource, content); initialize(result); return result; }
@Override public Policy getPolicy(String projectId) throws ResourceManagerException { try { return resourceManager .projects() .getIamPolicy(projectId, new GetIamPolicyRequest()) .execute(); } catch (IOException ex) { ResourceManagerException translated = translate(ex); if (translated.getCode() == HTTP_FORBIDDEN) { // Service returns permission denied if policy doesn't exist. return null; } else { throw translated; } } }