Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4888e12

Browse files
committed
Rename id to generatedId for Compute resources (googleapis#966)
1 parent b8989f3 commit 4888e12

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+405
-409
lines changed

gcloud-java-compute/src/main/java/com/google/gcloud/compute/Address.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ public Builder description(String description) {
8080
}
8181

8282
@Override
83-
Builder id(String id) {
84-
infoBuilder.id(id);
83+
Builder generatedId(String generatedId) {
84+
infoBuilder.generatedId(generatedId);
8585
return this;
8686
}
8787

gcloud-java-compute/src/main/java/com/google/gcloud/compute/AddressInfo.java

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public Address apply(AddressInfo addressInfo) {
6868
private final String address;
6969
private final Long creationTimestamp;
7070
private final String description;
71-
private final String id;
71+
private final String generatedId;
7272
private final AddressId addressId;
7373
private final Status status;
7474
private final Usage usage;
@@ -296,7 +296,7 @@ public abstract static class Builder {
296296
*/
297297
public abstract Builder description(String description);
298298

299-
abstract Builder id(String id);
299+
abstract Builder generatedId(String generatedId);
300300

301301
public abstract Builder addressId(AddressId addressId);
302302

@@ -315,7 +315,7 @@ static final class BuilderImpl extends Builder {
315315
private String address;
316316
private Long creationTimestamp;
317317
private String description;
318-
private String id;
318+
private String generatedId;
319319
private AddressId addressId;
320320
private Status status;
321321
private Usage usage;
@@ -326,7 +326,7 @@ static final class BuilderImpl extends Builder {
326326
this.address = addressInfo.address;
327327
this.creationTimestamp = addressInfo.creationTimestamp;
328328
this.description = addressInfo.description;
329-
this.id = addressInfo.id;
329+
this.generatedId = addressInfo.generatedId;
330330
this.addressId = addressInfo.addressId;
331331
this.status = addressInfo.status;
332332
this.usage = addressInfo.usage;
@@ -344,7 +344,7 @@ static final class BuilderImpl extends Builder {
344344
}
345345
description = addressPb.getDescription();
346346
if (addressPb.getId() != null) {
347-
id = addressPb.getId().toString();
347+
generatedId = addressPb.getId().toString();
348348
}
349349
if (addressPb.getStatus() != null) {
350350
status = Status.valueOf(addressPb.getStatus());
@@ -373,8 +373,8 @@ public BuilderImpl description(String description) {
373373
}
374374

375375
@Override
376-
BuilderImpl id(String id) {
377-
this.id = id;
376+
BuilderImpl generatedId(String generatedId) {
377+
this.generatedId = generatedId;
378378
return this;
379379
}
380380

@@ -406,7 +406,7 @@ public AddressInfo build() {
406406
address = builder.address;
407407
creationTimestamp = builder.creationTimestamp;
408408
description = builder.description;
409-
id = builder.id;
409+
generatedId = builder.generatedId;
410410
addressId = checkNotNull(builder.addressId);
411411
status = builder.status;
412412
usage = builder.usage;
@@ -434,10 +434,10 @@ public String description() {
434434
}
435435

436436
/**
437-
* Returns the unique identifier for the address; defined by the service.
437+
* Returns the service-generated unique identifier for the address.
438438
*/
439-
public String id() {
440-
return id;
439+
public String generatedId() {
440+
return generatedId;
441441
}
442442

443443
/**
@@ -481,7 +481,7 @@ public String toString() {
481481
.add("address", address)
482482
.add("creationTimestamp", creationTimestamp)
483483
.add("description", description)
484-
.add("id", id)
484+
.add("generatedId", generatedId)
485485
.add("addressId", addressId)
486486
.add("status", status)
487487
.add("usage", usage)
@@ -490,7 +490,8 @@ public String toString() {
490490

491491
@Override
492492
public int hashCode() {
493-
return Objects.hash(address, creationTimestamp, description, id, addressId, status, usage);
493+
return Objects.hash(address, creationTimestamp, description, generatedId, addressId, status,
494+
usage);
494495
}
495496

496497
@Override
@@ -514,8 +515,8 @@ Address toPb() {
514515
addressPb.setCreationTimestamp(TIMESTAMP_FORMATTER.print(creationTimestamp));
515516
}
516517
addressPb.setDescription(description);
517-
if (id != null) {
518-
addressPb.setId(new BigInteger(id));
518+
if (generatedId != null) {
519+
addressPb.setId(new BigInteger(generatedId));
519520
}
520521
addressPb.setName(addressId.address());
521522
if (addressId.type() == AddressId.Type.REGION) {

gcloud-java-compute/src/main/java/com/google/gcloud/compute/Disk.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ public static class Builder extends DiskInfo.Builder {
6060
}
6161

6262
@Override
63-
Builder id(String id) {
64-
infoBuilder.id(id);
63+
Builder generatedId(String generatedId) {
64+
infoBuilder.generatedId(generatedId);
6565
return this;
6666
}
6767

gcloud-java-compute/src/main/java/com/google/gcloud/compute/DiskImageConfiguration.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,9 @@ public DiskId sourceDisk() {
9595
}
9696

9797
/**
98-
* Returns the id of the disk used to create this image. This value may be used to determine
99-
* whether the image was taken from the current or a previous instance of a given disk name.
98+
* Returns the service-generated unique id of the disk used to create this image. This value may
99+
* be used to determine whether the image was taken from the current or a previous instance of a
100+
* given disk name.
100101
*/
101102
public String sourceDiskId() {
102103
return sourceDiskId;

gcloud-java-compute/src/main/java/com/google/gcloud/compute/DiskInfo.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public Disk apply(DiskInfo diskType) {
5858
private static final long serialVersionUID = -7173418340679279619L;
5959
private static final DateTimeFormatter TIMESTAMP_FORMATTER = ISODateTimeFormat.dateTime();
6060

61-
private final String id;
61+
private final String generatedId;
6262
private final DiskId diskId;
6363
private final DiskConfiguration configuration;
6464
private final Long creationTimestamp;
@@ -99,7 +99,7 @@ public enum CreationStatus {
9999
*/
100100
public abstract static class Builder {
101101

102-
abstract Builder id(String id);
102+
abstract Builder generatedId(String generatedId);
103103

104104
/**
105105
* Sets the disk configuration.
@@ -136,7 +136,7 @@ public abstract static class Builder {
136136

137137
static final class BuilderImpl extends Builder {
138138

139-
private String id;
139+
private String generatedId;
140140
private DiskId diskId;
141141
private DiskConfiguration configuration;
142142
private Long creationTimestamp;
@@ -153,7 +153,7 @@ static final class BuilderImpl extends Builder {
153153
}
154154

155155
BuilderImpl(DiskInfo diskInfo) {
156-
this.id = diskInfo.id;
156+
this.generatedId = diskInfo.generatedId;
157157
this.configuration = diskInfo.configuration;
158158
this.creationTimestamp = diskInfo.creationTimestamp;
159159
this.creationStatus = diskInfo.creationStatus;
@@ -167,7 +167,7 @@ static final class BuilderImpl extends Builder {
167167

168168
BuilderImpl(Disk diskPb) {
169169
if (diskPb.getId() != null) {
170-
this.id = diskPb.getId().toString();
170+
this.generatedId = diskPb.getId().toString();
171171
}
172172
this.configuration = DiskConfiguration.fromPb(diskPb);
173173
if (diskPb.getCreationTimestamp() != null) {
@@ -193,8 +193,8 @@ static final class BuilderImpl extends Builder {
193193
}
194194

195195
@Override
196-
BuilderImpl id(String id) {
197-
this.id = id;
196+
BuilderImpl generatedId(String generatedId) {
197+
this.generatedId = generatedId;
198198
return this;
199199
}
200200

@@ -260,7 +260,7 @@ public DiskInfo build() {
260260
}
261261

262262
DiskInfo(BuilderImpl builder) {
263-
this.id = builder.id;
263+
this.generatedId = builder.generatedId;
264264
this.configuration = builder.configuration;
265265
this.creationTimestamp = builder.creationTimestamp;
266266
this.creationStatus = builder.creationStatus;
@@ -280,10 +280,10 @@ public Long creationTimestamp() {
280280
}
281281

282282
/**
283-
* Returns the unique identifier for the disk; defined by the service.
283+
* Returns the service-generated unique identifier for the disk.
284284
*/
285-
public String id() {
286-
return id;
285+
public String generatedId() {
286+
return generatedId;
287287
}
288288

289289
/**
@@ -353,7 +353,7 @@ public Builder toBuilder() {
353353
@Override
354354
public String toString() {
355355
return MoreObjects.toStringHelper(this)
356-
.add("id", id)
356+
.add("generatedId", generatedId)
357357
.add("diskId", diskId)
358358
.add("configuration", configuration)
359359
.add("creationTimestamp", creationTimestamp)
@@ -408,8 +408,8 @@ DiskInfo setProjectId(String projectId) {
408408

409409
Disk toPb() {
410410
Disk diskPb = configuration.toPb();
411-
if (id != null) {
412-
diskPb.setId(new BigInteger(id));
411+
if (generatedId != null) {
412+
diskPb.setId(new BigInteger(generatedId));
413413
}
414414
if (creationTimestamp != null) {
415415
diskPb.setCreationTimestamp(TIMESTAMP_FORMATTER.print(creationTimestamp));

gcloud-java-compute/src/main/java/com/google/gcloud/compute/DiskType.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public com.google.api.services.compute.model.DiskType apply(DiskType diskType) {
5252
private static final long serialVersionUID = -944042261695072026L;
5353
private static final DateTimeFormatter TIMESTAMP_FORMATTER = ISODateTimeFormat.dateTime();
5454

55-
private final String id;
55+
private final String generatedId;
5656
private final DiskTypeId diskTypeId;
5757
private final Long creationTimestamp;
5858
private final String description;
@@ -62,7 +62,7 @@ public com.google.api.services.compute.model.DiskType apply(DiskType diskType) {
6262

6363
static final class Builder {
6464

65-
private String id;
65+
private String generatedId;
6666
private DiskTypeId diskTypeId;
6767
private Long creationTimestamp;
6868
private String description;
@@ -72,8 +72,8 @@ static final class Builder {
7272

7373
private Builder() {}
7474

75-
Builder id(String id) {
76-
this.id = id;
75+
Builder generatedId(String generatedId) {
76+
this.generatedId = generatedId;
7777
return this;
7878
}
7979

@@ -113,7 +113,7 @@ DiskType build() {
113113
}
114114

115115
private DiskType(Builder builder) {
116-
this.id = builder.id;
116+
this.generatedId = builder.generatedId;
117117
this.creationTimestamp = builder.creationTimestamp;
118118
this.diskTypeId = builder.diskTypeId;
119119
this.description = builder.description;
@@ -137,10 +137,10 @@ public DiskTypeId diskTypeId() {
137137
}
138138

139139
/**
140-
* Returns the unique identifier for the disk type; defined by the service.
140+
* Returns the service-generated unique identifier for the disk type.
141141
*/
142-
public String id() {
143-
return id;
142+
public String generatedId() {
143+
return generatedId;
144144
}
145145

146146
/**
@@ -176,7 +176,7 @@ public DeprecationStatus<DiskTypeId> deprecationStatus() {
176176
@Override
177177
public String toString() {
178178
return MoreObjects.toStringHelper(this)
179-
.add("id", id)
179+
.add("generatedId", generatedId)
180180
.add("creationTimestamp", creationTimestamp)
181181
.add("description", description)
182182
.add("validDiskSize", validDiskSize)
@@ -198,8 +198,8 @@ public final boolean equals(Object obj) {
198198
com.google.api.services.compute.model.DiskType toPb() {
199199
com.google.api.services.compute.model.DiskType diskTypePb =
200200
new com.google.api.services.compute.model.DiskType();
201-
if (id != null) {
202-
diskTypePb.setId(new BigInteger(id));
201+
if (generatedId != null) {
202+
diskTypePb.setId(new BigInteger(generatedId));
203203
}
204204
if (creationTimestamp != null) {
205205
diskTypePb.setCreationTimestamp(TIMESTAMP_FORMATTER.print(creationTimestamp));
@@ -222,7 +222,7 @@ static Builder builder() {
222222
static DiskType fromPb(com.google.api.services.compute.model.DiskType diskTypePb) {
223223
Builder builder = builder();
224224
if (diskTypePb.getId() != null) {
225-
builder.id(diskTypePb.getId().toString());
225+
builder.generatedId(diskTypePb.getId().toString());
226226
}
227227
if (diskTypePb.getCreationTimestamp() != null) {
228228
builder.creationTimestamp(TIMESTAMP_FORMATTER.parseMillis(diskTypePb.getCreationTimestamp()));

gcloud-java-compute/src/main/java/com/google/gcloud/compute/Image.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ public static class Builder extends ImageInfo.Builder {
6565
}
6666

6767
@Override
68-
Builder id(String id) {
69-
infoBuilder.id(id);
68+
Builder generatedId(String generatedId) {
69+
infoBuilder.generatedId(generatedId);
7070
return this;
7171
}
7272

gcloud-java-compute/src/main/java/com/google/gcloud/compute/ImageDiskConfiguration.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,11 @@ public ImageId sourceImage() {
108108
}
109109

110110
/**
111-
* Returns the ID value of the image used to create this disk. This value identifies the exact
112-
* image that was used to create this persistent disk. For example, if you created the persistent
113-
* disk from an image that was later deleted and recreated under the same name, the source image
114-
* ID would identify the exact version of the image that was used.
111+
* Returns the service-generated unique id of the image used to create this disk. This value
112+
* identifies the exact image that was used to create this persistent disk. For example, if you
113+
* created the persistent disk from an image that was later deleted and recreated under the same
114+
* name, the source image service-generated id would identify the exact version of the image that
115+
* was used.
115116
*/
116117
public String sourceImageId() {
117118
return sourceImageId;

0 commit comments

Comments
 (0)