Skip to content

Commit 87ff266

Browse files
author
Ajay Kannan
committed
Minor docs and tests fixes
1 parent 0d2cd39 commit 87ff266

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

gcloud-java-resourcemanager/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ All you need to create a project is a globally unique project ID. You can also
8888
import com.google.gcloud.resourcemanager.ProjectInfo;
8989
```
9090

91-
Then add the following code to create a project (be sure to change `myProjectId` to be something unique).
91+
Then add the following code to create a project (be sure to change `myProjectId` to your own unique project ID).
9292

9393
```java
9494
String myProjectId = "my-globally-unique-project-id"; // Change to a unique project ID.
@@ -135,7 +135,7 @@ while (projectIterator.hasNext()) {
135135

136136
#### Complete source code
137137

138-
Here we put together all the code shown above into one program. This program assumes that you are running from your own desktop.
138+
Here we put together all the code shown above into one program. This program assumes that you are running from your own desktop and used the Google Cloud SDK to authenticate yourself.
139139

140140
```java
141141
import com.google.gcloud.resourcemanager.ProjectInfo;

gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/ProjectInfo.java

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ public class ProjectInfo implements Serializable {
5050
*/
5151
public enum State {
5252
/**
53-
* Only used/useful for distinguishing unset values
53+
* Only used/useful for distinguishing unset values.
5454
*/
5555
LIFECYCLE_STATE_UNSPECIFIED,
5656

5757
/**
58-
* The normal and active state
58+
* The normal and active state.
5959
*/
6060
ACTIVE,
6161

@@ -66,7 +66,7 @@ public enum State {
6666
DELETE_REQUESTED,
6767

6868
/**
69-
* the process of deleting the project has begun. Reversing the deletion is no longer possible.
69+
* The process of deleting the project has begun. Reversing the deletion is no longer possible.
7070
*/
7171
DELETE_IN_PROGRESS
7272
}
@@ -105,7 +105,7 @@ com.google.api.services.cloudresourcemanager.model.ResourceId toPb() {
105105
com.google.api.services.cloudresourcemanager.model.ResourceId resourceIdPb =
106106
new com.google.api.services.cloudresourcemanager.model.ResourceId();
107107
resourceIdPb.setId(id);
108-
resourceIdPb.setType(type.toString().toLowerCase());
108+
resourceIdPb.setType(type.toLowerCase());
109109
return resourceIdPb;
110110
}
111111

@@ -141,9 +141,9 @@ private Builder() {
141141
/**
142142
* Set the user-assigned name of the project.
143143
*
144-
* This field is optional and can remain unset. Allowed characters are: lowercase and uppercase
145-
* letters, numbers, hyphen, single-quote, double-quote, space, and exclamation point. This
146-
* field can be changed after project creation.
144+
* <p>This field is optional and can remain unset. Allowed characters are: lowercase and
145+
* uppercase letters, numbers, hyphen, single-quote, double-quote, space, and exclamation point.
146+
* This field can be changed after project creation.
147147
*/
148148
public Builder name(String name) {
149149
this.name = firstNonNull(name, Data.<String>nullOf(String.class));
@@ -153,7 +153,7 @@ public Builder name(String name) {
153153
/**
154154
* Set the unique, user-assigned ID of the project.
155155
*
156-
* The ID must be 6 to 30 lowercase letters, digits, or hyphens. It must start with a letter.
156+
* <p>The ID must be 6 to 30 lowercase letters, digits, or hyphens. It must start with a letter.
157157
* Trailing hyphens are prohibited. This field cannot be changed after the server creates the
158158
* project.
159159
*/
@@ -165,7 +165,7 @@ public Builder projectId(String projectId) {
165165
/**
166166
* Add a label associated with this project.
167167
*
168-
* See {@link #labels} for label restrictions.
168+
* <p>See {@link #labels} for label restrictions.
169169
*/
170170
public Builder addLabel(String key, String value) {
171171
this.labels.put(key, value);
@@ -191,11 +191,11 @@ public Builder clearLabels() {
191191
/**
192192
* Set the labels associated with this project.
193193
*
194-
* Label keys must be between 1 and 63 characters long and must conform to the following regular
195-
* expression: [a-z]([-a-z0-9]*[a-z0-9])?. Label values must be between 0 and 63 characters long
196-
* and must conform to the regular expression ([a-z]([-a-z0-9]*[a-z0-9])?)?. No more than 256
197-
* labels can be associated with a given resource. This field can be changed after project
198-
* creation.
194+
* <p>Label keys must be between 1 and 63 characters long and must conform to the following
195+
* regular expression: [a-z]([-a-z0-9]*[a-z0-9])?. Label values must be between 0 and 63
196+
* characters long and must conform to the regular expression ([a-z]([-a-z0-9]*[a-z0-9])?)?. No
197+
* more than 256 labels can be associated with a given resource. This field can be changed after
198+
* project creation.
199199
*/
200200
public Builder labels(Map<String, String> labels) {
201201
this.labels = Maps.newHashMap(checkNotNull(labels));
@@ -240,7 +240,7 @@ public ProjectInfo build() {
240240
/**
241241
* Get the unique, user-assigned ID of the project.
242242
*
243-
* This field cannot be changed after the server creates the project.
243+
* <p>This field cannot be changed after the server creates the project.
244244
*/
245245
public String projectId() {
246246
return projectId;
@@ -249,7 +249,7 @@ public String projectId() {
249249
/**
250250
* Get the user-assigned name of the project.
251251
*
252-
* This field is optional, can remain unset, and can be changed after project creation.
252+
* <p>This field is optional, can remain unset, and can be changed after project creation.
253253
*/
254254
public String name() {
255255
return Data.isNull(name) ? null : name;
@@ -258,7 +258,7 @@ public String name() {
258258
/**
259259
* Get number uniquely identifying the project.
260260
*
261-
* This field is set by the server and is read-only.
261+
* <p>This field is set by the server and is read-only.
262262
*/
263263
public Long projectNumber() {
264264
return projectNumber;
@@ -274,7 +274,7 @@ public Map<String, String> labels() {
274274
/**
275275
* Get the project's lifecycle state.
276276
*
277-
* This is a read-only field. To change the lifecycle state of your project, use the
277+
* <p>This is a read-only field. To change the lifecycle state of your project, use the
278278
* {@code delete} or {@code undelete} method.
279279
*/
280280
public State state() {
@@ -288,7 +288,7 @@ ResourceId parent() {
288288
/**
289289
* Get the project's creation time (in milliseconds).
290290
*
291-
* This field is set by the server and is read-only.
291+
* <p>This field is set by the server and is read-only.
292292
*/
293293
public Long createTimeMillis() {
294294
return createTimeMillis;
@@ -332,8 +332,7 @@ com.google.api.services.cloudresourcemanager.model.Project toPb() {
332332
}
333333

334334
static ProjectInfo fromPb(com.google.api.services.cloudresourcemanager.model.Project projectPb) {
335-
ProjectInfo.Builder builder =
336-
ProjectInfo.builder(projectPb.getProjectId()).projectNumber(projectPb.getProjectNumber());
335+
Builder builder = builder(projectPb.getProjectId()).projectNumber(projectPb.getProjectNumber());
337336
if (projectPb.getName() != null && !projectPb.getName().equals("Unnamed")) {
338337
builder.name(projectPb.getName());
339338
}

gcloud-java-resourcemanager/src/test/java/com/google/gcloud/resourcemanager/ProjectInfoTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ public void testToBuilder() {
7373

7474
@Test
7575
public void testToAndFromPb() {
76+
assertTrue(FULL_PROJECT_INFO.toPb().getCreateTime().endsWith("Z"));
7677
compareProjects(FULL_PROJECT_INFO, ProjectInfo.fromPb(FULL_PROJECT_INFO.toPb()));
7778
compareProjects(PARTIAL_PROJECT_INFO, ProjectInfo.fromPb(PARTIAL_PROJECT_INFO.toPb()));
7879
compareProjects(PARTIAL_PROJECT_INFO, ProjectInfo.fromPb(UNNAMED_PROJECT_FROM_LIST.toPb()));

0 commit comments

Comments
 (0)