Skip to content

Commit f5bd555

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

File tree

3 files changed

+19
-17
lines changed

3 files changed

+19
-17
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: 16 additions & 15 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,7 +141,8 @@ 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
144+
* <p>This field is optional and can remain unset. Allowed characters are: lowercase and
145+
* uppercase
145146
* letters, numbers, hyphen, single-quote, double-quote, space, and exclamation point. This
146147
* field can be changed after project creation.
147148
*/
@@ -153,7 +154,7 @@ public Builder name(String name) {
153154
/**
154155
* Set the unique, user-assigned ID of the project.
155156
*
156-
* The ID must be 6 to 30 lowercase letters, digits, or hyphens. It must start with a letter.
157+
* <p>The ID must be 6 to 30 lowercase letters, digits, or hyphens. It must start with a letter.
157158
* Trailing hyphens are prohibited. This field cannot be changed after the server creates the
158159
* project.
159160
*/
@@ -165,7 +166,7 @@ public Builder projectId(String projectId) {
165166
/**
166167
* Add a label associated with this project.
167168
*
168-
* See {@link #labels} for label restrictions.
169+
* <p>See {@link #labels} for label restrictions.
169170
*/
170171
public Builder addLabel(String key, String value) {
171172
this.labels.put(key, value);
@@ -191,7 +192,8 @@ public Builder clearLabels() {
191192
/**
192193
* Set the labels associated with this project.
193194
*
194-
* Label keys must be between 1 and 63 characters long and must conform to the following regular
195+
* <p>Label keys must be between 1 and 63 characters long and must conform to the following
196+
* regular
195197
* expression: [a-z]([-a-z0-9]*[a-z0-9])?. Label values must be between 0 and 63 characters long
196198
* and must conform to the regular expression ([a-z]([-a-z0-9]*[a-z0-9])?)?. No more than 256
197199
* labels can be associated with a given resource. This field can be changed after project
@@ -240,7 +242,7 @@ public ProjectInfo build() {
240242
/**
241243
* Get the unique, user-assigned ID of the project.
242244
*
243-
* This field cannot be changed after the server creates the project.
245+
* <p>This field cannot be changed after the server creates the project.
244246
*/
245247
public String projectId() {
246248
return projectId;
@@ -249,7 +251,7 @@ public String projectId() {
249251
/**
250252
* Get the user-assigned name of the project.
251253
*
252-
* This field is optional, can remain unset, and can be changed after project creation.
254+
* <p>This field is optional, can remain unset, and can be changed after project creation.
253255
*/
254256
public String name() {
255257
return Data.isNull(name) ? null : name;
@@ -258,7 +260,7 @@ public String name() {
258260
/**
259261
* Get number uniquely identifying the project.
260262
*
261-
* This field is set by the server and is read-only.
263+
* <p>This field is set by the server and is read-only.
262264
*/
263265
public Long projectNumber() {
264266
return projectNumber;
@@ -274,7 +276,7 @@ public Map<String, String> labels() {
274276
/**
275277
* Get the project's lifecycle state.
276278
*
277-
* This is a read-only field. To change the lifecycle state of your project, use the
279+
* <p>This is a read-only field. To change the lifecycle state of your project, use the
278280
* {@code delete} or {@code undelete} method.
279281
*/
280282
public State state() {
@@ -288,7 +290,7 @@ ResourceId parent() {
288290
/**
289291
* Get the project's creation time (in milliseconds).
290292
*
291-
* This field is set by the server and is read-only.
293+
* <p>This field is set by the server and is read-only.
292294
*/
293295
public Long createTimeMillis() {
294296
return createTimeMillis;
@@ -332,8 +334,7 @@ com.google.api.services.cloudresourcemanager.model.Project toPb() {
332334
}
333335

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

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)