Skip to content

Commit

Permalink
Rename id to generatedId for Compute resources (#966)
Browse files Browse the repository at this point in the history
  • Loading branch information
mziccard committed Apr 27, 2016
1 parent f459e2c commit 88fea35
Show file tree
Hide file tree
Showing 44 changed files with 405 additions and 409 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ public Builder description(String description) {
}

@Override
Builder id(String id) {
infoBuilder.id(id);
Builder generatedId(String generatedId) {
infoBuilder.generatedId(generatedId);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public Address apply(AddressInfo addressInfo) {
private final String address;
private final Long creationTimestamp;
private final String description;
private final String id;
private final String generatedId;
private final AddressId addressId;
private final Status status;
private final Usage usage;
Expand Down Expand Up @@ -296,7 +296,7 @@ public abstract static class Builder {
*/
public abstract Builder description(String description);

abstract Builder id(String id);
abstract Builder generatedId(String generatedId);

public abstract Builder addressId(AddressId addressId);

Expand All @@ -315,7 +315,7 @@ static final class BuilderImpl extends Builder {
private String address;
private Long creationTimestamp;
private String description;
private String id;
private String generatedId;
private AddressId addressId;
private Status status;
private Usage usage;
Expand All @@ -326,7 +326,7 @@ static final class BuilderImpl extends Builder {
this.address = addressInfo.address;
this.creationTimestamp = addressInfo.creationTimestamp;
this.description = addressInfo.description;
this.id = addressInfo.id;
this.generatedId = addressInfo.generatedId;
this.addressId = addressInfo.addressId;
this.status = addressInfo.status;
this.usage = addressInfo.usage;
Expand All @@ -344,7 +344,7 @@ static final class BuilderImpl extends Builder {
}
description = addressPb.getDescription();
if (addressPb.getId() != null) {
id = addressPb.getId().toString();
generatedId = addressPb.getId().toString();
}
if (addressPb.getStatus() != null) {
status = Status.valueOf(addressPb.getStatus());
Expand Down Expand Up @@ -373,8 +373,8 @@ public BuilderImpl description(String description) {
}

@Override
BuilderImpl id(String id) {
this.id = id;
BuilderImpl generatedId(String generatedId) {
this.generatedId = generatedId;
return this;
}

Expand Down Expand Up @@ -406,7 +406,7 @@ public AddressInfo build() {
address = builder.address;
creationTimestamp = builder.creationTimestamp;
description = builder.description;
id = builder.id;
generatedId = builder.generatedId;
addressId = checkNotNull(builder.addressId);
status = builder.status;
usage = builder.usage;
Expand Down Expand Up @@ -434,10 +434,10 @@ public String description() {
}

/**
* Returns the unique identifier for the address; defined by the service.
* Returns the service-generated unique identifier for the address.
*/
public String id() {
return id;
public String generatedId() {
return generatedId;
}

/**
Expand Down Expand Up @@ -481,7 +481,7 @@ public String toString() {
.add("address", address)
.add("creationTimestamp", creationTimestamp)
.add("description", description)
.add("id", id)
.add("generatedId", generatedId)
.add("addressId", addressId)
.add("status", status)
.add("usage", usage)
Expand All @@ -490,7 +490,8 @@ public String toString() {

@Override
public int hashCode() {
return Objects.hash(address, creationTimestamp, description, id, addressId, status, usage);
return Objects.hash(address, creationTimestamp, description, generatedId, addressId, status,
usage);
}

@Override
Expand All @@ -514,8 +515,8 @@ Address toPb() {
addressPb.setCreationTimestamp(TIMESTAMP_FORMATTER.print(creationTimestamp));
}
addressPb.setDescription(description);
if (id != null) {
addressPb.setId(new BigInteger(id));
if (generatedId != null) {
addressPb.setId(new BigInteger(generatedId));
}
addressPb.setName(addressId.address());
if (addressId.type() == AddressId.Type.REGION) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ public static class Builder extends DiskInfo.Builder {
}

@Override
Builder id(String id) {
infoBuilder.id(id);
Builder generatedId(String generatedId) {
infoBuilder.generatedId(generatedId);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,9 @@ public DiskId sourceDisk() {
}

/**
* Returns the id of the disk used to create this image. This value may be used to determine
* whether the image was taken from the current or a previous instance of a given disk name.
* Returns the service-generated unique id of the disk used to create this image. This value may
* be used to determine whether the image was taken from the current or a previous instance of a
* given disk name.
*/
public String sourceDiskId() {
return sourceDiskId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public Disk apply(DiskInfo diskType) {
private static final long serialVersionUID = -7173418340679279619L;
private static final DateTimeFormatter TIMESTAMP_FORMATTER = ISODateTimeFormat.dateTime();

private final String id;
private final String generatedId;
private final DiskId diskId;
private final DiskConfiguration configuration;
private final Long creationTimestamp;
Expand Down Expand Up @@ -99,7 +99,7 @@ public enum CreationStatus {
*/
public abstract static class Builder {

abstract Builder id(String id);
abstract Builder generatedId(String generatedId);

/**
* Sets the disk configuration.
Expand Down Expand Up @@ -136,7 +136,7 @@ public abstract static class Builder {

static final class BuilderImpl extends Builder {

private String id;
private String generatedId;
private DiskId diskId;
private DiskConfiguration configuration;
private Long creationTimestamp;
Expand All @@ -153,7 +153,7 @@ static final class BuilderImpl extends Builder {
}

BuilderImpl(DiskInfo diskInfo) {
this.id = diskInfo.id;
this.generatedId = diskInfo.generatedId;
this.configuration = diskInfo.configuration;
this.creationTimestamp = diskInfo.creationTimestamp;
this.creationStatus = diskInfo.creationStatus;
Expand All @@ -167,7 +167,7 @@ static final class BuilderImpl extends Builder {

BuilderImpl(Disk diskPb) {
if (diskPb.getId() != null) {
this.id = diskPb.getId().toString();
this.generatedId = diskPb.getId().toString();
}
this.configuration = DiskConfiguration.fromPb(diskPb);
if (diskPb.getCreationTimestamp() != null) {
Expand All @@ -193,8 +193,8 @@ static final class BuilderImpl extends Builder {
}

@Override
BuilderImpl id(String id) {
this.id = id;
BuilderImpl generatedId(String generatedId) {
this.generatedId = generatedId;
return this;
}

Expand Down Expand Up @@ -260,7 +260,7 @@ public DiskInfo build() {
}

DiskInfo(BuilderImpl builder) {
this.id = builder.id;
this.generatedId = builder.generatedId;
this.configuration = builder.configuration;
this.creationTimestamp = builder.creationTimestamp;
this.creationStatus = builder.creationStatus;
Expand All @@ -280,10 +280,10 @@ public Long creationTimestamp() {
}

/**
* Returns the unique identifier for the disk; defined by the service.
* Returns the service-generated unique identifier for the disk.
*/
public String id() {
return id;
public String generatedId() {
return generatedId;
}

/**
Expand Down Expand Up @@ -353,7 +353,7 @@ public Builder toBuilder() {
@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("id", id)
.add("generatedId", generatedId)
.add("diskId", diskId)
.add("configuration", configuration)
.add("creationTimestamp", creationTimestamp)
Expand Down Expand Up @@ -408,8 +408,8 @@ DiskInfo setProjectId(String projectId) {

Disk toPb() {
Disk diskPb = configuration.toPb();
if (id != null) {
diskPb.setId(new BigInteger(id));
if (generatedId != null) {
diskPb.setId(new BigInteger(generatedId));
}
if (creationTimestamp != null) {
diskPb.setCreationTimestamp(TIMESTAMP_FORMATTER.print(creationTimestamp));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public com.google.api.services.compute.model.DiskType apply(DiskType diskType) {
private static final long serialVersionUID = -944042261695072026L;
private static final DateTimeFormatter TIMESTAMP_FORMATTER = ISODateTimeFormat.dateTime();

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

static final class Builder {

private String id;
private String generatedId;
private DiskTypeId diskTypeId;
private Long creationTimestamp;
private String description;
Expand All @@ -72,8 +72,8 @@ static final class Builder {

private Builder() {}

Builder id(String id) {
this.id = id;
Builder generatedId(String generatedId) {
this.generatedId = generatedId;
return this;
}

Expand Down Expand Up @@ -113,7 +113,7 @@ DiskType build() {
}

private DiskType(Builder builder) {
this.id = builder.id;
this.generatedId = builder.generatedId;
this.creationTimestamp = builder.creationTimestamp;
this.diskTypeId = builder.diskTypeId;
this.description = builder.description;
Expand All @@ -137,10 +137,10 @@ public DiskTypeId diskTypeId() {
}

/**
* Returns the unique identifier for the disk type; defined by the service.
* Returns the service-generated unique identifier for the disk type.
*/
public String id() {
return id;
public String generatedId() {
return generatedId;
}

/**
Expand Down Expand Up @@ -176,7 +176,7 @@ public DeprecationStatus<DiskTypeId> deprecationStatus() {
@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("id", id)
.add("generatedId", generatedId)
.add("creationTimestamp", creationTimestamp)
.add("description", description)
.add("validDiskSize", validDiskSize)
Expand All @@ -198,8 +198,8 @@ public final boolean equals(Object obj) {
com.google.api.services.compute.model.DiskType toPb() {
com.google.api.services.compute.model.DiskType diskTypePb =
new com.google.api.services.compute.model.DiskType();
if (id != null) {
diskTypePb.setId(new BigInteger(id));
if (generatedId != null) {
diskTypePb.setId(new BigInteger(generatedId));
}
if (creationTimestamp != null) {
diskTypePb.setCreationTimestamp(TIMESTAMP_FORMATTER.print(creationTimestamp));
Expand All @@ -222,7 +222,7 @@ static Builder builder() {
static DiskType fromPb(com.google.api.services.compute.model.DiskType diskTypePb) {
Builder builder = builder();
if (diskTypePb.getId() != null) {
builder.id(diskTypePb.getId().toString());
builder.generatedId(diskTypePb.getId().toString());
}
if (diskTypePb.getCreationTimestamp() != null) {
builder.creationTimestamp(TIMESTAMP_FORMATTER.parseMillis(diskTypePb.getCreationTimestamp()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ public static class Builder extends ImageInfo.Builder {
}

@Override
Builder id(String id) {
infoBuilder.id(id);
Builder generatedId(String generatedId) {
infoBuilder.generatedId(generatedId);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,11 @@ public ImageId sourceImage() {
}

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

0 comments on commit 88fea35

Please sign in to comment.