• Home
  • Raw
  • Download

Lines Matching full:project

17   #### Getting a specific project
18 You can load a project if you know its project ID and have read permissions to the project.
19 To get a project, add the following import at the top of your file:
22 import com.google.cloud.resourcemanager.Project;
25 Then use the following code to get the project:
28 String projectId = "my-globally-unique-project-id"; // Change to a unique project ID
29 Project project = resourceManager.get(projectId);
32 #### Creating a project
33 All you need to create a project is a globally unique project ID. You can also optionally attach a
34 non-unique name and labels to your project. Read more about naming guidelines for project IDs,
36 To create a project, add the following imports at the top of your file:
39 import com.google.cloud.resourcemanager.Project;
43 Then add the following code to create a project (be sure to change `projectId` to your own unique
44 project ID).
47 String projectId = "my-globally-unique-project-id"; // Change to a unique project ID
48 Project project = resourceManager.create(ProjectInfo.newBuilder(projectId).build());
51 Note that the return value from `create` is a `Project` that includes additional read-only
52 information, like creation time, project number, and lifecycle state. Read more about these fields
54 `Project`, a subclass of `ProjectInfo`, adds a layer of service-related functionality over
57 #### Editing a project
58 …To edit a project, create a new `ProjectInfo` object and pass it in to the `Project.replace` metho…
59 …For example, to add a label to a project to denote that it's launch status is "in development", add
63 Project newProject = project.toBuilder()
69 Note that the values of the project you pass in to `replace` overwrite the server's values for
70 non-read-only fields, namely `projectName` and `labels`. For example, if you create a project with
71 `projectName` "some-project-name" and subsequently call replace using a `ProjectInfo` object that
72 …didn't set the `projectName`, then the server will unset the project's name. The server ignores any
87 Iterator<Project> projectIterator = resourceManager.list().iterateAll().iterator();
96 policies on the project-level using this library as well. We recommend using the read-modify-write
97 pattern to make policy changes. This entails reading the project's current policy, updating it
108 a project from the server, you just need to add the following code:
111 // Get the project's policy
112 Policy policy = project.getPolicy();
120 Policy updatedPolicy = project.replacePolicy(modifiedPolicy.build());
132 The first program creates a project if it does not exist. Complete source code can be found at
135 …The second program updates a project if it exists and lists all projects the user has permission to
139 The third program modifies the IAM policy associated with a project using the read-modify-write