Skip to content

Commit

Permalink
Update ResourceManager examples, snippets and READMEs to use renamed …
Browse files Browse the repository at this point in the history
…getters/setters/builders
  • Loading branch information
mziccard committed Oct 17, 2016
1 parent b7a8d50 commit 512ac95
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -512,13 +512,13 @@ if (project != null) {
.addLabel("launch-status", "in-development")
.build()
.replace();
System.out.println("Updated the labels of project " + newProject.projectId()
+ " to be " + newProject.labels());
System.out.println("Updated the labels of project " + newProject.getProjectId()
+ " to be " + newProject.getLabels());
}
Iterator<Project> projectIterator = resourceManager.list().iterateAll();
System.out.println("Projects I can view:");
while (projectIterator.hasNext()) {
System.out.println(projectIterator.next().projectId());
System.out.println(projectIterator.next().getProjectId());
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void run(ResourceManager resourceManager, String... args) {
}
}
Project project =
resourceManager.create(ProjectInfo.builder(projectId).labels(labels).build());
resourceManager.create(ProjectInfo.newBuilder(projectId).setLabels(labels).build());
System.out.printf(
"Successfully created project '%s': %s.%n", projectId, projectDetails(project));
}
Expand Down Expand Up @@ -160,15 +160,15 @@ public String[] getOptionalParams() {
private static String projectDetails(ProjectInfo project) {
return new StringBuilder()
.append("{projectId:")
.append(project.projectId())
.append(project.getProjectId())
.append(", projectNumber:")
.append(project.projectNumber())
.append(project.getProjectNumber())
.append(", createTimeMillis:")
.append(project.createTimeMillis())
.append(project.getCreateTimeMillis())
.append(", state:")
.append(project.state())
.append(project.getState())
.append(", labels:")
.append(project.labels())
.append(project.getLabels())
.append("}")
.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public static void main(String... args) {
Project project = resourceManager.get(projectId);
if (project == null) {
// Create a project.
project = resourceManager.create(ProjectInfo.builder(projectId).build());
project = resourceManager.create(ProjectInfo.newBuilder(projectId).build());
}
System.out.println("Got project " + project.projectId() + " from the server.");
System.out.println("Got project " + project.getProjectId() + " from the server.");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ public static void main(String... args) {
.addLabel("launch-status", "in-development")
.build()
.replace();
System.out.println("Updated the labels of project " + newProject.projectId()
+ " to be " + newProject.labels());
System.out.println("Updated the labels of project " + newProject.getProjectId()
+ " to be " + newProject.getLabels());
}

// List all the projects you have permission to view.
Iterator<Project> projectIterator = resourceManager.list().iterateAll();
System.out.println("Projects I can view:");
while (projectIterator.hasNext()) {
System.out.println(projectIterator.next().projectId());
System.out.println(projectIterator.next().getProjectId());
}
}
}
4 changes: 2 additions & 2 deletions google-cloud-resourcemanager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ project ID).

```java
String projectId = "my-globally-unique-project-id"; // Change to a unique project ID
Project project = resourceManager.create(ProjectInfo.builder(projectId).build());
Project project = resourceManager.create(ProjectInfo.newBuilder(projectId).build());
```

Note that the return value from `create` is a `Project` that includes additional read-only
Expand Down Expand Up @@ -159,7 +159,7 @@ Then add the following code to print a list of projects you can view:
Iterator<Project> projectIterator = resourceManager.list().iterateAll();
System.out.println("Projects I can view:");
while (projectIterator.hasNext()) {
System.out.println(projectIterator.next().projectId());
System.out.println(projectIterator.next().getProjectId());
}
```

Expand Down

0 comments on commit 512ac95

Please sign in to comment.