diff --git a/README.md b/README.md
index 0a0d208b028c..3bc2219ab2bd 100644
--- a/README.md
+++ b/README.md
@@ -222,7 +222,7 @@ if (disk != null) {
String snapshotName = "disk-name-snapshot";
Operation operation = disk.createSnapshot(snapshotName);
operation = operation.waitFor();
- if (operation.errors() == null) {
+ if (operation.getErrors() == null) {
// use snapshot
Snapshot snapshot = compute.getSnapshot(snapshotName);
}
@@ -252,7 +252,7 @@ MachineTypeId machineTypeId = MachineTypeId.of("us-central1-a", "n1-standard-1")
Operation operation =
compute.create(InstanceInfo.of(instanceId, machineTypeId, attachedDisk, networkInterface));
operation = operation.waitFor();
-if (operation.errors() == null) {
+if (operation.getErrors() == null) {
// use instance
Instance instance = compute.getInstance(instanceId);
}
diff --git a/google-cloud-compute/README.md b/google-cloud-compute/README.md
index 85385f819c8d..395f22936b0c 100644
--- a/google-cloud-compute/README.md
+++ b/google-cloud-compute/README.md
@@ -119,7 +119,7 @@ operation = operation.waitFor();
if (operation.errors() == null) {
System.out.println("Address " + addressId + " was successfully created");
} else {
- // inspect operation.errors()
+ // inspect operation.getErrors()
throw new RuntimeException("Address creation failed");
}
```
@@ -150,7 +150,7 @@ DiskInfo disk = DiskInfo.of(diskId, diskConfiguration);
Operation operation = compute.create(disk);
// Wait for operation to complete
operation = operation.waitFor();
-if (operation.errors() == null) {
+if (operation.getErrors() == null) {
System.out.println("Disk " + diskId + " was successfully created");
} else {
// inspect operation.errors()
@@ -185,10 +185,10 @@ Address externalIp = compute.getAddress(addressId);
InstanceId instanceId = InstanceId.of("us-central1-a", "test-instance");
NetworkId networkId = NetworkId.of("default");
PersistentDiskConfiguration attachConfiguration =
- PersistentDiskConfiguration.builder(diskId).boot(true).build();
+ PersistentDiskConfiguration.newBuilder(diskId).setBoot(true).build();
AttachedDisk attachedDisk = AttachedDisk.of("dev0", attachConfiguration);
-NetworkInterface networkInterface = NetworkInterface.builder(networkId)
- .accessConfigurations(AccessConfig.of(externalIp.address()))
+NetworkInterface networkInterface = NetworkInterface.newBuilder(networkId)
+ .setAccessConfigurations(AccessConfig.of(externalIp.getAddress()))
.build();
MachineTypeId machineTypeId = MachineTypeId.of("us-central1-a", "n1-standard-1");
InstanceInfo instance =
@@ -196,7 +196,7 @@ InstanceInfo instance =
Operation operation = compute.create(instance);
// Wait for operation to complete
operation = operation.waitFor();
-if (operation.errors() == null) {
+if (operation.getErrors() == null) {
System.out.println("Instance " + instanceId + " was successfully created");
} else {
// inspect operation.errors()
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/Address.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/Address.java
index 10e99cadb60f..1c40e44dcd26 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/Address.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/Address.java
@@ -56,7 +56,7 @@ public static class Builder extends AddressInfo.Builder {
Builder(Compute compute, AddressId addressId) {
this.compute = compute;
this.infoBuilder = new AddressInfo.BuilderImpl();
- this.infoBuilder.addressId(addressId);
+ this.infoBuilder.setAddressId(addressId);
}
Builder(Address address) {
@@ -65,44 +65,62 @@ public static class Builder extends AddressInfo.Builder {
}
@Override
+ @Deprecated
public Builder address(String address) {
- infoBuilder.address(address);
+ return setAddress(address);
+ }
+
+ @Override
+ public Builder setAddress(String address) {
+ infoBuilder.setAddress(address);
return this;
}
@Override
- Builder creationTimestamp(Long creationTimestamp) {
- infoBuilder.creationTimestamp(creationTimestamp);
+ Builder setCreationTimestamp(Long creationTimestamp) {
+ infoBuilder.setCreationTimestamp(creationTimestamp);
return this;
}
@Override
+ @Deprecated
public Builder description(String description) {
- infoBuilder.description(description);
+ return setDescription(description);
+ }
+
+ @Override
+ public Builder setDescription(String description) {
+ infoBuilder.setDescription(description);
return this;
}
@Override
- Builder generatedId(String generatedId) {
- infoBuilder.generatedId(generatedId);
+ Builder setGeneratedId(String generatedId) {
+ infoBuilder.setGeneratedId(generatedId);
return this;
}
@Override
+ @Deprecated
public Builder addressId(AddressId addressId) {
- infoBuilder.addressId(addressId);
+ return setAddressId(addressId);
+ }
+
+ @Override
+ public Builder setAddressId(AddressId addressId) {
+ infoBuilder.setAddressId(addressId);
return this;
}
@Override
- Builder status(Status status) {
- infoBuilder.status(status);
+ Builder setStatus(Status status) {
+ infoBuilder.setStatus(status);
return this;
}
@Override
- Builder usage(Usage usage) {
- infoBuilder.usage(usage);
+ Builder setUsage(Usage usage) {
+ infoBuilder.setUsage(usage);
return this;
}
@@ -137,7 +155,7 @@ public boolean exists() {
* @throws ComputeException upon failure
*/
public Address reload(AddressOption... options) {
- return compute.getAddress(addressId(), options);
+ return compute.getAddress(getAddressId(), options);
}
/**
@@ -148,13 +166,21 @@ public Address reload(AddressOption... options) {
* @throws ComputeException upon failure
*/
public Operation delete(OperationOption... options) {
- return compute.deleteAddress(addressId(), options);
+ return compute.deleteAddress(getAddressId(), options);
}
/**
* Returns the address's {@code Compute} object used to issue requests.
*/
+ @Deprecated
public Compute compute() {
+ return getCompute();
+ }
+
+ /**
+ * Returns the address's {@code Compute} object used to issue requests.
+ */
+ public Compute getCompute() {
return compute;
}
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/AddressId.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/AddressId.java
index e5440e6f6d34..756955bb1065 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/AddressId.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/AddressId.java
@@ -54,8 +54,14 @@ enum Type {
/**
* Returns the type of this address identity.
*/
+ @Deprecated
public abstract Type type();
+ /**
+ * Returns the type of this address identity.
+ */
+ public abstract Type getType();
+
/**
* Returns the name of the address resource. The name must be 1-63 characters long and comply with
* RFC1035. Specifically, the name must match the regular expression
@@ -65,7 +71,21 @@ enum Type {
*
* @see RFC1035
*/
+ @Deprecated
public String address() {
+ return getAddress();
+ }
+
+ /**
+ * Returns the name of the address resource. The name must be 1-63 characters long and comply with
+ * RFC1035. Specifically, the name must match the regular expression
+ * {@code [a-z]([-a-z0-9]*[a-z0-9])?} which means the first character must be a lowercase letter,
+ * and all following characters must be a dash, lowercase letter, or digit, except the last
+ * character, which cannot be a dash.
+ *
+ * @see RFC1035
+ */
+ public String getAddress() {
return address;
}
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/AddressInfo.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/AddressInfo.java
index 9a95c77119c8..b0f6e2716d3c 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/AddressInfo.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/AddressInfo.java
@@ -106,17 +106,23 @@ public abstract static class Usage implements Serializable {
/**
* Returns the identities of resources currently using this address.
*/
+ @Deprecated
public abstract List extends ResourceId> users();
+ /**
+ * Returns the identities of resources currently using this address.
+ */
+ public abstract List extends ResourceId> getUsers();
+
final boolean baseEquals(Usage usage) {
return Objects.equals(toPb(), usage.toPb());
}
Address toPb() {
- return new Address().setUsers(Lists.transform(users(), new Function() {
+ return new Address().setUsers(Lists.transform(getUsers(), new Function() {
@Override
public String apply(ResourceId resourceId) {
- return resourceId.selfLink();
+ return resourceId.getSelfLink();
}
}));
}
@@ -153,12 +159,26 @@ public static final class InstanceUsage extends Usage {
/**
* Returns the identity of the instance using the address.
*/
+ @Deprecated
public InstanceId instance() {
+ return getInstance();
+ }
+
+ /**
+ * Returns the identity of the instance using the address.
+ */
+ public InstanceId getInstance() {
return instance;
}
@Override
+ @Deprecated
public List users() {
+ return getUsers();
+ }
+
+ @Override
+ public List getUsers() {
return ImmutableList.of(instance);
}
@@ -200,12 +220,26 @@ public static final class RegionForwardingUsage extends Usage {
/**
* Returns a list of identities of region forwarding rules that are currently using the address.
*/
+ @Deprecated
public List forwardingRules() {
+ return getForwardingRules();
+ }
+
+ /**
+ * Returns a list of identities of region forwarding rules that are currently using the address.
+ */
+ public List getForwardingRules() {
return forwardingRules;
}
@Override
+ @Deprecated
public List users() {
+ return getUsers();
+ }
+
+ @Override
+ public List getUsers() {
return forwardingRules;
}
@@ -248,12 +282,26 @@ public static final class GlobalForwardingUsage extends Usage {
/**
* Returns a list of identities of global forwarding rules that are currently using the address.
*/
+ @Deprecated
public List forwardingRules() {
+ return getForwardingRules();
+ }
+
+ /**
+ * Returns a list of identities of global forwarding rules that are currently using the address.
+ */
+ public List getForwardingRules() {
return forwardingRules;
}
@Override
+ @Deprecated
public List users() {
+ return getUsers();
+ }
+
+ @Override
+ public List getUsers() {
return forwardingRules;
}
@@ -287,22 +335,37 @@ public abstract static class Builder {
/**
* Sets the actual IP address.
*/
+ @Deprecated
public abstract Builder address(String address);
- abstract Builder creationTimestamp(Long creationTimestamp);
+ /**
+ * Sets the actual IP address.
+ */
+ public abstract Builder setAddress(String address);
+
+ abstract Builder setCreationTimestamp(Long creationTimestamp);
/**
* Sets an optional textual description of the address.
*/
+ @Deprecated
public abstract Builder description(String description);
- abstract Builder generatedId(String generatedId);
+ /**
+ * Sets an optional textual description of the address.
+ */
+ public abstract Builder setDescription(String description);
+
+ abstract Builder setGeneratedId(String generatedId);
+ @Deprecated
public abstract Builder addressId(AddressId addressId);
- abstract Builder status(Status status);
+ public abstract Builder setAddressId(AddressId addressId);
- abstract Builder usage(Usage usage);
+ abstract Builder setStatus(Status status);
+
+ abstract Builder setUsage(Usage usage);
/**
* Creates an {@code AddressInfo} object.
@@ -355,43 +418,61 @@ static final class BuilderImpl extends Builder {
}
@Override
+ @Deprecated
public BuilderImpl address(String address) {
+ return setAddress(address);
+ }
+
+ @Override
+ public BuilderImpl setAddress(String address) {
this.address = address;
return this;
}
@Override
- BuilderImpl creationTimestamp(Long creationTimestamp) {
+ BuilderImpl setCreationTimestamp(Long creationTimestamp) {
this.creationTimestamp = creationTimestamp;
return this;
}
@Override
+ @Deprecated
public BuilderImpl description(String description) {
+ return setDescription(description);
+ }
+
+ @Override
+ public BuilderImpl setDescription(String description) {
this.description = description;
return this;
}
@Override
- BuilderImpl generatedId(String generatedId) {
+ BuilderImpl setGeneratedId(String generatedId) {
this.generatedId = generatedId;
return this;
}
@Override
+ @Deprecated
public BuilderImpl addressId(AddressId addressId) {
+ return setAddressId(addressId);
+ }
+
+ @Override
+ public BuilderImpl setAddressId(AddressId addressId) {
this.addressId = checkNotNull(addressId);
return this;
}
@Override
- BuilderImpl status(Status status) {
+ BuilderImpl setStatus(Status status) {
this.status = status;
return this;
}
@Override
- BuilderImpl usage(Usage usage) {
+ BuilderImpl setUsage(Usage usage) {
this.usage = usage;
return this;
}
@@ -415,28 +496,60 @@ public AddressInfo build() {
/**
* Returns the static external IP address represented by this object.
*/
+ @Deprecated
public String address() {
+ return getAddress();
+ }
+
+ /**
+ * Returns the static external IP address represented by this object.
+ */
+ public String getAddress() {
return address;
}
/**
* Returns the creation timestamp in milliseconds since epoch.
*/
+ @Deprecated
public Long creationTimestamp() {
+ return getCreationTimestamp();
+ }
+
+ /**
+ * Returns the creation timestamp in milliseconds since epoch.
+ */
+ public Long getCreationTimestamp() {
return creationTimestamp;
}
/**
* Returns an optional textual description of the address.
*/
+ @Deprecated
public String description() {
+ return getDescription();
+ }
+
+ /**
+ * Returns an optional textual description of the address.
+ */
+ public String getDescription() {
return description;
}
/**
* Returns the service-generated unique identifier for the address.
*/
+ @Deprecated
public String generatedId() {
+ return getGeneratedId();
+ }
+
+ /**
+ * Returns the service-generated unique identifier for the address.
+ */
+ public String getGeneratedId() {
return generatedId;
}
@@ -445,14 +558,32 @@ public String generatedId() {
* {@link RegionAddressId} for a region address.
*/
@SuppressWarnings("unchecked")
+ @Deprecated
public T addressId() {
+ return getAddressId();
+ }
+
+ /**
+ * Returns the address identity. Returns {@link GlobalAddressId} for a global address, returns
+ * {@link RegionAddressId} for a region address.
+ */
+ @SuppressWarnings("unchecked")
+ public T getAddressId() {
return (T) addressId;
}
/**
* Returns the status of the address.
*/
+ @Deprecated
public Status status() {
+ return getStatus();
+ }
+
+ /**
+ * Returns the status of the address.
+ */
+ public Status getStatus() {
return status;
}
@@ -464,7 +595,20 @@ public Status status() {
* Returns {@code null} if the address is not in use.
*/
@SuppressWarnings("unchecked")
+ @Deprecated
public T usage() {
+ return getUsage();
+ }
+
+ /**
+ * Returns the usage information of the address. Returns an {@link InstanceUsage} object for
+ * region addresses that are assigned to VM instances. Returns a {@link RegionForwardingUsage}
+ * object for region addresses assigned to region forwarding rules. Returns a
+ * {@link GlobalForwardingUsage} object for global addresses assigned to global forwarding rules.
+ * Returns {@code null} if the address is not in use.
+ */
+ @SuppressWarnings("unchecked")
+ public T getUsage() {
return (T) usage;
}
@@ -503,10 +647,10 @@ public boolean equals(Object obj) {
}
AddressInfo setProjectId(String projectId) {
- if (addressId().project() != null) {
+ if (getAddressId().getProject() != null) {
return this;
}
- return toBuilder().addressId(addressId.setProjectId(projectId)).build();
+ return toBuilder().setAddressId(addressId.setProjectId(projectId)).build();
}
Address toPb() {
@@ -519,29 +663,37 @@ Address toPb() {
if (generatedId != null) {
addressPb.setId(new BigInteger(generatedId));
}
- addressPb.setName(addressId.address());
- if (addressId.type() == AddressId.Type.REGION) {
- addressPb.setRegion(this.addressId().regionId().selfLink());
+ addressPb.setName(addressId.getAddress());
+ if (addressId.getType() == AddressId.Type.REGION) {
+ addressPb.setRegion(this.getAddressId().getRegionId().getSelfLink());
}
if (status != null) {
addressPb.setStatus(status.name());
}
- addressPb.setSelfLink(addressId.selfLink());
+ addressPb.setSelfLink(addressId.getSelfLink());
return addressPb;
}
/**
* Returns a builder for the {@code AddressInfo} object given it's identity.
*/
+ @Deprecated
public static Builder builder(AddressId addressId) {
- return new BuilderImpl().addressId(addressId);
+ return newBuilder(addressId);
+ }
+
+ /**
+ * Returns a builder for the {@code AddressInfo} object given it's identity.
+ */
+ public static Builder newBuilder(AddressId addressId) {
+ return new BuilderImpl().setAddressId(addressId);
}
/**
* Returns an {@code AddressInfo} object for the provided identity.
*/
public static AddressInfo of(AddressId addressId) {
- return builder(addressId).build();
+ return newBuilder(addressId).build();
}
/**
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/AttachedDisk.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/AttachedDisk.java
index d4ad674a8a5e..fc4d0181bed0 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/AttachedDisk.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/AttachedDisk.java
@@ -114,7 +114,15 @@ public enum InterfaceType {
/**
* Returns the type of the attached disk.
*/
+ @Deprecated
public Type type() {
+ return getType();
+ }
+
+ /**
+ * Returns the type of the attached disk.
+ */
+ public Type getType() {
return type;
}
@@ -122,7 +130,16 @@ public Type type() {
* Returns the interface to use to attach the disk. If not specified, {@link InterfaceType#SCSI}
* is used.
*/
+ @Deprecated
public InterfaceType interfaceType() {
+ return getInterfaceType();
+ }
+
+ /**
+ * Returns the interface to use to attach the disk. If not specified, {@link InterfaceType#SCSI}
+ * is used.
+ */
+ public InterfaceType getInterfaceType() {
return interfaceType;
}
@@ -246,7 +263,15 @@ private Builder(PersistentDiskConfiguration configuration) {
/**
* Sets the identity of the persistent disk to be attached.
*/
+ @Deprecated
public Builder sourceDisk(DiskId sourceDisk) {
+ return setSourceDisk(sourceDisk);
+ }
+
+ /**
+ * Sets the identity of the persistent disk to be attached.
+ */
+ public Builder setSourceDisk(DiskId sourceDisk) {
this.sourceDisk = checkNotNull(sourceDisk);
return this;
}
@@ -255,7 +280,16 @@ public Builder sourceDisk(DiskId sourceDisk) {
* Sets the mode in which to attach this disk. If not specified, the disk is attached in
* {@link Mode#READ_WRITE} mode.
*/
+ @Deprecated
public Builder mode(Mode mode) {
+ return setMode(mode);
+ }
+
+ /**
+ * Sets the mode in which to attach this disk. If not specified, the disk is attached in
+ * {@link Mode#READ_WRITE} mode.
+ */
+ public Builder setMode(Mode mode) {
this.mode = mode;
return this;
}
@@ -265,7 +299,17 @@ public Builder mode(Mode mode) {
* instance will use the first partition of the disk for its root filesystem. If not
* specified, the isk is not used as a boot disk.
*/
+ @Deprecated
public Builder boot(boolean boot) {
+ return setBoot(boot);
+ }
+
+ /**
+ * Sets whether to use the attached disk as a boot disk. If {@code true} the virtual machine
+ * instance will use the first partition of the disk for its root filesystem. If not
+ * specified, the isk is not used as a boot disk.
+ */
+ public Builder setBoot(boolean boot) {
this.boot = boot;
return this;
}
@@ -274,7 +318,16 @@ public Builder boot(boolean boot) {
* Sets whether the disk should auto-delete when the instance to which it's attached is
* deleted. If not specified, the disk is not deleted automatically.
*/
+ @Deprecated
public Builder autoDelete(boolean autoDelete) {
+ return setAutoDelete(autoDelete);
+ }
+
+ /**
+ * Sets whether the disk should auto-delete when the instance to which it's attached is
+ * deleted. If not specified, the disk is not deleted automatically.
+ */
+ public Builder setAutoDelete(boolean autoDelete) {
this.autoDelete = autoDelete;
return this;
}
@@ -296,7 +349,15 @@ private PersistentDiskConfiguration(Builder builder) {
/**
* Returns the identity of the persistent disk to be attached.
*/
+ @Deprecated
public DiskId sourceDisk() {
+ return getSourceDisk();
+ }
+
+ /**
+ * Returns the identity of the persistent disk to be attached.
+ */
+ public DiskId getSourceDisk() {
return sourceDisk;
}
@@ -304,7 +365,16 @@ public DiskId sourceDisk() {
* Returns the mode in which to attach this disk. If not specified, the disk is attached in
* {@link Mode#READ_WRITE} mode.
*/
+ @Deprecated
public Mode mode() {
+ return getMode();
+ }
+
+ /**
+ * Returns the mode in which to attach this disk. If not specified, the disk is attached in
+ * {@link Mode#READ_WRITE} mode.
+ */
+ public Mode getMode() {
return mode;
}
@@ -335,16 +405,16 @@ public boolean equals(Object obj) {
@Override
PersistentDiskConfiguration setProjectId(String projectId) {
- if (sourceDisk.project() != null) {
+ if (sourceDisk.getProject() != null) {
return this;
}
- return toBuilder().sourceDisk(sourceDisk.setProjectId(projectId)).build();
+ return toBuilder().setSourceDisk(sourceDisk.setProjectId(projectId)).build();
}
@Override
com.google.api.services.compute.model.AttachedDisk toPb() {
com.google.api.services.compute.model.AttachedDisk attachedDiskPb = super.toPb();
- attachedDiskPb.setSource(sourceDisk.selfLink());
+ attachedDiskPb.setSource(sourceDisk.getSelfLink());
attachedDiskPb.setMode(mode != null ? mode.toString() : null);
return attachedDiskPb;
}
@@ -353,7 +423,16 @@ com.google.api.services.compute.model.AttachedDisk toPb() {
* Returns a builder for a {@code PersistentDiskConfiguration} object given the identity of the
* persistent disk to attach.
*/
+ @Deprecated
public static Builder builder(DiskId sourceDisk) {
+ return newBuilder(sourceDisk);
+ }
+
+ /**
+ * Returns a builder for a {@code PersistentDiskConfiguration} object given the identity of the
+ * persistent disk to attach.
+ */
+ public static Builder newBuilder(DiskId sourceDisk) {
return new Builder(sourceDisk);
}
@@ -362,7 +441,7 @@ public static Builder builder(DiskId sourceDisk) {
* disk to attach.
*/
public static PersistentDiskConfiguration of(DiskId sourceDisk) {
- return builder(sourceDisk).build();
+ return newBuilder(sourceDisk).build();
}
@SuppressWarnings("unchecked")
@@ -370,13 +449,13 @@ static PersistentDiskConfiguration fromPb(
com.google.api.services.compute.model.AttachedDisk diskPb) {
Builder builder = new Builder(DiskId.fromUrl(diskPb.getSource()));
if (diskPb.getMode() != null) {
- builder.mode(Mode.valueOf(diskPb.getMode()));
+ builder.setMode(Mode.valueOf(diskPb.getMode()));
}
if (diskPb.getBoot() != null) {
- builder.boot(diskPb.getBoot());
+ builder.setBoot(diskPb.getBoot());
}
if (diskPb.getAutoDelete() != null) {
- builder.autoDelete(diskPb.getAutoDelete());
+ builder.setAutoDelete(diskPb.getAutoDelete());
}
return builder.build();
}
@@ -425,7 +504,16 @@ private Builder(CreateDiskConfiguration configuration) {
* Sets the name to be assigned to the disk. If not specified, the disk is given the
* instance's name.
*/
+ @Deprecated
public Builder diskName(String diskName) {
+ return setDiskName(diskName);
+ }
+
+ /**
+ * Sets the name to be assigned to the disk. If not specified, the disk is given the
+ * instance's name.
+ */
+ public Builder setDiskName(String diskName) {
this.diskName = diskName;
return this;
}
@@ -433,7 +521,15 @@ public Builder diskName(String diskName) {
/**
* Sets the identity of the disk type. If not specified, {@code pd-standard} is used.
*/
+ @Deprecated
public Builder diskType(DiskTypeId diskType) {
+ return setDiskType(diskType);
+ }
+
+ /**
+ * Sets the identity of the disk type. If not specified, {@code pd-standard} is used.
+ */
+ public Builder setDiskType(DiskTypeId diskType) {
this.diskType = diskType;
return this;
}
@@ -443,7 +539,17 @@ public Builder diskType(DiskTypeId diskType) {
* source image. This value can be larger than the image's size. If the provided size is
* smaller than the image's size, then instance creation will fail.
*/
+ @Deprecated
public Builder diskSizeGb(Long diskSizeGb) {
+ return setDiskSizeGb(diskSizeGb);
+ }
+
+ /**
+ * Sets the size of the persistent disk, in GB. If not set the disk will have the size of the
+ * source image. This value can be larger than the image's size. If the provided size is
+ * smaller than the image's size, then instance creation will fail.
+ */
+ public Builder setDiskSizeGb(Long diskSizeGb) {
this.diskSizeGb = diskSizeGb;
return this;
}
@@ -451,7 +557,15 @@ public Builder diskSizeGb(Long diskSizeGb) {
/**
* Sets the identity of the source image used to create the disk.
*/
+ @Deprecated
public Builder sourceImage(ImageId sourceImage) {
+ return setSourceImage(sourceImage);
+ }
+
+ /**
+ * Sets the identity of the source image used to create the disk.
+ */
+ public Builder setSourceImage(ImageId sourceImage) {
this.sourceImage = checkNotNull(sourceImage);
return this;
}
@@ -460,7 +574,16 @@ public Builder sourceImage(ImageId sourceImage) {
* Sets whether the disk should auto-delete when the instance to which it's attached is
* deleted. If not specified, the disk is not deleted automatically.
*/
+ @Deprecated
public Builder autoDelete(Boolean autoDelete) {
+ return setAutoDelete(autoDelete);
+ }
+
+ /**
+ * Sets whether the disk should auto-delete when the instance to which it's attached is
+ * deleted. If not specified, the disk is not deleted automatically.
+ */
+ public Builder setAutoDelete(Boolean autoDelete) {
this.autoDelete = autoDelete;
return this;
}
@@ -485,14 +608,31 @@ private CreateDiskConfiguration(Builder builder) {
* Returns the name to be assigned to the disk. If not specified, the disk is given the
* instance's name.
*/
+ @Deprecated
public String diskName() {
+ return getDiskName();
+ }
+
+ /**
+ * Returns the name to be assigned to the disk. If not specified, the disk is given the
+ * instance's name.
+ */
+ public String getDiskName() {
return diskName;
}
/**
* Returns the identity of the disk type. If not specified, {@code pd-standard} is used.
*/
+ @Deprecated
public DiskTypeId diskType() {
+ return getDiskType();
+ }
+
+ /**
+ * Returns the identity of the disk type. If not specified, {@code pd-standard} is used.
+ */
+ public DiskTypeId getDiskType() {
return diskType;
}
@@ -501,14 +641,32 @@ public DiskTypeId diskType() {
* source image. This value can be larger than the image's size. If the provided size is smaller
* than the image's size then instance creation will fail.
*/
+ @Deprecated
public Long diskSizeGb() {
+ return getDiskSizeGb();
+ }
+
+ /**
+ * Returns the size of the persistent disk, in GB. If not set the disk will have the size of the
+ * source image. This value can be larger than the image's size. If the provided size is smaller
+ * than the image's size then instance creation will fail.
+ */
+ public Long getDiskSizeGb() {
return diskSizeGb;
}
/**
* Returns the identity of the source image used to create the disk.
*/
+ @Deprecated
public ImageId sourceImage() {
+ return getSourceImage();
+ }
+
+ /**
+ * Returns the identity of the source image used to create the disk.
+ */
+ public ImageId getSourceImage() {
return sourceImage;
}
@@ -545,10 +703,10 @@ public boolean equals(Object obj) {
CreateDiskConfiguration setProjectId(String projectId) {
Builder builder = toBuilder();
if (builder.diskType != null) {
- builder.diskType(diskType.setProjectId(projectId));
+ builder.setDiskType(diskType.setProjectId(projectId));
}
if (builder.sourceImage != null) {
- builder.sourceImage(sourceImage.setProjectId(projectId));
+ builder.setSourceImage(sourceImage.setProjectId(projectId));
}
return builder.build();
}
@@ -558,9 +716,9 @@ com.google.api.services.compute.model.AttachedDisk toPb() {
AttachedDiskInitializeParams initializeParamsPb = new AttachedDiskInitializeParams();
initializeParamsPb.setDiskName(diskName);
initializeParamsPb.setDiskSizeGb(diskSizeGb);
- initializeParamsPb.setSourceImage(sourceImage.selfLink());
+ initializeParamsPb.setSourceImage(sourceImage.getSelfLink());
if (diskType != null) {
- initializeParamsPb.setDiskType(diskType.selfLink());
+ initializeParamsPb.setDiskType(diskType.getSelfLink());
}
com.google.api.services.compute.model.AttachedDisk attachedDiskPb = super.toPb();
attachedDiskPb.setInitializeParams(initializeParamsPb);
@@ -571,7 +729,16 @@ com.google.api.services.compute.model.AttachedDisk toPb() {
* Returns a builder for a {@code CreateDiskConfiguration} object given the source image that
* will be used to create the disk.
*/
+ @Deprecated
public static Builder builder(ImageId sourceImage) {
+ return newBuilder(sourceImage);
+ }
+
+ /**
+ * Returns a builder for a {@code CreateDiskConfiguration} object given the source image that
+ * will be used to create the disk.
+ */
+ public static Builder newBuilder(ImageId sourceImage) {
return new Builder(sourceImage);
}
@@ -580,22 +747,22 @@ public static Builder builder(ImageId sourceImage) {
* create the disk.
*/
public static CreateDiskConfiguration of(ImageId sourceImage) {
- return builder(sourceImage).build();
+ return newBuilder(sourceImage).build();
}
@SuppressWarnings("unchecked")
static CreateDiskConfiguration fromPb(
com.google.api.services.compute.model.AttachedDisk diskPb) {
AttachedDiskInitializeParams initializeParamsPb = diskPb.getInitializeParams();
- Builder builder = builder(ImageId.fromUrl(initializeParamsPb.getSourceImage()));
+ Builder builder = newBuilder(ImageId.fromUrl(initializeParamsPb.getSourceImage()));
if (initializeParamsPb.getDiskType() != null) {
- builder.diskType(DiskTypeId.fromUrl(initializeParamsPb.getDiskType()));
+ builder.setDiskType(DiskTypeId.fromUrl(initializeParamsPb.getDiskType()));
}
- builder.diskName(initializeParamsPb.getDiskName());
- builder.diskSizeGb(initializeParamsPb.getDiskSizeGb());
- builder.autoDelete(diskPb.getAutoDelete());
+ builder.setDiskName(initializeParamsPb.getDiskName());
+ builder.setDiskSizeGb(initializeParamsPb.getDiskSizeGb());
+ builder.setAutoDelete(diskPb.getAutoDelete());
if (initializeParamsPb.getDiskType() != null) {
- builder.diskType(DiskTypeId.fromUrl(initializeParamsPb.getDiskType()));
+ builder.setDiskType(DiskTypeId.fromUrl(initializeParamsPb.getDiskType()));
}
return builder.build();
}
@@ -623,13 +790,21 @@ private Builder() {}
private Builder(ScratchDiskConfiguration configuration) {
this.diskType = configuration.diskType;
- this.interfaceType = configuration.interfaceType();
+ this.interfaceType = configuration.getInterfaceType();
}
/**
* Sets the identity of the disk type for the scratch disk to attach.
*/
+ @Deprecated
public Builder diskType(DiskTypeId diskType) {
+ return setDiskType(diskType);
+ }
+
+ /**
+ * Sets the identity of the disk type for the scratch disk to attach.
+ */
+ public Builder setDiskType(DiskTypeId diskType) {
this.diskType = diskType;
return this;
}
@@ -637,7 +812,15 @@ public Builder diskType(DiskTypeId diskType) {
/**
* Sets the interface type. If not specified, {@code SCSI} is used.
*/
+ @Deprecated
public Builder interfaceType(InterfaceType interfaceType) {
+ return setInterfaceType(interfaceType);
+ }
+
+ /**
+ * Sets the interface type. If not specified, {@code SCSI} is used.
+ */
+ public Builder setInterfaceType(InterfaceType interfaceType) {
this.interfaceType = interfaceType;
return this;
}
@@ -658,10 +841,18 @@ private ScratchDiskConfiguration(Builder builder) {
/**
* Returns the identity of the disk type for the scratch disk to attach.
*/
+ @Deprecated
public DiskTypeId diskType() {
return diskType;
}
+ /**
+ * Returns the identity of the disk type for the scratch disk to attach.
+ */
+ public DiskTypeId getDiskType() {
+ return diskType;
+ }
+
/**
* Returns a builder for the current configuration.
*/
@@ -689,10 +880,10 @@ public boolean equals(Object obj) {
@Override
ScratchDiskConfiguration setProjectId(String projectId) {
- if (diskType.project() != null) {
+ if (diskType.getProject() != null) {
return this;
}
- return toBuilder().diskType(diskType.setProjectId(projectId)).build();
+ return toBuilder().setDiskType(diskType.setProjectId(projectId)).build();
}
@Override
@@ -700,7 +891,7 @@ com.google.api.services.compute.model.AttachedDisk toPb() {
com.google.api.services.compute.model.AttachedDisk attachedDiskPb = super.toPb();
if (diskType != null) {
AttachedDiskInitializeParams initializeParamsPb = new AttachedDiskInitializeParams();
- initializeParamsPb.setDiskType(diskType.selfLink());
+ initializeParamsPb.setDiskType(diskType.getSelfLink());
attachedDiskPb.setInitializeParams(initializeParamsPb);
}
return attachedDiskPb;
@@ -709,8 +900,16 @@ com.google.api.services.compute.model.AttachedDisk toPb() {
/**
* Returns a builder for {@code ScratchDiskConfiguration} objects given the disk type identity.
*/
+ @Deprecated
public static Builder builder(DiskTypeId diskType) {
- return new Builder().diskType(diskType);
+ return newBuilder(diskType);
+ }
+
+ /**
+ * Returns a builder for {@code ScratchDiskConfiguration} objects given the disk type identity.
+ */
+ public static Builder newBuilder(DiskTypeId diskType) {
+ return new Builder().setDiskType(diskType);
}
/**
@@ -718,7 +917,7 @@ public static Builder builder(DiskTypeId diskType) {
* be attached via the default interface ({@link InterfaceType#SCSI}).
*/
public static ScratchDiskConfiguration of(DiskTypeId diskType) {
- return builder(diskType).build();
+ return newBuilder(diskType).build();
}
@SuppressWarnings("unchecked")
@@ -726,11 +925,11 @@ static ScratchDiskConfiguration fromPb(
com.google.api.services.compute.model.AttachedDisk diskPb) {
Builder builder = new Builder();
if (diskPb.getInterface() != null) {
- builder.interfaceType(InterfaceType.valueOf(diskPb.getInterface()));
+ builder.setInterfaceType(InterfaceType.valueOf(diskPb.getInterface()));
}
if (diskPb.getInitializeParams() != null
&& diskPb.getInitializeParams().getDiskType() != null) {
- builder.diskType(DiskTypeId.fromUrl(diskPb.getInitializeParams().getDiskType()));
+ builder.setDiskType(DiskTypeId.fromUrl(diskPb.getInitializeParams().getDiskType()));
}
return builder.build();
}
@@ -765,7 +964,20 @@ public static final class Builder {
* apply to this disk, in the form {@code persistent-disks-x}, where x is a number assigned by
* Google Compute Engine.
*/
+ @Deprecated
public Builder deviceName(String deviceName) {
+ return setDeviceName(deviceName);
+ }
+
+ /**
+ * Sets the unique device name of your choice that is reflected into the
+ * {@code /dev/disk/by-id/google-*} tree of a Linux operating system running within the
+ * instance. This name can be used to reference the device for mounting, resizing, and so on,
+ * from within the instance. If not specified, the service chooses a default device name to
+ * apply to this disk, in the form {@code persistent-disks-x}, where x is a number assigned by
+ * Google Compute Engine.
+ */
+ public Builder setDeviceName(String deviceName) {
this.deviceName = deviceName;
return this;
}
@@ -775,7 +987,17 @@ public Builder deviceName(String deviceName) {
* if you have many disks attached to an instance, each disk would have an unique index number.
* If not specified, the service will choose an appropriate value.
*/
+ @Deprecated
public Builder index(Integer index) {
+ return setIndex(index);
+ }
+
+ /**
+ * Sets a zero-based index to this disk, where 0 is reserved for the boot disk. For example,
+ * if you have many disks attached to an instance, each disk would have an unique index number.
+ * If not specified, the service will choose an appropriate value.
+ */
+ public Builder setIndex(Integer index) {
this.index = index;
return this;
}
@@ -786,12 +1008,23 @@ public Builder index(Integer index) {
* persistent disk to the instance. Use {@link CreateDiskConfiguration} to create and attach
* a new persistent disk.
*/
+ @Deprecated
public Builder configuration(AttachedDiskConfiguration configuration) {
+ return setConfiguration(configuration);
+ }
+
+ /**
+ * Sets the attached disk configuration. Use {@link ScratchDiskConfiguration} to attach a
+ * scratch disk to the instance. Use {@link PersistentDiskConfiguration} to attach a
+ * persistent disk to the instance. Use {@link CreateDiskConfiguration} to create and attach
+ * a new persistent disk.
+ */
+ public Builder setConfiguration(AttachedDiskConfiguration configuration) {
this.configuration = checkNotNull(configuration);
return this;
}
- Builder licenses(List licenses) {
+ Builder setLicenses(List licenses) {
this.licenses = licenses;
return this;
}
@@ -819,14 +1052,35 @@ private AttachedDisk(Builder builder) {
* apply to this disk, in the form {@code persistent-disks-x}, where x is a number assigned by
* Google Compute Engine.
*/
+ @Deprecated
public String deviceName() {
+ return getDeviceName();
+ }
+
+ /**
+ * Returns the unique device name of your choice that is reflected into the
+ * {@code /dev/disk/by-id/google-*} tree of a Linux operating system running within the
+ * instance. This name can be used to reference the device for mounting, resizing, and so on,
+ * from within the instance. If not specified, the service chooses a default device name to
+ * apply to this disk, in the form {@code persistent-disks-x}, where x is a number assigned by
+ * Google Compute Engine.
+ */
+ public String getDeviceName() {
return deviceName;
}
/**
* Returns a zero-based index to this disk, where 0 is reserved for the boot disk.
*/
+ @Deprecated
public Integer index() {
+ return getIndex();
+ }
+
+ /**
+ * Returns a zero-based index to this disk, where 0 is reserved for the boot disk.
+ */
+ public Integer getIndex() {
return index;
}
@@ -837,14 +1091,34 @@ public Integer index() {
* a new persistent disk.
*/
@SuppressWarnings("unchecked")
+ @Deprecated
public T configuration() {
+ return getConfiguration();
+ }
+
+ /**
+ * Returns the attached disk configuration. Returns {@link ScratchDiskConfiguration} to attach a
+ * scratch disk to the instance. Returns {@link PersistentDiskConfiguration} to attach a
+ * persistent disk to the instance. Returns {@link CreateDiskConfiguration} to create and attach
+ * a new persistent disk.
+ */
+ @SuppressWarnings("unchecked")
+ public T getConfiguration() {
return (T) configuration;
}
/**
* Returns a list of publicly accessible licenses for the attached disk.
*/
+ @Deprecated
public List licenses() {
+ return getLicenses();
+ }
+
+ /**
+ * Returns a list of publicly accessible licenses for the attached disk.
+ */
+ public List getLicenses() {
return licenses;
}
@@ -879,7 +1153,7 @@ public final boolean equals(Object obj) {
}
AttachedDisk setProjectId(String projectId) {
- return toBuilder().configuration(configuration.setProjectId(projectId)).build();
+ return toBuilder().setConfiguration(configuration.setProjectId(projectId)).build();
}
com.google.api.services.compute.model.AttachedDisk toPb() {
@@ -895,31 +1169,39 @@ com.google.api.services.compute.model.AttachedDisk toPb() {
/**
* Returns a builder for an {@code AttachedDisk} object given its configuration.
*/
+ @Deprecated
public static Builder builder(AttachedDiskConfiguration configuration) {
- return new Builder(configuration).configuration(configuration);
+ return newBuilder(configuration);
+ }
+
+ /**
+ * Returns a builder for an {@code AttachedDisk} object given its configuration.
+ */
+ public static Builder newBuilder(AttachedDiskConfiguration configuration) {
+ return new Builder(configuration);
}
/**
* Returns an {@code AttachedDisk} object given its configuration.
*/
public static AttachedDisk of(AttachedDiskConfiguration configuration) {
- return builder(configuration).build();
+ return newBuilder(configuration).build();
}
/**
* Returns an {@code AttachedDisk} object given the device name and its configuration.
*/
public static AttachedDisk of(String deviceName, AttachedDiskConfiguration configuration) {
- return builder(configuration).deviceName(deviceName).build();
+ return newBuilder(configuration).setDeviceName(deviceName).build();
}
static AttachedDisk fromPb(com.google.api.services.compute.model.AttachedDisk diskPb) {
AttachedDiskConfiguration configuration = AttachedDiskConfiguration.fromPb(diskPb);
- Builder builder = builder(configuration);
- builder.deviceName(diskPb.getDeviceName());
- builder.index(diskPb.getIndex());
+ Builder builder = newBuilder(configuration);
+ builder.setDeviceName(diskPb.getDeviceName());
+ builder.setIndex(diskPb.getIndex());
if (diskPb.getLicenses() != null) {
- builder.licenses(Lists.transform(diskPb.getLicenses(), LicenseId.FROM_URL_FUNCTION));
+ builder.setLicenses(Lists.transform(diskPb.getLicenses(), LicenseId.FROM_URL_FUNCTION));
}
return builder.build();
}
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/ComputeImpl.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/ComputeImpl.java
index 23501f93bcc6..637b47cc6ff6 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/ComputeImpl.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/ComputeImpl.java
@@ -469,7 +469,7 @@ public DiskType getDiskType(final DiskTypeId diskTypeId, DiskTypeOption... optio
runWithRetries(new Callable() {
@Override
public com.google.api.services.compute.model.DiskType call() {
- return computeRpc.getDiskType(diskTypeId.zone(), diskTypeId.type(), optionsMap);
+ return computeRpc.getDiskType(diskTypeId.getZone(), diskTypeId.getType(), optionsMap);
}
}, options().retryParams(), EXCEPTION_HANDLER, options().clock());
return answer == null ? null : DiskType.fromPb(answer);
@@ -557,7 +557,8 @@ public MachineType getMachineType(final MachineTypeId machineType, MachineTypeOp
runWithRetries(new Callable() {
@Override
public com.google.api.services.compute.model.MachineType call() {
- return computeRpc.getMachineType(machineType.zone(), machineType.type(), optionsMap);
+ return computeRpc.getMachineType(machineType.getZone(), machineType.getType(),
+ optionsMap);
}
}, options().retryParams(), EXCEPTION_HANDLER, options().clock());
return answer == null ? null : MachineType.fromPb(answer);
@@ -755,7 +756,8 @@ public License getLicense(LicenseId license, LicenseOption... options) {
runWithRetries(new Callable() {
@Override
public com.google.api.services.compute.model.License call() {
- return computeRpc.getLicense(completeId.project(), completeId.license(), optionsMap);
+ return computeRpc.getLicense(completeId.getProject(), completeId.getLicense(),
+ optionsMap);
}
}, options().retryParams(), EXCEPTION_HANDLER, options().clock());
return answer == null ? null : License.fromPb(answer);
@@ -772,17 +774,17 @@ public Operation getOperation(final OperationId operationId, OperationOption...
runWithRetries(new Callable() {
@Override
public com.google.api.services.compute.model.Operation call() {
- switch (operationId.type()) {
+ switch (operationId.getType()) {
case REGION:
RegionOperationId regionOperationId = (RegionOperationId) operationId;
- return computeRpc.getRegionOperation(regionOperationId.region(),
- regionOperationId.operation(), optionsMap);
+ return computeRpc.getRegionOperation(regionOperationId.getRegion(),
+ regionOperationId.getOperation(), optionsMap);
case ZONE:
ZoneOperationId zoneOperationId = (ZoneOperationId) operationId;
- return computeRpc.getZoneOperation(zoneOperationId.zone(),
- zoneOperationId.operation(), optionsMap);
+ return computeRpc.getZoneOperation(zoneOperationId.getZone(),
+ zoneOperationId.getOperation(), optionsMap);
case GLOBAL:
- return computeRpc.getGlobalOperation(operationId.operation(), optionsMap);
+ return computeRpc.getGlobalOperation(operationId.getOperation(), optionsMap);
default:
throw new IllegalArgumentException("Unexpected operation identity type");
}
@@ -894,17 +896,17 @@ public boolean deleteOperation(final OperationId operation) {
return runWithRetries(new Callable() {
@Override
public Boolean call() {
- switch (operation.type()) {
+ switch (operation.getType()) {
case REGION:
RegionOperationId regionOperationId = (RegionOperationId) operation;
- return computeRpc.deleteRegionOperation(regionOperationId.region(),
- regionOperationId.operation());
+ return computeRpc.deleteRegionOperation(regionOperationId.getRegion(),
+ regionOperationId.getOperation());
case ZONE:
ZoneOperationId zoneOperationId = (ZoneOperationId) operation;
- return computeRpc.deleteZoneOperation(zoneOperationId.zone(),
- zoneOperationId.operation());
+ return computeRpc.deleteZoneOperation(zoneOperationId.getZone(),
+ zoneOperationId.getOperation());
case GLOBAL:
- return computeRpc.deleteGlobalOperation(operation.operation());
+ return computeRpc.deleteGlobalOperation(operation.getOperation());
default:
throw new IllegalArgumentException("Unexpected operation identity type");
}
@@ -923,13 +925,13 @@ public Address getAddress(final AddressId addressId, AddressOption... options) {
runWithRetries(new Callable() {
@Override
public com.google.api.services.compute.model.Address call() {
- switch (addressId.type()) {
+ switch (addressId.getType()) {
case REGION:
RegionAddressId regionAddressId = (RegionAddressId) addressId;
- return computeRpc.getRegionAddress(regionAddressId.region(),
- regionAddressId.address(), optionsMap);
+ return computeRpc.getRegionAddress(regionAddressId.getRegion(),
+ regionAddressId.getAddress(), optionsMap);
case GLOBAL:
- return computeRpc.getGlobalAddress(addressId.address(), optionsMap);
+ return computeRpc.getGlobalAddress(addressId.getAddress(), optionsMap);
default:
throw new IllegalArgumentException("Unexpected address identity type");
}
@@ -951,10 +953,10 @@ public Operation create(final AddressInfo address, OperationOption... options) {
runWithRetries(new Callable() {
@Override
public com.google.api.services.compute.model.Operation call() {
- switch (address.addressId().type()) {
+ switch (address.getAddressId().getType()) {
case REGION:
- RegionAddressId regionAddressId = address.addressId();
- return computeRpc.createRegionAddress(regionAddressId.region(), addressPb,
+ RegionAddressId regionAddressId = address.getAddressId();
+ return computeRpc.createRegionAddress(regionAddressId.getRegion(), addressPb,
optionsMap);
case GLOBAL:
return computeRpc.createGlobalAddress(addressPb, optionsMap);
@@ -1076,13 +1078,13 @@ public Operation deleteAddress(final AddressId addressId, OperationOption... opt
runWithRetries(new Callable() {
@Override
public com.google.api.services.compute.model.Operation call() {
- switch (addressId.type()) {
+ switch (addressId.getType()) {
case REGION:
RegionAddressId regionAddressId = (RegionAddressId) addressId;
- return computeRpc.deleteRegionAddress(regionAddressId.region(),
- regionAddressId.address(), optionsMap);
+ return computeRpc.deleteRegionAddress(regionAddressId.getRegion(),
+ regionAddressId.getAddress(), optionsMap);
case GLOBAL:
- return computeRpc.deleteGlobalAddress(addressId.address(), optionsMap);
+ return computeRpc.deleteGlobalAddress(addressId.getAddress(), optionsMap);
default:
throw new IllegalArgumentException("Unexpected address identity type");
}
@@ -1103,9 +1105,10 @@ public Operation create(SnapshotInfo snapshot, OperationOption... options) {
runWithRetries(new Callable() {
@Override
public com.google.api.services.compute.model.Operation call() {
- return computeRpc.createSnapshot(completeSnapshot.sourceDisk().zone(),
- completeSnapshot.sourceDisk().disk(), completeSnapshot.snapshotId().snapshot(),
- completeSnapshot.description(), optionsMap);
+ return computeRpc.createSnapshot(completeSnapshot.getSourceDisk().getZone(),
+ completeSnapshot.getSourceDisk().getDisk(),
+ completeSnapshot.getSnapshotId().getSnapshot(), completeSnapshot.getDescription(),
+ optionsMap);
}
}, options().retryParams(), EXCEPTION_HANDLER, options().clock());
return answer == null ? null : Operation.fromPb(this, answer);
@@ -1167,7 +1170,7 @@ public Snapshot apply(com.google.api.services.compute.model.Snapshot snapshot) {
@Override
public Operation deleteSnapshot(SnapshotId snapshot, OperationOption... options) {
- return deleteSnapshot(snapshot.snapshot(), options);
+ return deleteSnapshot(snapshot.getSnapshot(), options);
}
@Override
@@ -1214,7 +1217,7 @@ public Image getImage(ImageId imageId, ImageOption... options) {
runWithRetries(new Callable() {
@Override
public com.google.api.services.compute.model.Image call() {
- return computeRpc.getImage(completeImageId.project(), completeImageId.image(),
+ return computeRpc.getImage(completeImageId.getProject(), completeImageId.getImage(),
optionsMap);
}
}, options().retryParams(), EXCEPTION_HANDLER, options().clock());
@@ -1272,7 +1275,8 @@ public Operation deleteImage(ImageId image, OperationOption... options) {
runWithRetries(new Callable() {
@Override
public com.google.api.services.compute.model.Operation call() {
- return computeRpc.deleteImage(completeId.project(), completeId.image(), optionsMap);
+ return computeRpc.deleteImage(completeId.getProject(), completeId.getImage(),
+ optionsMap);
}
}, options().retryParams(), EXCEPTION_HANDLER, options().clock());
return answer == null ? null : Operation.fromPb(this, answer);
@@ -1291,7 +1295,7 @@ public Operation deprecate(ImageId image,
runWithRetries(new Callable() {
@Override
public com.google.api.services.compute.model.Operation call() {
- return computeRpc.deprecateImage(completeId.project(), completeId.image(),
+ return computeRpc.deprecateImage(completeId.getProject(), completeId.getImage(),
deprecationStatus.toPb(), optionsMap);
}
}, options().retryParams(), EXCEPTION_HANDLER, options().clock());
@@ -1309,7 +1313,7 @@ public Disk getDisk(final DiskId diskId, DiskOption... options) {
runWithRetries(new Callable() {
@Override
public com.google.api.services.compute.model.Disk call() {
- return computeRpc.getDisk(diskId.zone(), diskId.disk(), optionsMap);
+ return computeRpc.getDisk(diskId.getZone(), diskId.getDisk(), optionsMap);
}
}, options().retryParams(), EXCEPTION_HANDLER, options().clock());
return answer == null ? null : Disk.fromPb(this, answer);
@@ -1328,7 +1332,7 @@ public Operation create(final DiskInfo disk, OperationOption... options) {
runWithRetries(new Callable() {
@Override
public com.google.api.services.compute.model.Operation call() {
- return computeRpc.createDisk(disk.diskId().zone(), diskPb, optionsMap);
+ return computeRpc.createDisk(disk.getDiskId().getZone(), diskPb, optionsMap);
}
}, options().retryParams(), EXCEPTION_HANDLER, options().clock()));
} catch (RetryHelper.RetryHelperException e) {
@@ -1410,7 +1414,7 @@ public Operation deleteDisk(final DiskId disk, OperationOption... options) {
runWithRetries(new Callable() {
@Override
public com.google.api.services.compute.model.Operation call() {
- return computeRpc.deleteDisk(disk.zone(), disk.disk(), optionsMap);
+ return computeRpc.deleteDisk(disk.getZone(), disk.getDisk(), optionsMap);
}
}, options().retryParams(), EXCEPTION_HANDLER, options().clock());
return answer == null ? null : Operation.fromPb(this, answer);
@@ -1427,7 +1431,7 @@ public Operation resize(final DiskId disk, final long sizeGb, OperationOption...
runWithRetries(new Callable() {
@Override
public com.google.api.services.compute.model.Operation call() {
- return computeRpc.resizeDisk(disk.zone(), disk.disk(), sizeGb, optionsMap);
+ return computeRpc.resizeDisk(disk.getZone(), disk.getDisk(), sizeGb, optionsMap);
}
}, options().retryParams(), EXCEPTION_HANDLER, options().clock());
return answer == null ? null : Operation.fromPb(this, answer);
@@ -1444,7 +1448,7 @@ public Operation create(SubnetworkInfo subnetwork, OperationOption... options) {
runWithRetries(new Callable() {
@Override
public com.google.api.services.compute.model.Operation call() {
- return computeRpc.createSubnetwork(completeSubnetwork.subnetworkId().region(),
+ return computeRpc.createSubnetwork(completeSubnetwork.getSubnetworkId().getRegion(),
completeSubnetwork.toPb(), optionsMap);
}
}, options().retryParams(), EXCEPTION_HANDLER, options().clock());
@@ -1462,8 +1466,8 @@ public Subnetwork getSubnetwork(final SubnetworkId subnetworkId, SubnetworkOptio
runWithRetries(new Callable() {
@Override
public com.google.api.services.compute.model.Subnetwork call() {
- return computeRpc.getSubnetwork(subnetworkId.region(), subnetworkId.subnetwork(),
- optionsMap);
+ return computeRpc.getSubnetwork(subnetworkId.getRegion(),
+ subnetworkId.getSubnetwork(), optionsMap);
}
}, options().retryParams(), EXCEPTION_HANDLER, options().clock());
return answer == null ? null : Subnetwork.fromPb(this, answer);
@@ -1546,7 +1550,7 @@ public Operation deleteSubnetwork(final SubnetworkId subnetwork, OperationOption
runWithRetries(new Callable() {
@Override
public com.google.api.services.compute.model.Operation call() {
- return computeRpc.deleteSubnetwork(subnetwork.region(), subnetwork.subnetwork(),
+ return computeRpc.deleteSubnetwork(subnetwork.getRegion(), subnetwork.getSubnetwork(),
optionsMap);
}
}, options().retryParams(), EXCEPTION_HANDLER, options().clock());
@@ -1633,7 +1637,7 @@ public Operation deleteNetwork(final NetworkId network, OperationOption... optio
runWithRetries(new Callable() {
@Override
public com.google.api.services.compute.model.Operation call() {
- return computeRpc.deleteNetwork(network.network(), optionsMap);
+ return computeRpc.deleteNetwork(network.getNetwork(), optionsMap);
}
}, options().retryParams(), EXCEPTION_HANDLER, options().clock());
return answer == null ? null : Operation.fromPb(this, answer);
@@ -1656,7 +1660,7 @@ public Operation create(InstanceInfo instance, OperationOption... options) {
runWithRetries(new Callable() {
@Override
public com.google.api.services.compute.model.Operation call() {
- return computeRpc.createInstance(completeInstance.instanceId().zone(),
+ return computeRpc.createInstance(completeInstance.getInstanceId().getZone(),
completeInstance.toPb(), optionsMap);
}
}, options().retryParams(), EXCEPTION_HANDLER, options().clock());
@@ -1674,7 +1678,7 @@ public Instance getInstance(final InstanceId instance, InstanceOption... options
runWithRetries(new Callable() {
@Override
public com.google.api.services.compute.model.Instance call() {
- return computeRpc.getInstance(instance.zone(), instance.instance(), optionsMap);
+ return computeRpc.getInstance(instance.getZone(), instance.getInstance(), optionsMap);
}
}, options().retryParams(), EXCEPTION_HANDLER, options().clock());
return answer == null ? null : Instance.fromPb(this, answer);
@@ -1757,7 +1761,8 @@ public Operation deleteInstance(final InstanceId instance, OperationOption... op
runWithRetries(new Callable() {
@Override
public com.google.api.services.compute.model.Operation call() {
- return computeRpc.deleteInstance(instance.zone(), instance.instance(), optionsMap);
+ return computeRpc.deleteInstance(instance.getZone(), instance.getInstance(),
+ optionsMap);
}
}, options().retryParams(), EXCEPTION_HANDLER, options().clock());
return answer == null ? null : Operation.fromPb(this, answer);
@@ -1775,7 +1780,7 @@ public Operation addAccessConfig(final InstanceId instance, final String network
runWithRetries(new Callable() {
@Override
public com.google.api.services.compute.model.Operation call() {
- return computeRpc.addAccessConfig(instance.zone(), instance.instance(),
+ return computeRpc.addAccessConfig(instance.getZone(), instance.getInstance(),
networkInterface, accessConfig.toPb(), optionsMap);
}
}, options().retryParams(), EXCEPTION_HANDLER, options().clock());
@@ -1794,7 +1799,7 @@ private Operation attachDisk(final InstanceId instance, AttachedDisk diskToAttac
runWithRetries(new Callable() {
@Override
public com.google.api.services.compute.model.Operation call() {
- return computeRpc.attachDisk(instance.zone(), instance.instance(),
+ return computeRpc.attachDisk(instance.getZone(), instance.getInstance(),
completeDisk.toPb(), optionsMap);
}
}, options().retryParams(), EXCEPTION_HANDLER, options().clock());
@@ -1819,9 +1824,9 @@ public Operation attachDisk(InstanceId instance, String deviceName,
@Override
public Operation attachDisk(InstanceId instance, String deviceName,
PersistentDiskConfiguration configuration, int index, OperationOption... options) {
- AttachedDisk attachedDisk = AttachedDisk.builder(configuration)
- .deviceName(deviceName)
- .index(index)
+ AttachedDisk attachedDisk = AttachedDisk.newBuilder(configuration)
+ .setDeviceName(deviceName)
+ .setIndex(index)
.build();
return attachDisk(instance, attachedDisk, options);
}
@@ -1835,7 +1840,7 @@ public Operation deleteAccessConfig(final InstanceId instance, final String netw
runWithRetries(new Callable() {
@Override
public com.google.api.services.compute.model.Operation call() {
- return computeRpc.deleteAccessConfig(instance.zone(), instance.instance(),
+ return computeRpc.deleteAccessConfig(instance.getZone(), instance.getInstance(),
networkInterface, accessConfig, optionsMap);
}
}, options().retryParams(), EXCEPTION_HANDLER, options().clock());
@@ -1854,7 +1859,7 @@ public Operation detachDisk(final InstanceId instance, final String deviceName,
runWithRetries(new Callable() {
@Override
public com.google.api.services.compute.model.Operation call() {
- return computeRpc.detachDisk(instance.zone(), instance.instance(), deviceName,
+ return computeRpc.detachDisk(instance.getZone(), instance.getInstance(), deviceName,
optionsMap);
}
}, options().retryParams(), EXCEPTION_HANDLER, options().clock());
@@ -1870,7 +1875,7 @@ public String getSerialPortOutput(final InstanceId instance, final int port) {
return runWithRetries(new Callable() {
@Override
public String call() {
- return computeRpc.getSerialPortOutput(instance.zone(), instance.instance(), port,
+ return computeRpc.getSerialPortOutput(instance.getZone(), instance.getInstance(), port,
optionMap());
}
}, options().retryParams(), EXCEPTION_HANDLER, options().clock());
@@ -1885,7 +1890,7 @@ public String getSerialPortOutput(final InstanceId instance) {
return runWithRetries(new Callable() {
@Override
public String call() {
- return computeRpc.getSerialPortOutput(instance.zone(), instance.instance(), null,
+ return computeRpc.getSerialPortOutput(instance.getZone(), instance.getInstance(), null,
optionMap());
}
}, options().retryParams(), EXCEPTION_HANDLER, options().clock());
@@ -1902,7 +1907,7 @@ public Operation reset(final InstanceId instance, OperationOption... options) {
runWithRetries(new Callable() {
@Override
public com.google.api.services.compute.model.Operation call() {
- return computeRpc.reset(instance.zone(), instance.instance(), optionsMap);
+ return computeRpc.reset(instance.getZone(), instance.getInstance(), optionsMap);
}
}, options().retryParams(), EXCEPTION_HANDLER, options().clock());
return answer == null ? null : Operation.fromPb(this, answer);
@@ -1920,8 +1925,8 @@ public Operation setDiskAutoDelete(final InstanceId instance, final String devic
runWithRetries(new Callable() {
@Override
public com.google.api.services.compute.model.Operation call() {
- return computeRpc.setDiskAutoDelete(instance.zone(), instance.instance(), deviceName,
- autoDelete, optionsMap);
+ return computeRpc.setDiskAutoDelete(instance.getZone(), instance.getInstance(),
+ deviceName, autoDelete, optionsMap);
}
}, options().retryParams(), EXCEPTION_HANDLER, options().clock());
return answer == null ? null : Operation.fromPb(this, answer);
@@ -1933,15 +1938,15 @@ public com.google.api.services.compute.model.Operation call() {
@Override
public Operation setMachineType(final InstanceId instance, final MachineTypeId machineType,
OperationOption... options) {
- final String machineTypeUrl = machineType.setProjectId(options().projectId()).selfLink();
+ final String machineTypeUrl = machineType.setProjectId(options().projectId()).getSelfLink();
final Map optionsMap = optionMap(options);
try {
com.google.api.services.compute.model.Operation answer =
runWithRetries(new Callable() {
@Override
public com.google.api.services.compute.model.Operation call() {
- return computeRpc.setMachineType(instance.zone(), instance.instance(), machineTypeUrl,
- optionsMap);
+ return computeRpc.setMachineType(instance.getZone(), instance.getInstance(),
+ machineTypeUrl, optionsMap);
}
}, options().retryParams(), EXCEPTION_HANDLER, options().clock());
return answer == null ? null : Operation.fromPb(this, answer);
@@ -1959,8 +1964,8 @@ public Operation setMetadata(final InstanceId instance, final Metadata metadata,
runWithRetries(new Callable() {
@Override
public com.google.api.services.compute.model.Operation call() {
- return computeRpc.setMetadata(instance.zone(), instance.instance(), metadata.toPb(),
- optionsMap);
+ return computeRpc.setMetadata(instance.getZone(), instance.getInstance(),
+ metadata.toPb(), optionsMap);
}
}, options().retryParams(), EXCEPTION_HANDLER, options().clock());
return answer == null ? null : Operation.fromPb(this, answer);
@@ -1978,7 +1983,7 @@ public Operation setSchedulingOptions(final InstanceId instance,
runWithRetries(new Callable() {
@Override
public com.google.api.services.compute.model.Operation call() {
- return computeRpc.setScheduling(instance.zone(), instance.instance(),
+ return computeRpc.setScheduling(instance.getZone(), instance.getInstance(),
schedulingOptions.toPb(), optionsMap);
}
}, options().retryParams(), EXCEPTION_HANDLER, options().clock());
@@ -1996,7 +2001,7 @@ public Operation setTags(final InstanceId instance, final Tags tags, OperationOp
runWithRetries(new Callable() {
@Override
public com.google.api.services.compute.model.Operation call() {
- return computeRpc.setTags(instance.zone(), instance.instance(), tags.toPb(),
+ return computeRpc.setTags(instance.getZone(), instance.getInstance(), tags.toPb(),
optionsMap);
}
}, options().retryParams(), EXCEPTION_HANDLER, options().clock());
@@ -2014,7 +2019,7 @@ public Operation start(final InstanceId instance, OperationOption... options) {
runWithRetries(new Callable() {
@Override
public com.google.api.services.compute.model.Operation call() {
- return computeRpc.start(instance.zone(), instance.instance(), optionsMap);
+ return computeRpc.start(instance.getZone(), instance.getInstance(), optionsMap);
}
}, options().retryParams(), EXCEPTION_HANDLER, options().clock());
return answer == null ? null : Operation.fromPb(this, answer);
@@ -2031,7 +2036,7 @@ public Operation stop(final InstanceId instance, OperationOption... options) {
runWithRetries(new Callable() {
@Override
public com.google.api.services.compute.model.Operation call() {
- return computeRpc.stop(instance.zone(), instance.instance(), optionsMap);
+ return computeRpc.stop(instance.getZone(), instance.getInstance(), optionsMap);
}
}, options().retryParams(), EXCEPTION_HANDLER, options().clock());
return answer == null ? null : Operation.fromPb(this, answer);
@@ -2043,7 +2048,7 @@ public com.google.api.services.compute.model.Operation call() {
private Map optionMap(Option... options) {
Map optionMap = Maps.newEnumMap(ComputeRpc.Option.class);
for (Option option : options) {
- Object prev = optionMap.put(option.rpcOption(), option.value());
+ Object prev = optionMap.put(option.getRpcOption(), option.getValue());
checkArgument(prev == null, "Duplicate option %s", option);
}
return optionMap;
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/DeprecationStatus.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/DeprecationStatus.java
index 44174c66da15..2e8a720d0c26 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/DeprecationStatus.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/DeprecationStatus.java
@@ -97,7 +97,7 @@ public static final class Builder {
* @see RFC3339
*/
// Wrongly-formatted timestamps were allowed, we must still support them (see #732 for details)
- Builder deleted(String deleted) {
+ Builder setDeleted(String deleted) {
this.deleted = deleted;
return this;
}
@@ -109,7 +109,7 @@ Builder deleted(String deleted) {
* @see RFC3339
*/
// Wrongly-formatted timestamps were allowed, we must still support them (see #732 for details)
- Builder deprecated(String deprecated) {
+ Builder setDeprecated(String deprecated) {
this.deprecated = deprecated;
return this;
}
@@ -121,7 +121,7 @@ Builder deprecated(String deprecated) {
* @see RFC3339
*/
// Wrongly-formatted timestamps were allowed, we must still support them (see #732 for details)
- Builder obsolete(String obsolete) {
+ Builder setObsolete(String obsolete) {
this.obsolete = obsolete;
return this;
}
@@ -130,7 +130,16 @@ Builder obsolete(String obsolete) {
* Sets the timestamp on or after which the deprecation state of this resource will be changed
* to {@link Status#DELETED}. In milliseconds since epoch.
*/
+ @Deprecated
public Builder deleted(long deleted) {
+ return setDeleted(deleted);
+ }
+
+ /**
+ * Sets the timestamp on or after which the deprecation state of this resource will be changed
+ * to {@link Status#DELETED}. In milliseconds since epoch.
+ */
+ public Builder setDeleted(long deleted) {
this.deleted = TIMESTAMP_FORMATTER.print(deleted);
return this;
}
@@ -139,7 +148,16 @@ public Builder deleted(long deleted) {
* Sets the timestamp on or after which the deprecation state of this resource will be changed
* to {@link Status#DEPRECATED}. In milliseconds since epoch.
*/
+ @Deprecated
public Builder deprecated(long deprecated) {
+ return setDeprecated(deprecated);
+ }
+
+ /**
+ * Sets the timestamp on or after which the deprecation state of this resource will be changed
+ * to {@link Status#DEPRECATED}. In milliseconds since epoch.
+ */
+ public Builder setDeprecated(long deprecated) {
this.deprecated = TIMESTAMP_FORMATTER.print(deprecated);
return this;
}
@@ -148,7 +166,16 @@ public Builder deprecated(long deprecated) {
* Sets the timestamp on or after which the deprecation state of this resource will be changed
* to {@link Status#OBSOLETE}. In milliseconds since epoch.
*/
+ @Deprecated
public Builder obsolete(long obsolete) {
+ return setObsolete(obsolete);
+ }
+
+ /**
+ * Sets the timestamp on or after which the deprecation state of this resource will be changed
+ * to {@link Status#OBSOLETE}. In milliseconds since epoch.
+ */
+ public Builder setObsolete(long obsolete) {
this.obsolete = TIMESTAMP_FORMATTER.print(obsolete);
return this;
}
@@ -157,7 +184,16 @@ public Builder obsolete(long obsolete) {
* Sets the identity of the suggested replacement for a deprecated resource. The suggested
* replacement resource must be the same kind of resource as the deprecated resource.
*/
+ @Deprecated
public Builder replacement(T replacement) {
+ return setReplacement(replacement);
+ }
+
+ /**
+ * Sets the identity of the suggested replacement for a deprecated resource. The suggested
+ * replacement resource must be the same kind of resource as the deprecated resource.
+ */
+ public Builder setReplacement(T replacement) {
this.replacement = replacement;
return this;
}
@@ -165,7 +201,15 @@ public Builder replacement(T replacement) {
/**
* Sets the status of the deprecated resource.
*/
+ @Deprecated
public Builder status(Status status) {
+ return setStatus(status);
+ }
+
+ /**
+ * Sets the status of the deprecated resource.
+ */
+ public Builder setStatus(Status status) {
this.status = checkNotNull(status);
return this;
}
@@ -194,7 +238,20 @@ public DeprecationStatus build() {
* @see RFC3339
*/
// Wrongly-formatted timestamps were allowed, we must still support them (see #732 for details)
+ @Deprecated
public String deleted() {
+ return getDeleted();
+ }
+
+ /**
+ * Returns the timestamp on or after which the deprecation state of this resource will be changed
+ * to {@link Status#DELETED}. Returns {@code null} if not set. This value should be in RFC3339
+ * format.
+ *
+ * @see RFC3339
+ */
+ // Wrongly-formatted timestamps were allowed, we must still support them (see #732 for details)
+ public String getDeleted() {
return deleted;
}
@@ -206,7 +263,20 @@ public String deleted() {
* @see RFC3339
*/
// Wrongly-formatted timestamps were allowed, we must still support them (see #732 for details)
+ @Deprecated
public String deprecated() {
+ return getDeprecated();
+ }
+
+ /**
+ * Returns the timestamp on or after which the deprecation state of this resource will be changed
+ * to {@link Status#DEPRECATED}. Returns {@code null} if not set. This value should be in RFC3339
+ * format.
+ *
+ * @see RFC3339
+ */
+ // Wrongly-formatted timestamps were allowed, we must still support them (see #732 for details)
+ public String getDeprecated() {
return deprecated;
}
@@ -218,7 +288,20 @@ public String deprecated() {
* @see RFC3339
*/
// Wrongly-formatted timestamps were allowed, we must still support them (see #732 for details)
+ @Deprecated
public String obsolete() {
+ return getObsolete();
+ }
+
+ /**
+ * Returns the timestamp on or after which the deprecation state of this resource will be changed
+ * to {@link Status#OBSOLETE}. Returns {@code null} if not set. This value should be in RFC3339
+ * format.
+ *
+ * @see RFC3339
+ */
+ // Wrongly-formatted timestamps were allowed, we must still support them (see #732 for details)
+ public String getObsolete() {
return obsolete;
}
@@ -228,7 +311,18 @@ public String obsolete() {
*
* @throws IllegalStateException if {@link #deleted()} is not a valid date, time or datetime
*/
+ @Deprecated
public Long deletedMillis() {
+ return getDeletedMillis();
+ }
+
+ /**
+ * Returns the timestamp (in milliseconds since epoch) on or after which the deprecation state of
+ * this resource will be changed to {@link Status#DELETED}. Returns {@code null} if not set.
+ *
+ * @throws IllegalStateException if {@link #deleted()} is not a valid date, time or datetime
+ */
+ public Long getDeletedMillis() {
try {
return deleted != null ? TIMESTAMP_PARSER.parseMillis(deleted) : null;
} catch (IllegalArgumentException ex) {
@@ -242,7 +336,18 @@ public Long deletedMillis() {
*
* @throws IllegalStateException if {@link #deprecated()} is not a valid date, time or datetime
*/
+ @Deprecated
public Long deprecatedMillis() {
+ return getDeprecatedMillis();
+ }
+
+ /**
+ * Returns the timestamp (in milliseconds since epoch) on or after which the deprecation state of
+ * this resource will be changed to {@link Status#DEPRECATED}. Returns {@code null} if not set.
+ *
+ * @throws IllegalStateException if {@link #deprecated()} is not a valid date, time or datetime
+ */
+ public Long getDeprecatedMillis() {
try {
return deprecated != null ? TIMESTAMP_PARSER.parseMillis(deprecated) : null;
} catch (IllegalArgumentException ex) {
@@ -256,7 +361,18 @@ public Long deprecatedMillis() {
*
* @throws IllegalStateException if {@link #obsolete()} is not a valid date, time or datetime
*/
+ @Deprecated
public Long obsoleteMillis() {
+ return getObsoleteMillis();
+ }
+
+ /**
+ * Returns the timestamp (in milliseconds since epoch) on or after which the deprecation state of
+ * this resource will be changed to {@link Status#OBSOLETE}. Returns {@code null} if not set.
+ *
+ * @throws IllegalStateException if {@link #obsolete()} is not a valid date, time or datetime
+ */
+ public Long getObsoleteMillis() {
try {
return obsolete != null ? TIMESTAMP_PARSER.parseMillis(obsolete) : null;
} catch (IllegalArgumentException ex) {
@@ -268,14 +384,31 @@ public Long obsoleteMillis() {
* Returns the identity of the suggested replacement for a deprecated resource. The suggested
* replacement resource must be the same kind of resource as the deprecated resource.
*/
+ @Deprecated
public T replacement() {
+ return getReplacement();
+ }
+
+ /**
+ * Returns the identity of the suggested replacement for a deprecated resource. The suggested
+ * replacement resource must be the same kind of resource as the deprecated resource.
+ */
+ public T getReplacement() {
return replacement;
}
/**
* Returns the deprecation state of this resource.
*/
+ @Deprecated
public Status status() {
+ return getStatus();
+ }
+
+ /**
+ * Returns the deprecation state of this resource.
+ */
+ public Status getStatus() {
return status;
}
@@ -315,7 +448,7 @@ com.google.api.services.compute.model.DeprecationStatus toPb() {
deprecationStatusPb.setDeleted(deleted);
deprecationStatusPb.setDeprecated(deprecated);
deprecationStatusPb.setObsolete(obsolete);
- deprecationStatusPb.setReplacement(replacement.selfLink());
+ deprecationStatusPb.setReplacement(replacement.getSelfLink());
deprecationStatusPb.setState(status.name());
return deprecationStatusPb;
}
@@ -323,37 +456,54 @@ com.google.api.services.compute.model.DeprecationStatus toPb() {
/**
* Returns the builder for a {@code DeprecationStatus} object given the status.
*/
+ @Deprecated
public static Builder builder(Status status) {
- return new Builder().status(status);
+ return newBuilder(status);
+ }
+
+ /**
+ * Returns the builder for a {@code DeprecationStatus} object given the status.
+ */
+ public static Builder newBuilder(Status status) {
+ return new Builder().setStatus(status);
}
/**
* Returns the builder for a {@code DeprecationStatus} object given the status and replacement's
* identity.
*/
+ @Deprecated
public static Builder builder(Status status, T replacement) {
- return new Builder().status(status).replacement(replacement);
+ return newBuilder(status, replacement);
+ }
+
+ /**
+ * Returns the builder for a {@code DeprecationStatus} object given the status and replacement's
+ * identity.
+ */
+ public static Builder newBuilder(Status status, T replacement) {
+ return new Builder().setStatus(status).setReplacement(replacement);
}
/**
* Returns a {@code DeprecationStatus} object given the status and replacement's identity.
*/
public static DeprecationStatus of(Status status, T replacement) {
- return builder(status, replacement).build();
+ return newBuilder(status, replacement).build();
}
static DeprecationStatus fromPb(
com.google.api.services.compute.model.DeprecationStatus deprecationStatusPb,
Function fromUrl) {
Builder builder = new Builder<>();
- builder.deleted(deprecationStatusPb.getDeleted());
- builder.deprecated(deprecationStatusPb.getDeprecated());
- builder.obsolete(deprecationStatusPb.getObsolete());
+ builder.setDeleted(deprecationStatusPb.getDeleted());
+ builder.setDeprecated(deprecationStatusPb.getDeprecated());
+ builder.setObsolete(deprecationStatusPb.getObsolete());
if (deprecationStatusPb.getReplacement() != null) {
- builder.replacement(fromUrl.apply(deprecationStatusPb.getReplacement()));
+ builder.setReplacement(fromUrl.apply(deprecationStatusPb.getReplacement()));
}
if (deprecationStatusPb.getState() != null) {
- builder.status(Status.valueOf(deprecationStatusPb.getState()));
+ builder.setStatus(Status.valueOf(deprecationStatusPb.getState()));
}
return builder.build();
}
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/Disk.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/Disk.java
index f1c6cd26291c..41a7f95b91b5 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/Disk.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/Disk.java
@@ -60,62 +60,80 @@ public static class Builder extends DiskInfo.Builder {
}
@Override
- Builder generatedId(String generatedId) {
- infoBuilder.generatedId(generatedId);
+ Builder setGeneratedId(String generatedId) {
+ infoBuilder.setGeneratedId(generatedId);
return this;
}
@Override
+ @Deprecated
public Builder configuration(DiskConfiguration configuration) {
- infoBuilder.configuration(configuration);
+ return setConfiguration(configuration);
+ }
+
+ @Override
+ public Builder setConfiguration(DiskConfiguration configuration) {
+ infoBuilder.setConfiguration(configuration);
return this;
}
@Override
+ @Deprecated
public Builder diskId(DiskId diskId) {
- infoBuilder.diskId(diskId);
+ return setDiskId(diskId);
+ }
+
+ @Override
+ public Builder setDiskId(DiskId diskId) {
+ infoBuilder.setDiskId(diskId);
return this;
}
@Override
- Builder creationTimestamp(Long creationTimestamp) {
- infoBuilder.creationTimestamp(creationTimestamp);
+ Builder setCreationTimestamp(Long creationTimestamp) {
+ infoBuilder.setCreationTimestamp(creationTimestamp);
return this;
}
@Override
- Builder creationStatus(CreationStatus creationStatus) {
- infoBuilder.creationStatus(creationStatus);
+ Builder setCreationStatus(CreationStatus creationStatus) {
+ infoBuilder.setCreationStatus(creationStatus);
return this;
}
@Override
+ @Deprecated
public Builder description(String description) {
- infoBuilder.description(description);
+ return setDescription(description);
+ }
+
+ @Override
+ public Builder setDescription(String description) {
+ infoBuilder.setDescription(description);
return this;
}
@Override
- Builder licenses(List licenses) {
- infoBuilder.licenses(licenses);
+ Builder setLicenses(List licenses) {
+ infoBuilder.setLicenses(licenses);
return this;
}
@Override
- Builder attachedInstances(List attachedInstances) {
- infoBuilder.attachedInstances(attachedInstances);
+ Builder setAttachedInstances(List attachedInstances) {
+ infoBuilder.setAttachedInstances(attachedInstances);
return this;
}
@Override
- Builder lastAttachTimestamp(Long lastAttachTimestamp) {
- infoBuilder.lastAttachTimestamp(lastAttachTimestamp);
+ Builder setLastAttachTimestamp(Long lastAttachTimestamp) {
+ infoBuilder.setLastAttachTimestamp(lastAttachTimestamp);
return this;
}
@Override
- Builder lastDetachTimestamp(Long lastDetachTimestamp) {
- infoBuilder.lastDetachTimestamp(lastDetachTimestamp);
+ Builder setLastDetachTimestamp(Long lastDetachTimestamp) {
+ infoBuilder.setLastDetachTimestamp(lastDetachTimestamp);
return this;
}
@@ -149,7 +167,7 @@ public boolean exists() {
* @throws ComputeException upon failure
*/
public Disk reload(DiskOption... options) {
- return compute.getDisk(diskId(), options);
+ return compute.getDisk(getDiskId(), options);
}
/**
@@ -160,7 +178,7 @@ public Disk reload(DiskOption... options) {
* @throws ComputeException upon failure
*/
public Operation delete(OperationOption... options) {
- return compute.deleteDisk(diskId(), options);
+ return compute.deleteDisk(getDiskId(), options);
}
/**
@@ -170,7 +188,7 @@ public Operation delete(OperationOption... options) {
* @throws ComputeException upon failure
*/
public Operation createSnapshot(String snapshot, OperationOption... options) {
- return compute.create(SnapshotInfo.of(SnapshotId.of(snapshot), diskId()), options);
+ return compute.create(SnapshotInfo.of(SnapshotId.of(snapshot), getDiskId()), options);
}
/**
@@ -180,8 +198,8 @@ public Operation createSnapshot(String snapshot, OperationOption... options) {
* @throws ComputeException upon failure
*/
public Operation createSnapshot(String snapshot, String description, OperationOption... options) {
- SnapshotInfo snapshotInfo = SnapshotInfo.builder(SnapshotId.of(snapshot), diskId())
- .description(description)
+ SnapshotInfo snapshotInfo = SnapshotInfo.newBuilder(SnapshotId.of(snapshot), getDiskId())
+ .setDescription(description)
.build();
return compute.create(snapshotInfo, options);
}
@@ -193,7 +211,7 @@ public Operation createSnapshot(String snapshot, String description, OperationOp
* @throws ComputeException upon failure
*/
public Operation createImage(String image, OperationOption... options) {
- ImageInfo imageInfo = ImageInfo.of(ImageId.of(image), DiskImageConfiguration.of(diskId()));
+ ImageInfo imageInfo = ImageInfo.of(ImageId.of(image), DiskImageConfiguration.of(getDiskId()));
return compute.create(imageInfo, options);
}
@@ -204,9 +222,10 @@ public Operation createImage(String image, OperationOption... options) {
* @throws ComputeException upon failure
*/
public Operation createImage(String image, String description, OperationOption... options) {
- ImageInfo imageInfo = ImageInfo.builder(ImageId.of(image), DiskImageConfiguration.of(diskId()))
- .description(description)
- .build();
+ ImageInfo imageInfo =
+ ImageInfo.newBuilder(ImageId.of(image), DiskImageConfiguration.of(getDiskId()))
+ .setDescription(description)
+ .build();
return compute.create(imageInfo, options);
}
@@ -218,13 +237,21 @@ public Operation createImage(String image, String description, OperationOption..
* @throws ComputeException upon failure or if the new disk size is smaller than the previous one
*/
public Operation resize(long sizeGb, OperationOption... options) {
- return compute.resize(diskId(), sizeGb, options);
+ return compute.resize(getDiskId(), sizeGb, options);
}
/**
* Returns the disk's {@code Compute} object used to issue requests.
*/
+ @Deprecated
public Compute compute() {
+ return getCompute();
+ }
+
+ /**
+ * Returns the disk's {@code Compute} object used to issue requests.
+ */
+ public Compute getCompute() {
return compute;
}
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/DiskConfiguration.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/DiskConfiguration.java
index 1670bcf8b56b..32c12b96aa56 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/DiskConfiguration.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/DiskConfiguration.java
@@ -95,7 +95,7 @@ protected B self() {
return (B) this;
}
- B type(Type type) {
+ B setType(Type type) {
this.type = type;
return self();
}
@@ -103,7 +103,15 @@ B type(Type type) {
/**
* Sets the size of the persistent disk, in GB.
*/
+ @Deprecated
public B sizeGb(Long sizeGb) {
+ return setSizeGb(sizeGb);
+ }
+
+ /**
+ * Sets the size of the persistent disk, in GB.
+ */
+ public B setSizeGb(Long sizeGb) {
this.sizeGb = sizeGb;
return self();
}
@@ -111,7 +119,15 @@ public B sizeGb(Long sizeGb) {
/**
* Sets the identity of the disk type. If not set {@code pd-standard} will be used.
*/
+ @Deprecated
public B diskType(DiskTypeId diskType) {
+ return setDiskType(diskType);
+ }
+
+ /**
+ * Sets the identity of the disk type. If not set {@code pd-standard} will be used.
+ */
+ public B setDiskType(DiskTypeId diskType) {
this.diskType = diskType;
return self();
}
@@ -135,21 +151,49 @@ public B diskType(DiskTypeId diskType) {
* snapshot. This method returns {@link Type#IMAGE} for a configuration that creates a disk
* from a Google Compute Engine image.
*/
+ @Deprecated
public Type type() {
+ return getType();
+ }
+
+ /**
+ * Returns the disk configuration's type. This method returns {@link Type#STANDARD} for a standard
+ * configuration that creates a disk given its type and size. This method returns
+ * {@link Type#SNAPSHOT} for a configuration that creates a disk from a Google Compute Engine
+ * snapshot. This method returns {@link Type#IMAGE} for a configuration that creates a disk
+ * from a Google Compute Engine image.
+ */
+ public Type getType() {
return type;
}
/**
* Returns the size of the persistent disk, in GB.
*/
+ @Deprecated
public Long sizeGb() {
+ return getSizeGb();
+ }
+
+ /**
+ * Returns the size of the persistent disk, in GB.
+ */
+ public Long getSizeGb() {
return sizeGb;
}
/**
* Returns the identity of the disk type.
*/
+ @Deprecated
public DiskTypeId diskType() {
+ return getDiskType();
+ }
+
+ /**
+ * Returns the identity of the disk type.
+ */
+ public DiskTypeId getDiskType() {
return diskType;
}
@@ -186,7 +230,7 @@ Disk toPb() {
Disk diskPb = new Disk();
diskPb.setSizeGb(sizeGb);
if (diskType != null) {
- diskPb.setType(diskType.selfLink());
+ diskPb.setType(diskType.getSelfLink());
}
return diskPb;
}
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/DiskId.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/DiskId.java
index 58f55beb9a9a..f3d060eceaf4 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/DiskId.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/DiskId.java
@@ -45,15 +45,31 @@ private DiskId(String project, String zone, String disk) {
/**
* Returns the name of the zone this disk belongs to.
*/
+ @Deprecated
public String zone() {
+ return getZone();
+ }
+
+ /**
+ * Returns the name of the zone this disk belongs to.
+ */
+ public String getZone() {
return zone;
}
/**
* Returns the identity of the zone this disk belongs to.
*/
+ @Deprecated
public ZoneId zoneId() {
- return ZoneId.of(project(), zone);
+ return getZoneId();
+ }
+
+ /**
+ * Returns the identity of the zone this disk belongs to.
+ */
+ public ZoneId getZoneId() {
+ return ZoneId.of(getProject(), zone);
}
/**
@@ -64,13 +80,32 @@ public ZoneId zoneId() {
*
* @see RFC1035
*/
+ @Deprecated
public String disk() {
+ return getDisk();
+ }
+
+ /**
+ * Returns the name of the disk. The name must be 1-63 characters long and comply with RFC1035.
+ * Specifically, the name must match the regular expression {@code [a-z]([-a-z0-9]*[a-z0-9])?}
+ * which means the first character must be a lowercase letter, and all following characters must
+ * be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.
+ *
+ * @see RFC1035
+ */
+ public String getDisk() {
return disk;
}
@Override
+ @Deprecated
public String selfLink() {
- return super.selfLink() + "/zones/" + zone + "/disks/" + disk;
+ return getSelfLink();
+ }
+
+ @Override
+ public String getSelfLink() {
+ return super.getSelfLink() + "/zones/" + zone + "/disks/" + disk;
}
@Override
@@ -99,7 +134,7 @@ public boolean equals(Object obj) {
@Override
DiskId setProjectId(String projectId) {
- if (project() != null) {
+ if (getProject() != null) {
return this;
}
return DiskId.of(projectId, zone, disk);
@@ -115,7 +150,7 @@ DiskId setProjectId(String projectId) {
* @see RFC1035
*/
public static DiskId of(ZoneId zoneId, String disk) {
- return new DiskId(zoneId.project(), zoneId.zone(), disk);
+ return new DiskId(zoneId.getProject(), zoneId.getZone(), disk);
}
/**
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/DiskImageConfiguration.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/DiskImageConfiguration.java
index a31c8199ec07..7aa16b683f44 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/DiskImageConfiguration.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/DiskImageConfiguration.java
@@ -62,12 +62,20 @@ private Builder(Image imagePb) {
/**
* Sets the identity of the source disk used to create the image.
*/
+ @Deprecated
public Builder sourceDisk(DiskId sourceDisk) {
+ return setSourceDisk(sourceDisk);
+ }
+
+ /**
+ * Sets the identity of the source disk used to create the image.
+ */
+ public Builder setSourceDisk(DiskId sourceDisk) {
this.sourceDisk = checkNotNull(sourceDisk);
return this;
}
- Builder sourceDiskId(String sourceDiskId) {
+ Builder setSourceDiskId(String sourceDiskId) {
this.sourceDiskId = sourceDiskId;
return this;
}
@@ -90,7 +98,15 @@ private DiskImageConfiguration(Builder builder) {
/**
* Returns the identity of the source disk used to create this image.
*/
+ @Deprecated
public DiskId sourceDisk() {
+ return getSourceDisk();
+ }
+
+ /**
+ * Returns the identity of the source disk used to create this image.
+ */
+ public DiskId getSourceDisk() {
return sourceDisk;
}
@@ -99,7 +115,17 @@ public DiskId sourceDisk() {
* be used to determine whether the image was taken from the current or a previous instance of a
* given disk name.
*/
+ @Deprecated
public String sourceDiskId() {
+ return getSourceDiskId();
+ }
+
+ /**
+ * 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 getSourceDiskId() {
return sourceDiskId;
}
@@ -130,16 +156,16 @@ public final boolean equals(Object obj) {
@Override
DiskImageConfiguration setProjectId(String projectId) {
- if (sourceDisk.project() != null) {
+ if (sourceDisk.getProject() != null) {
return this;
}
- return toBuilder().sourceDisk(sourceDisk.setProjectId(projectId)).build();
+ return toBuilder().setSourceDisk(sourceDisk.setProjectId(projectId)).build();
}
@Override
Image toPb() {
Image imagePb = super.toPb();
- imagePb.setSourceDisk(sourceDisk.selfLink());
+ imagePb.setSourceDisk(sourceDisk.getSelfLink());
imagePb.setSourceDiskId(sourceDiskId);
return imagePb;
}
@@ -147,15 +173,23 @@ Image toPb() {
/**
* Creates a builder for a {@code DiskImageConfiguration} given the source disk identity.
*/
+ @Deprecated
public static Builder builder(DiskId sourceDisk) {
- return new Builder().sourceDisk(sourceDisk);
+ return newBuilder(sourceDisk);
+ }
+
+ /**
+ * Creates a builder for a {@code DiskImageConfiguration} given the source disk identity.
+ */
+ public static Builder newBuilder(DiskId sourceDisk) {
+ return new Builder().setSourceDisk(sourceDisk);
}
/**
* Creates a {@code DiskImageConfiguration} object given the source disk identity.
*/
public static DiskImageConfiguration of(DiskId sourceId) {
- return builder(sourceId).build();
+ return newBuilder(sourceId).build();
}
@SuppressWarnings("unchecked")
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/DiskInfo.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/DiskInfo.java
index aab6d90ff345..eec4c8de8b54 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/DiskInfo.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/DiskInfo.java
@@ -99,34 +99,52 @@ public enum CreationStatus {
*/
public abstract static class Builder {
- abstract Builder generatedId(String generatedId);
+ abstract Builder setGeneratedId(String generatedId);
/**
* Sets the disk configuration.
*/
+ @Deprecated
public abstract Builder configuration(DiskConfiguration configuration);
+ /**
+ * Sets the disk configuration.
+ */
+ public abstract Builder setConfiguration(DiskConfiguration configuration);
+
/**
* Sets the disk identity.
*/
+ @Deprecated
public abstract Builder diskId(DiskId diskId);
- abstract Builder creationTimestamp(Long creationTimestamp);
+ /**
+ * Sets the disk identity.
+ */
+ public abstract Builder setDiskId(DiskId diskId);
+
+ abstract Builder setCreationTimestamp(Long creationTimestamp);
- abstract Builder creationStatus(CreationStatus creationStatus);
+ abstract Builder setCreationStatus(CreationStatus creationStatus);
/**
* Sets an optional textual description of the resource.
*/
+ @Deprecated
public abstract Builder description(String description);
- abstract Builder licenses(List licenses);
+ /**
+ * Sets an optional textual description of the resource.
+ */
+ public abstract Builder setDescription(String description);
+
+ abstract Builder setLicenses(List licenses);
- abstract Builder attachedInstances(List attachedInstances);
+ abstract Builder setAttachedInstances(List attachedInstances);
- abstract Builder lastAttachTimestamp(Long lastAttachTimestamp);
+ abstract Builder setLastAttachTimestamp(Long lastAttachTimestamp);
- abstract Builder lastDetachTimestamp(Long lastDetachTimestamp);
+ abstract Builder setLastDetachTimestamp(Long lastDetachTimestamp);
/**
* Creates a {@code DiskInfo} object.
@@ -193,62 +211,80 @@ static final class BuilderImpl extends Builder {
}
@Override
- BuilderImpl generatedId(String generatedId) {
+ BuilderImpl setGeneratedId(String generatedId) {
this.generatedId = generatedId;
return this;
}
@Override
+ @Deprecated
public BuilderImpl configuration(DiskConfiguration configuration) {
+ return setConfiguration(configuration);
+ }
+
+ @Override
+ public BuilderImpl setConfiguration(DiskConfiguration configuration) {
this.configuration = checkNotNull(configuration);
return this;
}
@Override
+ @Deprecated
public BuilderImpl diskId(DiskId diskId) {
+ return setDiskId(diskId);
+ }
+
+ @Override
+ public BuilderImpl setDiskId(DiskId diskId) {
this.diskId = checkNotNull(diskId);
return this;
}
@Override
- BuilderImpl creationTimestamp(Long creationTimestamp) {
+ BuilderImpl setCreationTimestamp(Long creationTimestamp) {
this.creationTimestamp = creationTimestamp;
return this;
}
@Override
- BuilderImpl creationStatus(CreationStatus creationStatus) {
+ BuilderImpl setCreationStatus(CreationStatus creationStatus) {
this.creationStatus = creationStatus;
return this;
}
@Override
+ @Deprecated
public BuilderImpl description(String description) {
+ return setDescription(description);
+ }
+
+ @Override
+ public BuilderImpl setDescription(String description) {
this.description = description;
return this;
}
@Override
- BuilderImpl licenses(List licenses) {
+ BuilderImpl setLicenses(List licenses) {
this.licenses = licenses != null ? ImmutableList.copyOf(licenses) : null;
return this;
}
@Override
- BuilderImpl attachedInstances(List attachedInstances) {
+ BuilderImpl setAttachedInstances(List attachedInstances) {
this.attachedInstances =
attachedInstances != null ? ImmutableList.copyOf(attachedInstances) : null;
return this;
}
@Override
- BuilderImpl lastAttachTimestamp(Long lastAttachTimestamp) {
+ BuilderImpl setLastAttachTimestamp(Long lastAttachTimestamp) {
this.lastAttachTimestamp = lastAttachTimestamp;
return this;
}
@Override
- BuilderImpl lastDetachTimestamp(Long lastDetachTimestamp) {
+ BuilderImpl setLastDetachTimestamp(Long lastDetachTimestamp) {
this.lastDetachTimestamp = lastDetachTimestamp;
return this;
}
@@ -275,14 +311,30 @@ public DiskInfo build() {
/**
* Returns the creation timestamp in milliseconds since epoch.
*/
+ @Deprecated
public Long creationTimestamp() {
+ return getCreationTimestamp();
+ }
+
+ /**
+ * Returns the creation timestamp in milliseconds since epoch.
+ */
+ public Long getCreationTimestamp() {
return creationTimestamp;
}
/**
* Returns the service-generated unique identifier for the disk.
*/
+ @Deprecated
public String generatedId() {
+ return getGeneratedId();
+ }
+
+ /**
+ * Returns the service-generated unique identifier for the disk.
+ */
+ public String getGeneratedId() {
return generatedId;
}
@@ -290,56 +342,121 @@ public String generatedId() {
* Returns the disk configuration.
*/
@SuppressWarnings("unchecked")
+ @Deprecated
public T configuration() {
+ return getConfiguration();
+ }
+
+ /**
+ * Returns the disk configuration.
+ */
+ @SuppressWarnings("unchecked")
+ public T getConfiguration() {
return (T) configuration;
}
/**
* Returns the disk identity.
*/
+ @Deprecated
public DiskId diskId() {
+ return getDiskId();
+ }
+
+ /**
+ * Returns the disk identity.
+ */
+ public DiskId getDiskId() {
return diskId;
}
/**
* Returns the creation status of the disk.
*/
+ @Deprecated
public CreationStatus creationStatus() {
+ return getCreationStatus();
+ }
+
+ /**
+ * Returns the creation status of the disk.
+ */
+ public CreationStatus getCreationStatus() {
return creationStatus;
}
/**
* Returns a textual description of the disk.
*/
+ @Deprecated
public String description() {
+ return getDescription();
+ }
+
+ /**
+ * Returns a textual description of the disk.
+ */
+ public String getDescription() {
return description;
}
/**
* Returns all applicable publicly visible licenses for the disk.
*/
+ @Deprecated
public List licenses() {
+ return getLicenses();
+ }
+
+ /**
+ * Returns all applicable publicly visible licenses for the disk.
+ */
+ public List getLicenses() {
return licenses;
}
/**
* Returns all the identities of the instances this disk is attached to.
*/
+ @Deprecated
public List attachedInstances() {
+ return getAttachedInstances();
+ }
+
+ /**
+ * Returns all the identities of the instances this disk is attached to.
+ */
+ public List getAttachedInstances() {
return attachedInstances;
}
/**
* Returns the last attach timestamp in milliseconds since epoch.
*/
+ @Deprecated
public Long lastAttachTimestamp() {
+ return getLastAttachTimestamp();
+ }
+
+ /**
+ * Returns the last attach timestamp in milliseconds since epoch.
+ */
+ public Long getLastAttachTimestamp() {
return lastAttachTimestamp;
}
/**
* Returns the last detach timestamp in milliseconds since epoch.
*/
+ @Deprecated
public Long lastDetachTimestamp() {
+ return getLastDetachTimestamp();
+ }
+
+ /**
+ * Returns the last detach timestamp in milliseconds since epoch.
+ */
+ public Long getLastDetachTimestamp() {
return lastDetachTimestamp;
}
@@ -386,7 +503,18 @@ public boolean equals(Object obj) {
* {@link SnapshotDiskConfiguration} to create a disk from a snapshot. Use
* {@link ImageDiskConfiguration} to create a disk from a disk image.
*/
+ @Deprecated
public static Builder builder(DiskId diskId, DiskConfiguration configuration) {
+ return newBuilder(diskId, configuration);
+ }
+
+ /**
+ * Returns a builder for a {@code DiskInfo} object given its identity and configuration. Use
+ * {@link StandardDiskConfiguration} to create a simple disk given its type and size. Use
+ * {@link SnapshotDiskConfiguration} to create a disk from a snapshot. Use
+ * {@link ImageDiskConfiguration} to create a disk from a disk image.
+ */
+ public static Builder newBuilder(DiskId diskId, DiskConfiguration configuration) {
return new BuilderImpl(diskId, configuration);
}
@@ -397,13 +525,13 @@ public static Builder builder(DiskId diskId, DiskConfiguration configuration) {
* {@link ImageDiskConfiguration} to create a disk from a disk image.
*/
public static DiskInfo of(DiskId diskId, DiskConfiguration configuration) {
- return builder(diskId, configuration).build();
+ return newBuilder(diskId, configuration).build();
}
DiskInfo setProjectId(String projectId) {
return toBuilder()
- .diskId(diskId.setProjectId(projectId))
- .configuration(configuration.setProjectId(projectId))
+ .setDiskId(diskId.setProjectId(projectId))
+ .setConfiguration(configuration.setProjectId(projectId))
.build();
}
@@ -415,13 +543,13 @@ Disk toPb() {
if (creationTimestamp != null) {
diskPb.setCreationTimestamp(TIMESTAMP_FORMATTER.print(creationTimestamp));
}
- diskPb.setZone(diskId.zoneId().selfLink());
+ diskPb.setZone(diskId.getZoneId().getSelfLink());
if (creationStatus != null) {
diskPb.setStatus(creationStatus.toString());
}
- diskPb.setName(diskId.disk());
+ diskPb.setName(diskId.getDisk());
diskPb.setDescription(description);
- diskPb.setSelfLink(diskId.selfLink());
+ diskPb.setSelfLink(diskId.getSelfLink());
if (licenses != null) {
diskPb.setLicenses(Lists.transform(licenses, LicenseId.TO_URL_FUNCTION));
}
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/DiskType.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/DiskType.java
index cbe6f625e764..5a9c6dca3d13 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/DiskType.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/DiskType.java
@@ -72,37 +72,37 @@ static final class Builder {
private Builder() {}
- Builder generatedId(String generatedId) {
+ Builder setGeneratedId(String generatedId) {
this.generatedId = generatedId;
return this;
}
- Builder creationTimestamp(Long creationTimestamp) {
+ Builder setCreationTimestamp(Long creationTimestamp) {
this.creationTimestamp = creationTimestamp;
return this;
}
- Builder diskTypeId(DiskTypeId diskTypeId) {
+ Builder setDiskTypeId(DiskTypeId diskTypeId) {
this.diskTypeId = diskTypeId;
return this;
}
- Builder description(String description) {
+ Builder setDescription(String description) {
this.description = description;
return this;
}
- Builder validDiskSize(String validDiskSize) {
+ Builder setValidDiskSize(String validDiskSize) {
this.validDiskSize = validDiskSize;
return this;
}
- Builder defaultDiskSizeGb(Long defaultDiskSizeGb) {
+ Builder setDefaultDiskSizeGb(Long defaultDiskSizeGb) {
this.defaultDiskSizeGb = defaultDiskSizeGb;
return this;
}
- Builder deprecationStatus(DeprecationStatus deprecationStatus) {
+ Builder setDeprecationStatus(DeprecationStatus deprecationStatus) {
this.deprecationStatus = deprecationStatus;
return this;
}
@@ -125,42 +125,90 @@ private DiskType(Builder builder) {
/**
* Returns the creation timestamp in milliseconds since epoch.
*/
+ @Deprecated
public Long creationTimestamp() {
+ return getCreationTimestamp();
+ }
+
+ /**
+ * Returns the creation timestamp in milliseconds since epoch.
+ */
+ public Long getCreationTimestamp() {
return creationTimestamp;
}
/**
* Returns the disk type's identity.
*/
+ @Deprecated
public DiskTypeId diskTypeId() {
+ return getDiskTypeId();
+ }
+
+ /**
+ * Returns the disk type's identity.
+ */
+ public DiskTypeId getDiskTypeId() {
return diskTypeId;
}
/**
* Returns the service-generated unique identifier for the disk type.
*/
+ @Deprecated
public String generatedId() {
+ return getGeneratedId();
+ }
+
+ /**
+ * Returns the service-generated unique identifier for the disk type.
+ */
+ public String getGeneratedId() {
return generatedId;
}
/**
* Returns a textual description of the disk type.
*/
+ @Deprecated
public String description() {
+ return getDescription();
+ }
+
+ /**
+ * Returns a textual description of the disk type.
+ */
+ public String getDescription() {
return description;
}
/**
* Returns an optional textual description of the valid disk size, such as "10GB-10TB".
*/
+ @Deprecated
public String validDiskSize() {
+ return getValidDiskSize();
+ }
+
+ /**
+ * Returns an optional textual description of the valid disk size, such as "10GB-10TB".
+ */
+ public String getValidDiskSize() {
return validDiskSize;
}
/**
* Returns the service-defined default disk size in GB.
*/
+ @Deprecated
public Long defaultDiskSizeGb() {
+ return getDefaultDiskSizeGb();
+ }
+
+ /**
+ * Returns the service-defined default disk size in GB.
+ */
+ public Long getDefaultDiskSizeGb() {
return defaultDiskSizeGb;
}
@@ -169,7 +217,17 @@ public Long defaultDiskSizeGb() {
* either {@link DeprecationStatus.Status#DELETED} or {@link DeprecationStatus.Status#OBSOLETE}
* the disk type should not be used. Returns {@code null} if the disk type is not deprecated.
*/
+ @Deprecated
public DeprecationStatus deprecationStatus() {
+ return getDeprecationStatus();
+ }
+
+ /**
+ * Returns the deprecation status of the disk type. If {@link DeprecationStatus#status()} is
+ * either {@link DeprecationStatus.Status#DELETED} or {@link DeprecationStatus.Status#OBSOLETE}
+ * the disk type should not be used. Returns {@code null} if the disk type is not deprecated.
+ */
+ public DeprecationStatus getDeprecationStatus() {
return deprecationStatus;
}
@@ -209,33 +267,34 @@ com.google.api.services.compute.model.DiskType toPb() {
}
diskTypePb.setDescription(description);
diskTypePb.setValidDiskSize(validDiskSize);
- diskTypePb.setSelfLink(diskTypeId.selfLink());
+ diskTypePb.setSelfLink(diskTypeId.getSelfLink());
diskTypePb.setDefaultDiskSizeGb(defaultDiskSizeGb);
- diskTypePb.setZone(diskTypeId.zoneId().selfLink());
+ diskTypePb.setZone(diskTypeId.getZoneId().getSelfLink());
if (deprecationStatus != null) {
diskTypePb.setDeprecated(deprecationStatus.toPb());
}
return diskTypePb;
}
- static Builder builder() {
+ static Builder newBuilder() {
return new Builder();
}
static DiskType fromPb(com.google.api.services.compute.model.DiskType diskTypePb) {
- Builder builder = builder();
+ Builder builder = newBuilder();
if (diskTypePb.getId() != null) {
- builder.generatedId(diskTypePb.getId().toString());
+ builder.setGeneratedId(diskTypePb.getId().toString());
}
if (diskTypePb.getCreationTimestamp() != null) {
- builder.creationTimestamp(TIMESTAMP_FORMATTER.parseMillis(diskTypePb.getCreationTimestamp()));
+ builder.setCreationTimestamp(
+ TIMESTAMP_FORMATTER.parseMillis(diskTypePb.getCreationTimestamp()));
}
- builder.diskTypeId(DiskTypeId.fromUrl(diskTypePb.getSelfLink()));
- builder.description(diskTypePb.getDescription());
- builder.validDiskSize(diskTypePb.getValidDiskSize());
- builder.defaultDiskSizeGb(diskTypePb.getDefaultDiskSizeGb());
+ builder.setDiskTypeId(DiskTypeId.fromUrl(diskTypePb.getSelfLink()));
+ builder.setDescription(diskTypePb.getDescription());
+ builder.setValidDiskSize(diskTypePb.getValidDiskSize());
+ builder.setDefaultDiskSizeGb(diskTypePb.getDefaultDiskSizeGb());
if (diskTypePb.getDeprecated() != null) {
- builder.deprecationStatus(
+ builder.setDeprecationStatus(
DeprecationStatus.fromPb(diskTypePb.getDeprecated(), DiskTypeId.FROM_URL_FUNCTION));
}
return builder.build();
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/DiskTypeId.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/DiskTypeId.java
index 1ed0cfdea472..644d027e7bc0 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/DiskTypeId.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/DiskTypeId.java
@@ -39,7 +39,7 @@ public DiskTypeId apply(String pb) {
static final Function TO_URL_FUNCTION = new Function() {
@Override
public String apply(DiskTypeId diskTypeId) {
- return diskTypeId.selfLink();
+ return diskTypeId.getSelfLink();
}
};
@@ -59,27 +59,57 @@ private DiskTypeId(String project, String zone, String type) {
/**
* Returns the name of the disk type.
*/
+ @Deprecated
public String type() {
+ return getType();
+ }
+
+ /**
+ * Returns the name of the disk type.
+ */
+ public String getType() {
return type;
}
/**
* Returns the name of the zone this disk type belongs to.
*/
+ @Deprecated
public String zone() {
+ return getZone();
+ }
+
+ /**
+ * Returns the name of the zone this disk type belongs to.
+ */
+ public String getZone() {
return zone;
}
/**
* Returns the identity of the zone this disk type belongs to.
*/
+ @Deprecated
public ZoneId zoneId() {
- return ZoneId.of(project(), zone);
+ return getZoneId();
+ }
+
+ /**
+ * Returns the identity of the zone this disk type belongs to.
+ */
+ public ZoneId getZoneId() {
+ return ZoneId.of(getProject(), zone);
}
@Override
+ @Deprecated
public String selfLink() {
- return super.selfLink() + "/zones/" + zone + "/diskTypes/" + type;
+ return getSelfLink();
+ }
+
+ @Override
+ public String getSelfLink() {
+ return super.getSelfLink() + "/zones/" + zone + "/diskTypes/" + type;
}
@Override
@@ -108,7 +138,7 @@ public boolean equals(Object obj) {
@Override
DiskTypeId setProjectId(String projectId) {
- if (project() != null) {
+ if (getProject() != null) {
return this;
}
return DiskTypeId.of(projectId, zone, type);
@@ -118,7 +148,7 @@ DiskTypeId setProjectId(String projectId) {
* Returns a disk type identity given the zone identity and the disk type name.
*/
public static DiskTypeId of(ZoneId zoneId, String type) {
- return new DiskTypeId(zoneId.project(), zoneId.zone(), type);
+ return new DiskTypeId(zoneId.getProject(), zoneId.getZone(), type);
}
/**
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/ForwardingRuleId.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/ForwardingRuleId.java
index 09d447cb8072..d43925f1c599 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/ForwardingRuleId.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/ForwardingRuleId.java
@@ -56,8 +56,14 @@ enum Type {
/**
* Returns the type of this forwarding rule identity.
*/
+ @Deprecated
public abstract Type type();
+ /**
+ * Returns the type of this forwarding rule identity.
+ */
+ public abstract Type getType();
+
/**
* Returns the name of the forwarding rule. The forwarding rule name must be 1-63 characters long
* and comply with RFC1035. Specifically, the name must match the regular expression
@@ -67,7 +73,21 @@ enum Type {
*
* @see RFC1035
*/
+ @Deprecated
public String rule() {
+ return getRule();
+ }
+
+ /**
+ * Returns the name of the forwarding rule. The forwarding rule name must be 1-63 characters long
+ * and comply with RFC1035. Specifically, the name must match the regular expression
+ * {@code [a-z]([-a-z0-9]*[a-z0-9])?} which means the first character must be a lowercase letter,
+ * and all following characters must be a dash, lowercase letter, or digit, except the last
+ * character, which cannot be a dash.
+ *
+ * @see RFC1035
+ */
+ public String getRule() {
return rule;
}
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/GlobalAddressId.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/GlobalAddressId.java
index 45232edeff48..1773c6d4ae0e 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/GlobalAddressId.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/GlobalAddressId.java
@@ -33,13 +33,25 @@ private GlobalAddressId(String project, String address) {
}
@Override
+ @Deprecated
public Type type() {
+ return getType();
+ }
+
+ @Override
+ public Type getType() {
return Type.GLOBAL;
}
@Override
+ @Deprecated
public String selfLink() {
- return super.selfLink() + "/global/addresses/" + address();
+ return getSelfLink();
+ }
+
+ @Override
+ public String getSelfLink() {
+ return super.getSelfLink() + "/global/addresses/" + getAddress();
}
@Override
@@ -54,10 +66,10 @@ public boolean equals(Object obj) {
@Override
GlobalAddressId setProjectId(String projectId) {
- if (project() != null) {
+ if (getProject() != null) {
return this;
}
- return GlobalAddressId.of(projectId, address());
+ return GlobalAddressId.of(projectId, getAddress());
}
/**
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/GlobalForwardingRuleId.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/GlobalForwardingRuleId.java
index b9acfa989b85..1c189eca929e 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/GlobalForwardingRuleId.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/GlobalForwardingRuleId.java
@@ -37,7 +37,7 @@ public GlobalForwardingRuleId apply(String pb) {
new Function() {
@Override
public String apply(GlobalForwardingRuleId forwardingRuleId) {
- return forwardingRuleId.selfLink();
+ return forwardingRuleId.getSelfLink();
}
};
@@ -50,13 +50,25 @@ private GlobalForwardingRuleId(String project, String rule) {
}
@Override
+ @Deprecated
public Type type() {
+ return getType();
+ }
+
+ @Override
+ public Type getType() {
return Type.GLOBAL;
}
@Override
+ @Deprecated
public String selfLink() {
- return super.selfLink() + "/global/forwardingRules/" + rule();
+ return getSelfLink();
+ }
+
+ @Override
+ public String getSelfLink() {
+ return super.getSelfLink() + "/global/forwardingRules/" + getRule();
}
@Override
@@ -73,10 +85,10 @@ public boolean equals(Object obj) {
@Override
GlobalForwardingRuleId setProjectId(String projectId) {
- if (project() != null) {
+ if (getProject() != null) {
return this;
}
- return GlobalForwardingRuleId.of(projectId, rule());
+ return GlobalForwardingRuleId.of(projectId, getRule());
}
/**
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/GlobalOperationId.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/GlobalOperationId.java
index ee3e4fc2d40e..0e5fb162dd7f 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/GlobalOperationId.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/GlobalOperationId.java
@@ -33,13 +33,25 @@ private GlobalOperationId(String project, String operation) {
}
@Override
+ @Deprecated
public Type type() {
+ return getType();
+ }
+
+ @Override
+ public Type getType() {
return Type.GLOBAL;
}
@Override
+ @Deprecated
public String selfLink() {
- return super.selfLink() + "/global/operations/" + operation();
+ return getSelfLink();
+ }
+
+ @Override
+ public String getSelfLink() {
+ return super.getSelfLink() + "/global/operations/" + getOperation();
}
@Override
@@ -54,10 +66,10 @@ public boolean equals(Object obj) {
@Override
GlobalOperationId setProjectId(String projectId) {
- if (project() != null) {
+ if (getProject() != null) {
return this;
}
- return GlobalOperationId.of(projectId, operation());
+ return GlobalOperationId.of(projectId, getOperation());
}
/**
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/Image.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/Image.java
index e457ee71da13..0b5fbb8487e3 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/Image.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/Image.java
@@ -55,8 +55,8 @@ public static class Builder extends ImageInfo.Builder {
Builder(Compute compute, ImageId imageId, ImageConfiguration configuration) {
this.compute = compute;
this.infoBuilder = new ImageInfo.BuilderImpl();
- this.infoBuilder.imageId(imageId);
- this.infoBuilder.configuration(configuration);
+ this.infoBuilder.setImageId(imageId);
+ this.infoBuilder.setConfiguration(configuration);
}
Builder(Image image) {
@@ -65,56 +65,74 @@ public static class Builder extends ImageInfo.Builder {
}
@Override
- Builder generatedId(String generatedId) {
- infoBuilder.generatedId(generatedId);
+ Builder setGeneratedId(String generatedId) {
+ infoBuilder.setGeneratedId(generatedId);
return this;
}
@Override
- Builder creationTimestamp(Long creationTimestamp) {
- infoBuilder.creationTimestamp(creationTimestamp);
+ Builder getCreationTimestamp(Long creationTimestamp) {
+ infoBuilder.getCreationTimestamp(creationTimestamp);
return this;
}
@Override
+ @Deprecated
public Builder imageId(ImageId imageId) {
- infoBuilder.imageId(imageId);
+ return setImageId(imageId);
+ }
+
+ @Override
+ public Builder setImageId(ImageId imageId) {
+ infoBuilder.setImageId(imageId);
return this;
}
@Override
+ @Deprecated
public Builder description(String description) {
- infoBuilder.description(description);
+ return setDescription(description);
+ }
+
+ @Override
+ public Builder setDescription(String description) {
+ infoBuilder.setDescription(description);
return this;
}
@Override
+ @Deprecated
public Builder configuration(ImageConfiguration configuration) {
- infoBuilder.configuration(configuration);
+ return setConfiguration(configuration);
+ }
+
+ @Override
+ public Builder setConfiguration(ImageConfiguration configuration) {
+ infoBuilder.setConfiguration(configuration);
return this;
}
@Override
- Builder status(Status status) {
- infoBuilder.status(status);
+ Builder setStatus(Status status) {
+ infoBuilder.setStatus(status);
return this;
}
@Override
- Builder diskSizeGb(Long diskSizeGb) {
- infoBuilder.diskSizeGb(diskSizeGb);
+ Builder setDiskSizeGb(Long diskSizeGb) {
+ infoBuilder.setDiskSizeGb(diskSizeGb);
return this;
}
@Override
- Builder licenses(List licenses) {
- infoBuilder.licenses(licenses);
+ Builder setLicenses(List licenses) {
+ infoBuilder.setLicenses(licenses);
return this;
}
@Override
- Builder deprecationStatus(DeprecationStatus deprecationStatus) {
- infoBuilder.deprecationStatus(deprecationStatus);
+ Builder setDeprecationStatus(DeprecationStatus deprecationStatus) {
+ infoBuilder.setDeprecationStatus(deprecationStatus);
return this;
}
@@ -148,7 +166,7 @@ public boolean exists() {
* @throws ComputeException upon failure
*/
public Image reload(ImageOption... options) {
- return compute.getImage(imageId(), options);
+ return compute.getImage(getImageId(), options);
}
/**
@@ -159,7 +177,7 @@ public Image reload(ImageOption... options) {
* @throws ComputeException upon failure or if this image is a publicly-available image
*/
public Operation delete(OperationOption... options) {
- return compute.deleteImage(imageId(), options);
+ return compute.deleteImage(getImageId(), options);
}
/**
@@ -171,13 +189,21 @@ public Operation delete(OperationOption... options) {
*/
public Operation deprecate(DeprecationStatus deprecationStatus,
OperationOption... options) {
- return compute.deprecate(imageId(), deprecationStatus, options);
+ return compute.deprecate(getImageId(), deprecationStatus, options);
}
/**
* Returns the image's {@code Compute} object used to issue requests.
*/
+ @Deprecated
public Compute compute() {
+ return getCompute();
+ }
+
+ /**
+ * Returns the image's {@code Compute} object used to issue requests.
+ */
+ public Compute getCompute() {
return compute;
}
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/ImageConfiguration.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/ImageConfiguration.java
index 34b12dab16af..916456f196b3 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/ImageConfiguration.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/ImageConfiguration.java
@@ -92,17 +92,17 @@ B self() {
return (B) this;
}
- B type(Type type) {
+ B setType(Type type) {
this.type = type;
return self();
}
- B sourceType(SourceType sourceType) {
+ B setSourceType(SourceType sourceType) {
this.sourceType = sourceType;
return self();
}
- B archiveSizeBytes(Long archiveSizeBytes) {
+ B setArchiveSizeBytes(Long archiveSizeBytes) {
this.archiveSizeBytes = archiveSizeBytes;
return self();
}
@@ -124,21 +124,47 @@ B archiveSizeBytes(Long archiveSizeBytes) {
* an existing disk. This method returns {@link Type#STORAGE} if this image was created from a
* file in Google Cloud Storage.
*/
+ @Deprecated
public Type type() {
+ return getType();
+ }
+
+ /**
+ * Returns the image's type. This method returns {@link Type#DISK} if this image was created from
+ * an existing disk. This method returns {@link Type#STORAGE} if this image was created from a
+ * file in Google Cloud Storage.
+ */
+ public Type getType() {
return type;
}
/**
* Returns the source type of the disk. The default and only value is {@link SourceType#RAW}.
*/
+ @Deprecated
public SourceType sourceType() {
+ return getSourceType();
+ }
+
+ /**
+ * Returns the source type of the disk. The default and only value is {@link SourceType#RAW}.
+ */
+ public SourceType getSourceType() {
return sourceType;
}
/**
* Returns the size of the image archive stored in Google Cloud Storage (in bytes).
*/
+ @Deprecated
public Long archiveSizeBytes() {
+ return getArchiveSizeBytes();
+ }
+
+ /**
+ * Returns the size of the image archive stored in Google Cloud Storage (in bytes).
+ */
+ public Long getArchiveSizeBytes() {
return archiveSizeBytes;
}
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/ImageDiskConfiguration.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/ImageDiskConfiguration.java
index cf8ede2f061a..41c99247316c 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/ImageDiskConfiguration.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/ImageDiskConfiguration.java
@@ -67,20 +67,39 @@ private Builder(Disk diskPb) {
* the image's size then disk creation will fail.
*/
@Override
+ @Deprecated
public Builder sizeGb(Long sizeGb) {
- super.sizeGb(sizeGb);
+ return setSizeGb(sizeGb);
+ }
+
+ /**
+ * Sets the size of the persistent disk, in GB. If not set the disk will have the size of the
+ * image. This value can be larger than the image's size. If the provided size is smaller than
+ * the image's size then disk creation will fail.
+ */
+ @Override
+ public Builder setSizeGb(Long sizeGb) {
+ super.setSizeGb(sizeGb);
return this;
}
/**
* Sets the identity of the source image used to create the disk.
*/
+ @Deprecated
public Builder sourceImage(ImageId sourceImage) {
+ return setSourceImage(sourceImage);
+ }
+
+ /**
+ * Sets the identity of the source image used to create the disk.
+ */
+ public Builder setSourceImage(ImageId sourceImage) {
this.sourceImage = checkNotNull(sourceImage);
return this;
}
- Builder sourceImageId(String sourceImageId) {
+ Builder setSourceImageId(String sourceImageId) {
this.sourceImageId = sourceImageId;
return this;
}
@@ -103,7 +122,15 @@ private ImageDiskConfiguration(Builder builder) {
/**
* Returns the identity of the source image used to create the disk.
*/
+ @Deprecated
public ImageId sourceImage() {
+ return getSourceImage();
+ }
+
+ /**
+ * Returns the identity of the source image used to create the disk.
+ */
+ public ImageId getSourceImage() {
return sourceImage;
}
@@ -114,7 +141,19 @@ public ImageId sourceImage() {
* name, the source image service-generated id would identify the exact version of the image that
* was used.
*/
+ @Deprecated
public String sourceImageId() {
+ return getSourceImageId();
+ }
+
+ /**
+ * 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 getSourceImageId() {
return sourceImageId;
}
@@ -145,22 +184,30 @@ public final boolean equals(Object obj) {
@Override
ImageDiskConfiguration setProjectId(String projectId) {
- Builder builder = toBuilder().sourceImage(sourceImage.setProjectId(projectId));
- if (diskType() != null) {
- builder.diskType(diskType().setProjectId(projectId));
+ Builder builder = toBuilder().setSourceImage(sourceImage.setProjectId(projectId));
+ if (getDiskType() != null) {
+ builder.setDiskType(getDiskType().setProjectId(projectId));
}
return builder.build();
}
@Override
Disk toPb() {
- return super.toPb().setSourceImage(sourceImage.selfLink()).setSourceImageId(sourceImageId);
+ return super.toPb().setSourceImage(sourceImage.getSelfLink()).setSourceImageId(sourceImageId);
}
/**
* Returns a builder for an {@code ImageDiskConfiguration} object given the image identity.
*/
+ @Deprecated
public static Builder builder(ImageId imageId) {
+ return newBuilder(imageId);
+ }
+
+ /**
+ * Returns a builder for an {@code ImageDiskConfiguration} object given the image identity.
+ */
+ public static Builder newBuilder(ImageId imageId) {
return new Builder(imageId);
}
@@ -168,7 +215,7 @@ public static Builder builder(ImageId imageId) {
* Returns an {@code ImageDiskConfiguration} object given the image identity.
*/
public static ImageDiskConfiguration of(ImageId imageId) {
- return builder(imageId).build();
+ return newBuilder(imageId).build();
}
@SuppressWarnings("unchecked")
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/ImageId.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/ImageId.java
index 51a252afd6cc..b85c5a9b3eec 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/ImageId.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/ImageId.java
@@ -39,7 +39,7 @@ public ImageId apply(String pb) {
static final Function TO_URL_FUNCTION = new Function() {
@Override
public String apply(ImageId imageId) {
- return imageId.selfLink();
+ return imageId.getSelfLink();
}
};
@@ -62,13 +62,32 @@ private ImageId(String project, String image) {
*
* @see RFC1035
*/
+ @Deprecated
public String image() {
+ return getImage();
+ }
+
+ /**
+ * Returns the name of the image. The name must be 1-63 characters long and comply with RFC1035.
+ * Specifically, the name must match the regular expression {@code [a-z]([-a-z0-9]*[a-z0-9])?}
+ * which means the first character must be a lowercase letter, and all following characters must
+ * be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.
+ *
+ * @see RFC1035
+ */
+ public String getImage() {
return image;
}
@Override
+ @Deprecated
public String selfLink() {
- return super.selfLink() + "/global/images/" + image;
+ return getSelfLink();
+ }
+
+ @Override
+ public String getSelfLink() {
+ return super.getSelfLink() + "/global/images/" + image;
}
@Override
@@ -95,7 +114,7 @@ public boolean equals(Object obj) {
@Override
ImageId setProjectId(String projectId) {
- if (project() != null) {
+ if (getProject() != null) {
return this;
}
return ImageId.of(projectId, image);
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/ImageInfo.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/ImageInfo.java
index 102e2c742d71..c128b5e2461b 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/ImageInfo.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/ImageInfo.java
@@ -99,34 +99,54 @@ public enum Status {
*/
public abstract static class Builder {
- abstract Builder generatedId(String generatedId);
+ abstract Builder setGeneratedId(String generatedId);
- abstract Builder creationTimestamp(Long creationTimestamp);
+ abstract Builder getCreationTimestamp(Long creationTimestamp);
/**
* Sets the image identity.
*/
+ @Deprecated
public abstract Builder imageId(ImageId imageId);
+ /**
+ * Sets the image identity.
+ */
+ public abstract Builder setImageId(ImageId imageId);
+
/**
* Sets an optional textual description of the image.
*/
+ @Deprecated
public abstract Builder description(String description);
+ /**
+ * Sets an optional textual description of the image.
+ */
+ public abstract Builder setDescription(String description);
+
/**
* Sets the image configuration. Use {@link DiskImageConfiguration} to create an image from an
* existing disk. Use {@link StorageImageConfiguration} to create an image from a file stored in
* Google Cloud Storage.
*/
+ @Deprecated
public abstract Builder configuration(ImageConfiguration configuration);
- abstract Builder status(Status status);
+ /**
+ * Sets the image configuration. Use {@link DiskImageConfiguration} to create an image from an
+ * existing disk. Use {@link StorageImageConfiguration} to create an image from a file stored in
+ * Google Cloud Storage.
+ */
+ public abstract Builder setConfiguration(ImageConfiguration configuration);
+
+ abstract Builder setStatus(Status status);
- abstract Builder diskSizeGb(Long diskSizeGb);
+ abstract Builder setDiskSizeGb(Long diskSizeGb);
- abstract Builder licenses(List licenses);
+ abstract Builder setLicenses(List licenses);
- abstract Builder deprecationStatus(DeprecationStatus deprecationStatus);
+ abstract Builder setDeprecationStatus(DeprecationStatus deprecationStatus);
/**
* Creates a {@code ImageInfo} object.
@@ -184,55 +204,73 @@ static final class BuilderImpl extends Builder {
}
@Override
- BuilderImpl generatedId(String generatedId) {
+ BuilderImpl setGeneratedId(String generatedId) {
this.generatedId = generatedId;
return this;
}
@Override
- BuilderImpl creationTimestamp(Long creationTimestamp) {
+ BuilderImpl getCreationTimestamp(Long creationTimestamp) {
this.creationTimestamp = creationTimestamp;
return this;
}
@Override
+ @Deprecated
public BuilderImpl imageId(ImageId imageId) {
+ return setImageId(imageId);
+ }
+
+ @Override
+ public BuilderImpl setImageId(ImageId imageId) {
this.imageId = checkNotNull(imageId);
return this;
}
@Override
+ @Deprecated
public BuilderImpl description(String description) {
+ return setDescription(description);
+ }
+
+ @Override
+ public BuilderImpl setDescription(String description) {
this.description = description;
return this;
}
@Override
+ @Deprecated
public BuilderImpl configuration(ImageConfiguration configuration) {
+ return setConfiguration(configuration);
+ }
+
+ @Override
+ public BuilderImpl setConfiguration(ImageConfiguration configuration) {
this.configuration = checkNotNull(configuration);
return this;
}
@Override
- BuilderImpl status(Status status) {
+ BuilderImpl setStatus(Status status) {
this.status = status;
return this;
}
@Override
- BuilderImpl diskSizeGb(Long diskSizeGb) {
+ BuilderImpl setDiskSizeGb(Long diskSizeGb) {
this.diskSizeGb = diskSizeGb;
return this;
}
@Override
- BuilderImpl licenses(List licenses) {
+ BuilderImpl setLicenses(List licenses) {
this.licenses = licenses != null ? ImmutableList.copyOf(licenses) : null;
return this;
}
@Override
- BuilderImpl deprecationStatus(DeprecationStatus deprecationStatus) {
+ BuilderImpl setDeprecationStatus(DeprecationStatus deprecationStatus) {
this.deprecationStatus = deprecationStatus;
return this;
}
@@ -258,28 +296,60 @@ public ImageInfo build() {
/**
* Returns the service-generated unique identifier for the image.
*/
+ @Deprecated
public String generatedId() {
+ return getGeneratedId();
+ }
+
+ /**
+ * Returns the service-generated unique identifier for the image.
+ */
+ public String getGeneratedId() {
return generatedId;
}
/**
* Returns the creation timestamp in milliseconds since epoch.
*/
+ @Deprecated
public Long creationTimestamp() {
+ return getCreationTimestamp();
+ }
+
+ /**
+ * Returns the creation timestamp in milliseconds since epoch.
+ */
+ public Long getCreationTimestamp() {
return creationTimestamp;
}
/**
* Returns the image identity.
*/
+ @Deprecated
public ImageId imageId() {
+ return getImageId();
+ }
+
+ /**
+ * Returns the image identity.
+ */
+ public ImageId getImageId() {
return imageId;
}
/**
* Returns a textual description of the image.
*/
+ @Deprecated
public String description() {
+ return getDescription();
+ }
+
+ /**
+ * Returns a textual description of the image.
+ */
+ public String getDescription() {
return description;
}
@@ -290,14 +360,34 @@ public String description() {
* from a file stored in Google Cloud Storage.
*/
@SuppressWarnings("unchecked")
+ @Deprecated
public T configuration() {
+ return getConfiguration();
+ }
+
+ /**
+ * Returns the image configuration. This method returns an instance of
+ * {@link DiskImageConfiguration} if the the image was created from a Google Compute Engine disk.
+ * This method returns an instance of {@link StorageImageConfiguration} if the image was created
+ * from a file stored in Google Cloud Storage.
+ */
+ @SuppressWarnings("unchecked")
+ public T getConfiguration() {
return (T) configuration;
}
/**
* Returns all applicable publicly visible licenses.
*/
+ @Deprecated
public List licenses() {
+ return getLicenses();
+ }
+
+ /**
+ * Returns all applicable publicly visible licenses.
+ */
+ public List getLicenses() {
return licenses;
}
@@ -305,14 +395,31 @@ public List licenses() {
* Returns the status of the image. An image can be used to create other disks only after it has
* been successfully created and its status is set to {@link Status#READY}.
*/
+ @Deprecated
public Status status() {
+ return getStatus();
+ }
+
+ /**
+ * Returns the status of the image. An image can be used to create other disks only after it has
+ * been successfully created and its status is set to {@link Status#READY}.
+ */
+ public Status getStatus() {
return status;
}
/**
* Returns the size of the image when restored onto a persistent disk (in GB).
*/
+ @Deprecated
public Long diskSizeGb() {
+ return getDiskSizeGb();
+ }
+
+ /**
+ * Returns the size of the image when restored onto a persistent disk (in GB).
+ */
+ public Long getDiskSizeGb() {
return diskSizeGb;
}
@@ -321,7 +428,17 @@ public Long diskSizeGb() {
* {@link DeprecationStatus.Status#DELETED} or {@link DeprecationStatus.Status#OBSOLETE} the
* image must not be used. Returns {@code null} if the image is not deprecated.
*/
+ @Deprecated
public DeprecationStatus deprecationStatus() {
+ return getDeprecationStatus();
+ }
+
+ /**
+ * Returns the deprecation status of the image. If {@link DeprecationStatus#status()} is either
+ * {@link DeprecationStatus.Status#DELETED} or {@link DeprecationStatus.Status#OBSOLETE} the
+ * image must not be used. Returns {@code null} if the image is not deprecated.
+ */
+ public DeprecationStatus getDeprecationStatus() {
return deprecationStatus;
}
@@ -362,8 +479,8 @@ public boolean equals(Object obj) {
ImageInfo setProjectId(String projectId) {
return toBuilder()
- .imageId(imageId.setProjectId(projectId))
- .configuration(configuration.setProjectId(projectId))
+ .setImageId(imageId.setProjectId(projectId))
+ .setConfiguration(configuration.setProjectId(projectId))
.build();
}
@@ -375,9 +492,9 @@ Image toPb() {
if (creationTimestamp != null) {
imagePb.setCreationTimestamp(TIMESTAMP_FORMATTER.print(creationTimestamp));
}
- imagePb.setName(imageId.image());
+ imagePb.setName(imageId.getImage());
imagePb.setDescription(description);
- imagePb.setSelfLink(imageId.selfLink());
+ imagePb.setSelfLink(imageId.getSelfLink());
if (status != null) {
imagePb.setStatus(status.name());
}
@@ -397,8 +514,19 @@ Image toPb() {
* {@link StorageImageConfiguration} to create an image from a file stored in Google Cloud
* Storage.
*/
+ @Deprecated
public static Builder builder(ImageId imageId, ImageConfiguration configuration) {
- return new BuilderImpl().imageId(imageId).configuration(configuration);
+ return newBuilder(imageId, configuration);
+ }
+
+ /**
+ * Returns a builder for an {@code ImageInfo} object given the image identity and an image
+ * configuration. Use {@link DiskImageConfiguration} to create an image from an existing disk. Use
+ * {@link StorageImageConfiguration} to create an image from a file stored in Google Cloud
+ * Storage.
+ */
+ public static Builder newBuilder(ImageId imageId, ImageConfiguration configuration) {
+ return new BuilderImpl().setImageId(imageId).setConfiguration(configuration);
}
/**
@@ -408,7 +536,7 @@ public static Builder builder(ImageId imageId, ImageConfiguration configuration)
* Storage.
*/
public static ImageInfo of(ImageId imageId, ImageConfiguration configuration) {
- return builder(imageId, configuration).build();
+ return newBuilder(imageId, configuration).build();
}
static ImageInfo fromPb(Image imagePb) {
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/Instance.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/Instance.java
index e1ee91f4e58d..c28761cbeaa9 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/Instance.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/Instance.java
@@ -59,9 +59,9 @@ public static class Builder extends InstanceInfo.Builder {
AttachedDisk attachedDisk, NetworkInterface networkInterface) {
this.compute = compute;
this.infoBuilder = new InstanceInfo.BuilderImpl(instanceId);
- this.infoBuilder.machineType(machineType);
- this.infoBuilder.attachedDisks(ImmutableList.of(attachedDisk));
- this.infoBuilder.networkInterfaces(ImmutableList.of(networkInterface));
+ this.infoBuilder.setMachineType(machineType);
+ this.infoBuilder.setAttachedDisks(ImmutableList.of(attachedDisk));
+ this.infoBuilder.setNetworkInterfaces(ImmutableList.of(networkInterface));
}
Builder(Instance instance) {
@@ -70,104 +70,176 @@ public static class Builder extends InstanceInfo.Builder {
}
@Override
- Builder generatedId(String generatedId) {
- this.infoBuilder.generatedId(generatedId);
+ Builder setGeneratedId(String generatedId) {
+ this.infoBuilder.setGeneratedId(generatedId);
return this;
}
@Override
+ @Deprecated
public Builder instanceId(InstanceId instanceId) {
- this.infoBuilder.instanceId(instanceId);
+ return setInstanceId(instanceId);
+ }
+
+ @Override
+ public Builder setInstanceId(InstanceId instanceId) {
+ this.infoBuilder.setInstanceId(instanceId);
return this;
}
@Override
- Builder creationTimestamp(Long creationTimestamp) {
- this.infoBuilder.creationTimestamp(creationTimestamp);
+ Builder setCreationTimestamp(Long creationTimestamp) {
+ this.infoBuilder.setCreationTimestamp(creationTimestamp);
return this;
}
@Override
+ @Deprecated
public Builder description(String description) {
- this.infoBuilder.description(description);
+ return setDescription(description);
+ }
+
+ @Override
+ public Builder setDescription(String description) {
+ this.infoBuilder.setDescription(description);
return this;
}
@Override
- Builder status(Status status) {
- this.infoBuilder.status(status);
+ Builder setStatus(Status status) {
+ this.infoBuilder.setStatus(status);
return this;
}
@Override
- Builder statusMessage(String statusMessage) {
- this.infoBuilder.statusMessage(statusMessage);
+ Builder setStatusMessage(String statusMessage) {
+ this.infoBuilder.setStatusMessage(statusMessage);
return this;
}
@Override
+ @Deprecated
public Builder tags(Tags tags) {
- this.infoBuilder.tags(tags);
+ return setTags(tags);
+ }
+
+ @Override
+ public Builder setTags(Tags tags) {
+ this.infoBuilder.setTags(tags);
return this;
}
@Override
+ @Deprecated
public Builder machineType(MachineTypeId machineType) {
- this.infoBuilder.machineType(machineType);
+ return setMachineType(machineType);
+ }
+
+ @Override
+ public Builder setMachineType(MachineTypeId machineType) {
+ this.infoBuilder.setMachineType(machineType);
return this;
}
@Override
+ @Deprecated
public Builder canIpForward(Boolean canIpForward) {
- this.infoBuilder.canIpForward(canIpForward);
+ return setCanIpForward(canIpForward);
+ }
+
+ @Override
+ public Builder setCanIpForward(Boolean canIpForward) {
+ this.infoBuilder.setCanIpForward(canIpForward);
return this;
}
@Override
+ @Deprecated
public Builder networkInterfaces(List networkInterfaces) {
- this.infoBuilder.networkInterfaces(networkInterfaces);
+ return setNetworkInterfaces(networkInterfaces);
+ }
+
+ @Override
+ public Builder setNetworkInterfaces(List networkInterfaces) {
+ this.infoBuilder.setNetworkInterfaces(networkInterfaces);
return this;
}
@Override
+ @Deprecated
public Builder networkInterfaces(NetworkInterface... networkInterfaces) {
- this.infoBuilder.networkInterfaces(networkInterfaces);
+ return setNetworkInterfaces(networkInterfaces);
+ }
+
+ @Override
+ public Builder setNetworkInterfaces(NetworkInterface... networkInterfaces) {
+ this.infoBuilder.setNetworkInterfaces(networkInterfaces);
return this;
}
@Override
+ @Deprecated
public Builder attachedDisks(List attachedDisks) {
- this.infoBuilder.attachedDisks(attachedDisks);
+ return setAttachedDisks(attachedDisks);
+ }
+
+ @Override
+ public Builder setAttachedDisks(List attachedDisks) {
+ this.infoBuilder.setAttachedDisks(attachedDisks);
return this;
}
@Override
+ @Deprecated
public Builder attachedDisks(AttachedDisk... attachedDisks) {
- this.infoBuilder.attachedDisks(attachedDisks);
+ return setAttachedDisks(attachedDisks);
+ }
+
+ @Override
+ public Builder setAttachedDisks(AttachedDisk... attachedDisks) {
+ this.infoBuilder.setAttachedDisks(attachedDisks);
return this;
}
@Override
+ @Deprecated
public Builder metadata(Metadata metadata) {
- this.infoBuilder.metadata(metadata);
+ return setMetadata(metadata);
+ }
+
+ @Override
+ public Builder setMetadata(Metadata metadata) {
+ this.infoBuilder.setMetadata(metadata);
return this;
}
@Override
+ @Deprecated
public Builder serviceAccounts(List serviceAccounts) {
- this.infoBuilder.serviceAccounts(serviceAccounts);
+ return setServiceAccounts(serviceAccounts);
+ }
+
+ @Override
+ public Builder setServiceAccounts(List serviceAccounts) {
+ this.infoBuilder.setServiceAccounts(serviceAccounts);
return this;
}
@Override
+ @Deprecated
public Builder schedulingOptions(SchedulingOptions schedulingOptions) {
- this.infoBuilder.schedulingOptions(schedulingOptions);
+ return setSchedulingOptions(schedulingOptions);
+ }
+
+ @Override
+ public Builder setSchedulingOptions(SchedulingOptions schedulingOptions) {
+ this.infoBuilder.setSchedulingOptions(schedulingOptions);
return this;
}
@Override
- Builder cpuPlatform(String cpuPlatform) {
- this.infoBuilder.cpuPlatform(cpuPlatform);
+ Builder setCpuPlatform(String cpuPlatform) {
+ this.infoBuilder.setCpuPlatform(cpuPlatform);
return this;
}
@@ -202,7 +274,7 @@ public boolean exists() {
* @throws ComputeException upon failure
*/
public Instance reload(InstanceOption... options) {
- return compute.getInstance(instanceId(), options);
+ return compute.getInstance(getInstanceId(), options);
}
/**
@@ -213,7 +285,7 @@ public Instance reload(InstanceOption... options) {
* @throws ComputeException upon failure
*/
public Operation delete(OperationOption... options) {
- return compute.deleteInstance(instanceId(), options);
+ return compute.deleteInstance(getInstanceId(), options);
}
/**
@@ -225,7 +297,7 @@ public Operation delete(OperationOption... options) {
*/
public Operation addAccessConfig(String networkInterface, AccessConfig accessConfig,
OperationOption... options) {
- return compute.addAccessConfig(instanceId(), networkInterface, accessConfig, options);
+ return compute.addAccessConfig(getInstanceId(), networkInterface, accessConfig, options);
}
/**
@@ -237,7 +309,7 @@ public Operation addAccessConfig(String networkInterface, AccessConfig accessCon
*/
public Operation attachDisk(PersistentDiskConfiguration configuration,
OperationOption... options) {
- return compute.attachDisk(instanceId(), configuration, options);
+ return compute.attachDisk(getInstanceId(), configuration, options);
}
/**
@@ -249,7 +321,7 @@ public Operation attachDisk(PersistentDiskConfiguration configuration,
*/
public Operation attachDisk(String deviceName, PersistentDiskConfiguration configuration,
OperationOption... options) {
- return compute.attachDisk(instanceId(), deviceName, configuration, options);
+ return compute.attachDisk(getInstanceId(), deviceName, configuration, options);
}
/**
@@ -262,7 +334,7 @@ public Operation attachDisk(String deviceName, PersistentDiskConfiguration confi
*/
public Operation attachDisk(String deviceName, PersistentDiskConfiguration configuration,
int index, OperationOption... options) {
- return compute.attachDisk(instanceId(), deviceName, configuration, index, options);
+ return compute.attachDisk(getInstanceId(), deviceName, configuration, index, options);
}
/**
@@ -274,7 +346,7 @@ public Operation attachDisk(String deviceName, PersistentDiskConfiguration confi
*/
public Operation deleteAccessConfig(String networkInterface, String accessConfig,
OperationOption... options) {
- return compute.deleteAccessConfig(instanceId(), networkInterface, accessConfig, options);
+ return compute.deleteAccessConfig(getInstanceId(), networkInterface, accessConfig, options);
}
/**
@@ -285,7 +357,7 @@ public Operation deleteAccessConfig(String networkInterface, String accessConfig
* @throws ComputeException upon failure
*/
public Operation detachDisk(String deviceName, OperationOption... options) {
- return compute.detachDisk(instanceId(), deviceName, options);
+ return compute.detachDisk(getInstanceId(), deviceName, options);
}
/**
@@ -296,7 +368,7 @@ public Operation detachDisk(String deviceName, OperationOption... options) {
* @throws ComputeException upon failure
*/
public String getSerialPortOutput(int port) {
- return compute.getSerialPortOutput(instanceId(), port);
+ return compute.getSerialPortOutput(getInstanceId(), port);
}
/**
@@ -307,7 +379,7 @@ public String getSerialPortOutput(int port) {
* @throws ComputeException upon failure
*/
public String getSerialPortOutput() {
- return compute.getSerialPortOutput(instanceId());
+ return compute.getSerialPortOutput(getInstanceId());
}
/**
@@ -318,7 +390,7 @@ public String getSerialPortOutput() {
* @throws ComputeException upon failure
*/
public Operation reset(OperationOption... options) {
- return compute.reset(instanceId(), options);
+ return compute.reset(getInstanceId(), options);
}
/**
@@ -330,7 +402,7 @@ public Operation reset(OperationOption... options) {
*/
public Operation setDiskAutoDelete(String deviceName, boolean autoDelete,
OperationOption... options) {
- return compute.setDiskAutoDelete(instanceId(), deviceName, autoDelete, options);
+ return compute.setDiskAutoDelete(getInstanceId(), deviceName, autoDelete, options);
}
/**
@@ -342,7 +414,7 @@ public Operation setDiskAutoDelete(String deviceName, boolean autoDelete,
* @throws ComputeException upon failure
*/
public Operation setMachineType(MachineTypeId machineType, OperationOption... options) {
- return compute.setMachineType(instanceId(), machineType, options);
+ return compute.setMachineType(getInstanceId(), machineType, options);
}
/**
@@ -353,7 +425,7 @@ public Operation setMachineType(MachineTypeId machineType, OperationOption... op
* @throws ComputeException upon failure
*/
public Operation setMetadata(Metadata metadata, OperationOption... options) {
- return compute.setMetadata(instanceId(), metadata, options);
+ return compute.setMetadata(getInstanceId(), metadata, options);
}
/**
@@ -365,7 +437,7 @@ public Operation setMetadata(Metadata metadata, OperationOption... options) {
* @throws ComputeException upon failure
*/
public Operation setMetadata(Map metadata, OperationOption... options) {
- return setMetadata(metadata().toBuilder().values(metadata).build(), options);
+ return setMetadata(getMetadata().toBuilder().setValues(metadata).build(), options);
}
/**
@@ -376,7 +448,7 @@ public Operation setMetadata(Map metadata, OperationOption... op
* @throws ComputeException upon failure
*/
public Operation setSchedulingOptions(SchedulingOptions scheduling, OperationOption... options) {
- return compute.setSchedulingOptions(instanceId(), scheduling, options);
+ return compute.setSchedulingOptions(getInstanceId(), scheduling, options);
}
/**
@@ -387,7 +459,7 @@ public Operation setSchedulingOptions(SchedulingOptions scheduling, OperationOpt
* @throws ComputeException upon failure
*/
public Operation setTags(Tags tags, OperationOption... options) {
- return compute.setTags(instanceId(), tags, options);
+ return compute.setTags(getInstanceId(), tags, options);
}
/**
@@ -399,7 +471,7 @@ public Operation setTags(Tags tags, OperationOption... options) {
* @throws ComputeException upon failure
*/
public Operation setTags(Iterable tags, OperationOption... options) {
- return setTags(tags().toBuilder().values(tags).build(), options);
+ return setTags(getTags().toBuilder().setValues(tags).build(), options);
}
/**
@@ -410,7 +482,7 @@ public Operation setTags(Iterable tags, OperationOption... options) {
* @throws ComputeException upon failure
*/
public Operation start(OperationOption... options) {
- return compute.start(instanceId(), options);
+ return compute.start(getInstanceId(), options);
}
/**
@@ -421,13 +493,21 @@ public Operation start(OperationOption... options) {
* @throws ComputeException upon failure
*/
public Operation stop(OperationOption... options) {
- return compute.stop(instanceId(), options);
+ return compute.stop(getInstanceId(), options);
}
/**
* Returns the snapshot's {@code Compute} object used to issue requests.
*/
+ @Deprecated
public Compute compute() {
+ return getCompute();
+ }
+
+ /**
+ * Returns the snapshot's {@code Compute} object used to issue requests.
+ */
+ public Compute getCompute() {
return compute;
}
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/InstanceId.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/InstanceId.java
index 8fde843020f3..607abeacd999 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/InstanceId.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/InstanceId.java
@@ -39,7 +39,7 @@ public InstanceId apply(String pb) {
static final Function TO_URL_FUNCTION = new Function() {
@Override
public String apply(InstanceId instanceId) {
- return instanceId.selfLink();
+ return instanceId.getSelfLink();
}
};
@@ -65,27 +65,63 @@ private InstanceId(String project, String zone, String instance) {
*
* @see RFC1035
*/
+ @Deprecated
public String instance() {
+ return getInstance();
+ }
+
+ /**
+ * Returns the name of the instance. The name must be 1-63 characters long and comply with
+ * RFC1035. Specifically, the name must match the regular expression
+ * {@code [a-z]([-a-z0-9]*[a-z0-9])?} which means the first character must be a lowercase letter,
+ * and all following characters must be a dash, lowercase letter, or digit, except the last
+ * character, which cannot be a dash.
+ *
+ * @see RFC1035
+ */
+ public String getInstance() {
return instance;
}
/**
* Returns the name of the zone this instance belongs to.
*/
+ @Deprecated
public String zone() {
+ return getZone();
+ }
+
+ /**
+ * Returns the name of the zone this instance belongs to.
+ */
+ public String getZone() {
return zone;
}
/**
* Returns the identity of the zone this instance belongs to.
*/
+ @Deprecated
public ZoneId zoneId() {
- return ZoneId.of(project(), zone);
+ return getZoneId();
+ }
+
+ /**
+ * Returns the identity of the zone this instance belongs to.
+ */
+ public ZoneId getZoneId() {
+ return ZoneId.of(getProject(), zone);
}
@Override
+ @Deprecated
public String selfLink() {
- return super.selfLink() + "/zones/" + zone + "/instances/" + instance;
+ return getSelfLink();
+ }
+
+ @Override
+ public String getSelfLink() {
+ return super.getSelfLink() + "/zones/" + zone + "/instances/" + instance;
}
@Override
@@ -114,7 +150,7 @@ public boolean equals(Object obj) {
@Override
InstanceId setProjectId(String projectId) {
- if (project() != null) {
+ if (getProject() != null) {
return this;
}
return InstanceId.of(projectId, zone, instance);
@@ -130,7 +166,7 @@ InstanceId setProjectId(String projectId) {
* @see RFC1035
*/
public static InstanceId of(ZoneId zoneId, String instance) {
- return new InstanceId(zoneId.project(), zoneId.zone(), instance);
+ return new InstanceId(zoneId.getProject(), zoneId.getZone(), instance);
}
/**
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/InstanceInfo.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/InstanceInfo.java
index 7f85985afd2d..05dfd52d7e70 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/InstanceInfo.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/InstanceInfo.java
@@ -125,35 +125,60 @@ public enum Status {
*/
public abstract static class Builder {
- abstract Builder generatedId(String generatedId);
+ abstract Builder setGeneratedId(String generatedId);
/**
* Sets the identity of the virtual machine instance.
*/
+ @Deprecated
public abstract Builder instanceId(InstanceId instanceId);
- abstract Builder creationTimestamp(Long creationTimestamp);
+ /**
+ * Sets the identity of the virtual machine instance.
+ */
+ public abstract Builder setInstanceId(InstanceId instanceId);
+
+ abstract Builder setCreationTimestamp(Long creationTimestamp);
/**
* Sets an optional description of this Google Compute Engine instance.
*/
+ @Deprecated
public abstract Builder description(String description);
- abstract Builder status(Status status);
+ /**
+ * Sets an optional description of this Google Compute Engine instance.
+ */
+ public abstract Builder setDescription(String description);
+
+ abstract Builder setStatus(Status status);
- abstract Builder statusMessage(String statusMessage);
+ abstract Builder setStatusMessage(String statusMessage);
/**
* Sets the tags to apply to this instance. Tags are used to identify valid sources or targets
* for network firewalls.
*/
+ @Deprecated
public abstract Builder tags(Tags tags);
+ /**
+ * Sets the tags to apply to this instance. Tags are used to identify valid sources or targets
+ * for network firewalls.
+ */
+ public abstract Builder setTags(Tags tags);
+
/**
* Sets the machine type identity.
*/
+ @Deprecated
public abstract Builder machineType(MachineTypeId machineType);
+ /**
+ * Sets the machine type identity.
+ */
+ public abstract Builder setMachineType(MachineTypeId machineType);
+
/**
* Sets whether to allow this instance to send and receive packets with non-matching destination
* or source IPs. This is required if you plan to use this instance to forward routes.
@@ -161,13 +186,24 @@ public abstract static class Builder {
* @see Enabling IP
* Forwarding
*/
+ @Deprecated
public abstract Builder canIpForward(Boolean canIpForward);
+ /**
+ * Sets whether to allow this instance to send and receive packets with non-matching destination
+ * or source IPs. This is required if you plan to use this instance to forward routes.
+ *
+ * @see Enabling IP
+ * Forwarding
+ */
+ public abstract Builder setCanIpForward(Boolean canIpForward);
+
/**
* Sets a list of network interfaces. This specifies how this instance is configured to interact
* with other network services, such as connecting to the internet. At the moment, instances
* only support one network interface.
*/
+ @Deprecated
public abstract Builder networkInterfaces(List networkInterfaces);
/**
@@ -175,25 +211,60 @@ public abstract static class Builder {
* with other network services, such as connecting to the internet. At the moment, instances
* only support one network interface.
*/
+ public abstract Builder setNetworkInterfaces(List networkInterfaces);
+
+ /**
+ * Sets a list of network interfaces. This specifies how this instance is configured to interact
+ * with other network services, such as connecting to the internet. At the moment, instances
+ * only support one network interface.
+ */
+ @Deprecated
public abstract Builder networkInterfaces(NetworkInterface... networkInterfaces);
+ /**
+ * Sets a list of network interfaces. This specifies how this instance is configured to interact
+ * with other network services, such as connecting to the internet. At the moment, instances
+ * only support one network interface.
+ */
+ public abstract Builder setNetworkInterfaces(NetworkInterface... networkInterfaces);
+
/**
* Sets a list of disks to attach to the instance. One boot disk must be provided (i.e. an
* attached disk such that {@link AttachedDisk.AttachedDiskConfiguration#boot()} returns
* {@code true}).
*/
+ @Deprecated
public abstract Builder attachedDisks(List attachedDisks);
+ /**
+ * Sets a list of disks to attach to the instance. One boot disk must be provided (i.e. an
+ * attached disk such that {@link AttachedDisk.AttachedDiskConfiguration#boot()} returns
+ * {@code true}).
+ */
+ public abstract Builder setAttachedDisks(List attachedDisks);
+
/**
* Sets a list of disks to attach to the instance. One boot disk must be provided.
*/
+ @Deprecated
public abstract Builder attachedDisks(AttachedDisk... attachedDisks);
+ /**
+ * Sets a list of disks to attach to the instance. One boot disk must be provided.
+ */
+ public abstract Builder setAttachedDisks(AttachedDisk... attachedDisks);
+
/**
* Sets the instance metadata.
*/
+ @Deprecated
public abstract Builder metadata(Metadata metadata);
+ /**
+ * Sets the instance metadata.
+ */
+ public abstract Builder setMetadata(Metadata metadata);
+
/**
* Sets a list of service accounts, with their specified scopes, authorized for this instance.
* Service accounts generate access tokens that can be accessed through the metadata server and
@@ -202,14 +273,31 @@ public abstract static class Builder {
* @see Authenticating from
* Google Compute Engine
*/
+ @Deprecated
public abstract Builder serviceAccounts(List serviceAccounts);
+ /**
+ * Sets a list of service accounts, with their specified scopes, authorized for this instance.
+ * Service accounts generate access tokens that can be accessed through the metadata server and
+ * used to authenticate applications on the instance.
+ *
+ * @see Authenticating from
+ * Google Compute Engine
+ */
+ public abstract Builder setServiceAccounts(List serviceAccounts);
+
/**
* Sets the scheduling options for the instance.
*/
+ @Deprecated
public abstract Builder schedulingOptions(SchedulingOptions schedulingOptions);
- abstract Builder cpuPlatform(String cpuPlatform);
+ /**
+ * Sets the scheduling options for the instance.
+ */
+ public abstract Builder setSchedulingOptions(SchedulingOptions schedulingOptions);
+
+ abstract Builder setCpuPlatform(String cpuPlatform);
/**
* Creates an {@code InstanceInfo} object.
@@ -298,103 +386,175 @@ public static final class BuilderImpl extends Builder {
}
@Override
- Builder generatedId(String generatedId) {
+ Builder setGeneratedId(String generatedId) {
this.generatedId = generatedId;
return this;
}
@Override
+ @Deprecated
public Builder instanceId(InstanceId instanceId) {
+ return setInstanceId(instanceId);
+ }
+
+ @Override
+ public Builder setInstanceId(InstanceId instanceId) {
this.instanceId = checkNotNull(instanceId);
return this;
}
@Override
- Builder creationTimestamp(Long creationTimestamp) {
+ Builder setCreationTimestamp(Long creationTimestamp) {
this.creationTimestamp = creationTimestamp;
return this;
}
@Override
+ @Deprecated
public Builder description(String description) {
+ return setDescription(description);
+ }
+
+ @Override
+ public Builder setDescription(String description) {
this.description = description;
return this;
}
@Override
- Builder status(Status status) {
+ Builder setStatus(Status status) {
this.status = status;
return this;
}
@Override
- Builder statusMessage(String statusMessage) {
+ Builder setStatusMessage(String statusMessage) {
this.statusMessage = statusMessage;
return this;
}
@Override
+ @Deprecated
public Builder tags(Tags tags) {
+ return setTags(tags);
+ }
+
+ @Override
+ public Builder setTags(Tags tags) {
this.tags = tags;
return this;
}
@Override
+ @Deprecated
public Builder machineType(MachineTypeId machineType) {
+ return setMachineType(machineType);
+ }
+
+ @Override
+ public Builder setMachineType(MachineTypeId machineType) {
this.machineType = checkNotNull(machineType);
return this;
}
@Override
+ @Deprecated
public Builder canIpForward(Boolean canIpForward) {
+ return setCanIpForward(canIpForward);
+ }
+
+ @Override
+ public Builder setCanIpForward(Boolean canIpForward) {
this.canIpForward = canIpForward;
return this;
}
@Override
+ @Deprecated
public Builder networkInterfaces(List networkInterfaces) {
+ return setNetworkInterfaces(networkInterfaces);
+ }
+
+ @Override
+ public Builder setNetworkInterfaces(List networkInterfaces) {
this.networkInterfaces = ImmutableList.copyOf(checkNotNull(networkInterfaces));
return this;
}
@Override
+ @Deprecated
public Builder networkInterfaces(NetworkInterface... networkInterfaces) {
+ return setNetworkInterfaces(networkInterfaces);
+ }
+
+ @Override
+ public Builder setNetworkInterfaces(NetworkInterface... networkInterfaces) {
this.networkInterfaces = Arrays.asList(networkInterfaces);
return this;
}
@Override
+ @Deprecated
public Builder attachedDisks(List attachedDisks) {
+ return setAttachedDisks(attachedDisks);
+ }
+
+ @Override
+ public Builder setAttachedDisks(List attachedDisks) {
this.attachedDisks = ImmutableList.copyOf(checkNotNull(attachedDisks));
return this;
}
@Override
+ @Deprecated
public Builder attachedDisks(AttachedDisk... attachedDisks) {
+ return setAttachedDisks(attachedDisks);
+ }
+
+ @Override
+ public Builder setAttachedDisks(AttachedDisk... attachedDisks) {
this.attachedDisks = Arrays.asList(attachedDisks);
return this;
}
@Override
+ @Deprecated
public Builder metadata(Metadata metadata) {
+ return setMetadata(metadata);
+ }
+
+ @Override
+ public Builder setMetadata(Metadata metadata) {
this.metadata = metadata;
return this;
}
@Override
+ @Deprecated
public Builder serviceAccounts(List serviceAccounts) {
+ return setServiceAccounts(serviceAccounts);
+ }
+
+ @Override
+ public Builder setServiceAccounts(List serviceAccounts) {
this.serviceAccounts = ImmutableList.copyOf(checkNotNull(serviceAccounts));
return this;
}
@Override
+ @Deprecated
public Builder schedulingOptions(SchedulingOptions schedulingOptions) {
+ return setSchedulingOptions(schedulingOptions);
+ }
+
+ @Override
+ public Builder setSchedulingOptions(SchedulingOptions schedulingOptions) {
this.schedulingOptions = schedulingOptions;
return this;
}
@Override
- Builder cpuPlatform(String cpuPlatform) {
+ Builder setCpuPlatform(String cpuPlatform) {
this.cpuPlatform = cpuPlatform;
return this;
}
@@ -428,42 +588,90 @@ public InstanceInfo build() {
/**
* Returns the service-generated unique identifier for the instance.
*/
+ @Deprecated
public String generatedId() {
+ return getGeneratedId();
+ }
+
+ /**
+ * Returns the service-generated unique identifier for the instance.
+ */
+ public String getGeneratedId() {
return generatedId;
}
/**
* Returns the instance identity.
*/
+ @Deprecated
public InstanceId instanceId() {
+ return getInstanceId();
+ }
+
+ /**
+ * Returns the instance identity.
+ */
+ public InstanceId getInstanceId() {
return instanceId;
}
/**
* Returns the creation timestamp in milliseconds since epoch.
*/
+ @Deprecated
public Long creationTimestamp() {
+ return getCreationTimestamp();
+ }
+
+ /**
+ * Returns the creation timestamp in milliseconds since epoch.
+ */
+ public Long getCreationTimestamp() {
return creationTimestamp;
}
/**
* Returns a textual description of the instance.
*/
+ @Deprecated
public String description() {
+ return getDescription();
+ }
+
+ /**
+ * Returns a textual description of the instance.
+ */
+ public String getDescription() {
return description;
}
/**
* Returns the status of the instance.
*/
+ @Deprecated
public Status status() {
+ return getStatus();
+ }
+
+ /**
+ * Returns the status of the instance.
+ */
+ public Status getStatus() {
return status;
}
/**
* Returns an optional, human-readable explanation of the status.
*/
+ @Deprecated
public String statusMessage() {
+ return getStatusMessage();
+ }
+
+ /**
+ * Returns an optional, human-readable explanation of the status.
+ */
+ public String getStatusMessage() {
return statusMessage;
}
@@ -471,14 +679,31 @@ public String statusMessage() {
* Returns the tags of this instance. Tags are used to identify valid sources or targets for
* network firewalls.
*/
+ @Deprecated
public Tags tags() {
+ return getTags();
+ }
+
+ /**
+ * Returns the tags of this instance. Tags are used to identify valid sources or targets for
+ * network firewalls.
+ */
+ public Tags getTags() {
return tags;
}
/**
* Returns the machine type identity.
*/
+ @Deprecated
public MachineTypeId machineType() {
+ return getMachineType();
+ }
+
+ /**
+ * Returns the machine type identity.
+ */
+ public MachineTypeId getMachineType() {
return machineType;
}
@@ -497,21 +722,46 @@ public Boolean canIpForward() {
* Returns a list of network interfaces. This specifies how this instance is configured to
* interact with other network services, such as connecting to the internet.
*/
+ @Deprecated
public List networkInterfaces() {
+ return getNetworkInterfaces();
+ }
+
+ /**
+ * Returns a list of network interfaces. This specifies how this instance is configured to
+ * interact with other network services, such as connecting to the internet.
+ */
+ public List getNetworkInterfaces() {
return networkInterfaces;
}
/**
* Returns a list of disks attached to the instance.
*/
+ @Deprecated
public List attachedDisks() {
+ return getAttachedDisks();
+ }
+
+ /**
+ * Returns a list of disks attached to the instance.
+ */
+ public List getAttachedDisks() {
return attachedDisks;
}
/**
* Returns the instance metadata.
*/
+ @Deprecated
public Metadata metadata() {
+ return getMetadata();
+ }
+
+ /**
+ * Returns the instance metadata.
+ */
+ public Metadata getMetadata() {
return metadata;
}
@@ -523,21 +773,50 @@ public Metadata metadata() {
* @see Authenticating from
* Google Compute Engine
*/
+ @Deprecated
public List serviceAccounts() {
+ return getServiceAccounts();
+ }
+
+ /**
+ * Returns a list of service accounts, with their specified scopes, authorized for this instance.
+ * Service accounts generate access tokens that can be accessed through the metadata server and
+ * used to authenticate applications on the instance.
+ *
+ * @see Authenticating from
+ * Google Compute Engine
+ */
+ public List getServiceAccounts() {
return serviceAccounts;
}
/**
* Returns the scheduling options for the instance.
*/
+ @Deprecated
public SchedulingOptions schedulingOptions() {
+ return getSchedulingOptions();
+ }
+
+ /**
+ * Returns the scheduling options for the instance.
+ */
+ public SchedulingOptions getSchedulingOptions() {
return schedulingOptions;
}
/**
* Returns the CPU platform used by this instance.
*/
+ @Deprecated
public String cpuPlatform() {
+ return getCpuPlatform();
+ }
+
+ /**
+ * Returns the CPU platform used by this instance.
+ */
+ public String getCpuPlatform() {
return cpuPlatform;
}
@@ -586,22 +865,22 @@ public boolean equals(Object obj) {
InstanceInfo setProjectId(final String projectId) {
Builder builder = toBuilder();
- builder.networkInterfaces(Lists.transform(networkInterfaces,
+ builder.setNetworkInterfaces(Lists.transform(networkInterfaces,
new Function() {
@Override
public NetworkInterface apply(NetworkInterface networkInterface) {
return networkInterface.setProjectId(projectId);
}
}));
- builder.attachedDisks(Lists.transform(attachedDisks,
+ builder.setAttachedDisks(Lists.transform(attachedDisks,
new Function() {
@Override
public AttachedDisk apply(AttachedDisk attachedDisk) {
return attachedDisk.setProjectId(projectId);
}
}));
- return builder.instanceId(instanceId.setProjectId(projectId))
- .machineType(machineType.setProjectId(projectId))
+ return builder.setInstanceId(instanceId.setProjectId(projectId))
+ .setMachineType(machineType.setProjectId(projectId))
.build();
}
@@ -613,10 +892,10 @@ Instance toPb() {
if (creationTimestamp != null) {
instancePb.setCreationTimestamp(TIMESTAMP_FORMATTER.print(creationTimestamp));
}
- instancePb.setName(instanceId.instance());
+ instancePb.setName(instanceId.getInstance());
instancePb.setDescription(description);
- instancePb.setSelfLink(instanceId.selfLink());
- instancePb.setZone(instanceId.zoneId().selfLink());
+ instancePb.setSelfLink(instanceId.getSelfLink());
+ instancePb.setZone(instanceId.getZoneId().getSelfLink());
if (status != null) {
instancePb.setStatus(status.name());
}
@@ -625,7 +904,7 @@ Instance toPb() {
instancePb.setTags(tags.toPb());
}
if (machineType != null) {
- instancePb.setMachineType(machineType.selfLink());
+ instancePb.setMachineType(machineType.getSelfLink());
}
instancePb.setCanIpForward(canIpForward);
if (networkInterfaces != null) {
@@ -653,8 +932,17 @@ Instance toPb() {
* Returns a builder for an {@code InstanceInfo} object given the instance identity and the
* machine type.
*/
+ @Deprecated
public static Builder builder(InstanceId instanceId, MachineTypeId machineType) {
- return new BuilderImpl(instanceId).machineType(machineType);
+ return newBuilder(instanceId, machineType);
+ }
+
+ /**
+ * Returns a builder for an {@code InstanceInfo} object given the instance identity and the
+ * machine type.
+ */
+ public static Builder newBuilder(InstanceId instanceId, MachineTypeId machineType) {
+ return new BuilderImpl(instanceId).setMachineType(machineType);
}
/**
@@ -664,9 +952,9 @@ public static Builder builder(InstanceId instanceId, MachineTypeId machineType)
*/
public static InstanceInfo of(InstanceId instanceId, MachineTypeId machineType, AttachedDisk disk,
NetworkInterface networkInterface) {
- return builder(instanceId, machineType)
- .attachedDisks(ImmutableList.of(disk))
- .networkInterfaces(ImmutableList.of(networkInterface))
+ return newBuilder(instanceId, machineType)
+ .setAttachedDisks(ImmutableList.of(disk))
+ .setNetworkInterfaces(ImmutableList.of(networkInterface))
.build();
}
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/License.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/License.java
index dc0e49bace31..d57add1f1a29 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/License.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/License.java
@@ -44,10 +44,18 @@ public class License implements Serializable {
/**
* Returns the identity of the license.
*/
+ @Deprecated
public LicenseId licenseId() {
return licenseId;
}
+ /**
+ * Returns the identity of the license.
+ */
+ public LicenseId getLicenseId() {
+ return licenseId;
+ }
+
/**
* Returns {@code true} if the customer will be charged a license fee for running software that
* contains this license on an instance.
@@ -80,9 +88,9 @@ public final boolean equals(Object obj) {
com.google.api.services.compute.model.License toPb() {
com.google.api.services.compute.model.License licensePb =
new com.google.api.services.compute.model.License();
- licensePb.setName(licenseId.license());
+ licensePb.setName(licenseId.getLicense());
licensePb.setChargesUseFee(chargesUseFee);
- licensePb.setSelfLink(licenseId.selfLink());
+ licensePb.setSelfLink(licenseId.getSelfLink());
return licensePb;
}
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/LicenseId.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/LicenseId.java
index 284572ba58bb..273c36d1050f 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/LicenseId.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/LicenseId.java
@@ -39,7 +39,7 @@ public LicenseId apply(String pb) {
static final Function TO_URL_FUNCTION = new Function() {
@Override
public String apply(LicenseId licenseId) {
- return licenseId.selfLink();
+ return licenseId.getSelfLink();
}
};
@@ -57,13 +57,27 @@ private LicenseId(String project, String license) {
/**
* Returns the name of the license.
*/
+ @Deprecated
public String license() {
return license;
}
+ /**
+ * Returns the name of the license.
+ */
+ public String getLicense() {
+ return license;
+ }
+
@Override
+ @Deprecated
public String selfLink() {
- return super.selfLink() + "/global/licenses/" + license;
+ return getSelfLink();
+ }
+
+ @Override
+ public String getSelfLink() {
+ return super.getSelfLink() + "/global/licenses/" + license;
}
@Override
@@ -90,7 +104,7 @@ public boolean equals(Object obj) {
@Override
LicenseId setProjectId(String projectId) {
- if (project() != null) {
+ if (getProject() != null) {
return this;
}
return LicenseId.of(projectId, license);
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/MachineType.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/MachineType.java
index c850b351c946..4ce7aff7c11d 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/MachineType.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/MachineType.java
@@ -84,52 +84,52 @@ static final class Builder {
private Builder() {}
- Builder machineTypeId(MachineTypeId machineTypeId) {
+ Builder setMachineTypeId(MachineTypeId machineTypeId) {
this.machineTypeId = machineTypeId;
return this;
}
- Builder generatedId(String generatedId) {
+ Builder setGeneratedId(String generatedId) {
this.generatedId = generatedId;
return this;
}
- Builder creationTimestamp(Long creationTimestamp) {
+ Builder setCreationTimestamp(Long creationTimestamp) {
this.creationTimestamp = creationTimestamp;
return this;
}
- Builder description(String description) {
+ Builder setDescription(String description) {
this.description = description;
return this;
}
- Builder cpus(Integer cpus) {
+ Builder setCpus(Integer cpus) {
this.cpus = cpus;
return this;
}
- Builder memoryMb(Integer memoryMb) {
+ Builder setMemoryMb(Integer memoryMb) {
this.memoryMb = memoryMb;
return this;
}
- Builder scratchDisksSizeGb(List scratchDisksSizeGb) {
+ Builder setScratchDisksSizeGb(List scratchDisksSizeGb) {
this.scratchDisksSizeGb = scratchDisksSizeGb;
return this;
}
- Builder maximumPersistentDisks(Integer maximumPersistentDisks) {
+ Builder setMaximumPersistentDisks(Integer maximumPersistentDisks) {
this.maximumPersistentDisks = maximumPersistentDisks;
return this;
}
- Builder maximumPersistentDisksSizeGb(Long maximumPersistentDisksSizeGb) {
+ Builder setMaximumPersistentDisksSizeGb(Long maximumPersistentDisksSizeGb) {
this.maximumPersistentDisksSizeGb = maximumPersistentDisksSizeGb;
return this;
}
- Builder deprecationStatus(DeprecationStatus deprecationStatus) {
+ Builder setDeprecationStatus(DeprecationStatus deprecationStatus) {
this.deprecationStatus = deprecationStatus;
return this;
}
@@ -155,63 +155,135 @@ private MachineType(Builder builder) {
/**
* Returns the machine type's identity.
*/
+ @Deprecated
public MachineTypeId machineTypeId() {
+ return getMachineTypeId();
+ }
+
+ /**
+ * Returns the machine type's identity.
+ */
+ public MachineTypeId getMachineTypeId() {
return machineTypeId;
}
/**
* Returns the service-generated unique identifier for the machine type.
*/
+ @Deprecated
public String generatedId() {
+ return getGeneratedId();
+ }
+
+ /**
+ * Returns the service-generated unique identifier for the machine type.
+ */
+ public String getGeneratedId() {
return generatedId;
}
/**
* Returns the creation timestamp in milliseconds since epoch.
*/
+ @Deprecated
public Long creationTimestamp() {
+ return getCreationTimestamp();
+ }
+
+ /**
+ * Returns the creation timestamp in milliseconds since epoch.
+ */
+ public Long getCreationTimestamp() {
return creationTimestamp;
}
/**
* Returns an optional textual description of the machine type.
*/
+ @Deprecated
public String description() {
+ return getDescription();
+ }
+
+ /**
+ * Returns an optional textual description of the machine type.
+ */
+ public String getDescription() {
return description;
}
/**
* Returns the number of virtual CPUs that are available to the instance.
*/
+ @Deprecated
public Integer cpus() {
+ return getCpus();
+ }
+
+ /**
+ * Returns the number of virtual CPUs that are available to the instance.
+ */
+ public Integer getCpus() {
return cpus;
}
/**
* Returns the amount of physical memory available to the instance, defined in MB.
*/
+ @Deprecated
public Integer memoryMb() {
+ return getMemoryMb();
+ }
+
+ /**
+ * Returns the amount of physical memory available to the instance, defined in MB.
+ */
+ public Integer getMemoryMb() {
return memoryMb;
}
/**
* Returns the size of all extended scratch disks assigned to the instance, defined in GB.
*/
+ @Deprecated
public List scratchDisksSizeGb() {
+ return getScratchDisksSizeGb();
+ }
+
+ /**
+ * Returns the size of all extended scratch disks assigned to the instance, defined in GB.
+ */
+ public List getScratchDisksSizeGb() {
return scratchDisksSizeGb;
}
/**
* Returns the maximum number of persistent disks allowed by this instance type.
*/
+ @Deprecated
public Integer maximumPersistentDisks() {
+ return getMaximumPersistentDisks();
+ }
+
+ /**
+ * Returns the maximum number of persistent disks allowed by this instance type.
+ */
+ public Integer getMaximumPersistentDisks() {
return maximumPersistentDisks;
}
/**
* Returns the maximum total persistent disks size allowed, defined in GB.
*/
+ @Deprecated
public Long maximumPersistentDisksSizeGb() {
+ return getMaximumPersistentDisksSizeGb();
+ }
+
+ /**
+ * Returns the maximum total persistent disks size allowed, defined in GB.
+ */
+ public Long getMaximumPersistentDisksSizeGb() {
return maximumPersistentDisksSizeGb;
}
@@ -221,7 +293,18 @@ public Long maximumPersistentDisksSizeGb() {
* the machine type should not be used. Returns {@code null} if the machine type is not
* deprecated.
*/
+ @Deprecated
public DeprecationStatus deprecationStatus() {
+ return getDeprecationStatus();
+ }
+
+ /**
+ * Returns the deprecation status of the machine type. If {@link DeprecationStatus#status()} is
+ * either {@link DeprecationStatus.Status#DELETED} or {@link DeprecationStatus.Status#OBSOLETE}
+ * the machine type should not be used. Returns {@code null} if the machine type is not
+ * deprecated.
+ */
+ public DeprecationStatus getDeprecationStatus() {
return deprecationStatus;
}
@@ -263,9 +346,9 @@ com.google.api.services.compute.model.MachineType toPb() {
if (creationTimestamp != null) {
machineTypePb.setCreationTimestamp(TIMESTAMP_FORMATTER.print(creationTimestamp));
}
- machineTypePb.setName(machineTypeId.type());
+ machineTypePb.setName(machineTypeId.getType());
machineTypePb.setDescription(description);
- machineTypePb.setSelfLink(machineTypeId.selfLink());
+ machineTypePb.setSelfLink(machineTypeId.getSelfLink());
machineTypePb.setGuestCpus(cpus);
machineTypePb.setMemoryMb(memoryMb);
if (scratchDisksSizeGb != null) {
@@ -279,32 +362,32 @@ public ScratchDisks apply(Integer diskSize) {
}
machineTypePb.setMaximumPersistentDisks(maximumPersistentDisks);
machineTypePb.setMaximumPersistentDisksSizeGb(maximumPersistentDisksSizeGb);
- machineTypePb.setZone(machineTypeId.zoneId().zone());
+ machineTypePb.setZone(machineTypeId.getZoneId().getZone());
if (deprecationStatus != null) {
machineTypePb.setDeprecated(deprecationStatus.toPb());
}
return machineTypePb;
}
- static Builder builder() {
+ static Builder newBuilder() {
return new Builder();
}
static MachineType fromPb(com.google.api.services.compute.model.MachineType machineTypePb) {
- Builder builder = builder();
- builder.machineTypeId(MachineTypeId.fromUrl(machineTypePb.getSelfLink()));
+ Builder builder = newBuilder();
+ builder.setMachineTypeId(MachineTypeId.fromUrl(machineTypePb.getSelfLink()));
if (machineTypePb.getId() != null) {
- builder.generatedId(machineTypePb.getId().toString());
+ builder.setGeneratedId(machineTypePb.getId().toString());
}
if (machineTypePb.getCreationTimestamp() != null) {
- builder.creationTimestamp(
+ builder.setCreationTimestamp(
TIMESTAMP_FORMATTER.parseMillis(machineTypePb.getCreationTimestamp()));
}
- builder.description(machineTypePb.getDescription());
- builder.cpus(machineTypePb.getGuestCpus());
- builder.memoryMb(machineTypePb.getMemoryMb());
+ builder.setDescription(machineTypePb.getDescription());
+ builder.setCpus(machineTypePb.getGuestCpus());
+ builder.setMemoryMb(machineTypePb.getMemoryMb());
if (machineTypePb.getScratchDisks() != null) {
- builder.scratchDisksSizeGb(
+ builder.setScratchDisksSizeGb(
Lists.transform(machineTypePb.getScratchDisks(), new Function() {
@Override
public Integer apply(ScratchDisks scratchDiskPb) {
@@ -312,10 +395,10 @@ public Integer apply(ScratchDisks scratchDiskPb) {
}
}));
}
- builder.maximumPersistentDisks(machineTypePb.getMaximumPersistentDisks());
- builder.maximumPersistentDisksSizeGb(machineTypePb.getMaximumPersistentDisksSizeGb());
+ builder.setMaximumPersistentDisks(machineTypePb.getMaximumPersistentDisks());
+ builder.setMaximumPersistentDisksSizeGb(machineTypePb.getMaximumPersistentDisksSizeGb());
if (machineTypePb.getDeprecated() != null) {
- builder.deprecationStatus(
+ builder.setDeprecationStatus(
DeprecationStatus.fromPb(machineTypePb.getDeprecated(), MachineTypeId.FROM_URL_FUNCTION));
}
return builder.build();
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/MachineTypeId.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/MachineTypeId.java
index bb439c1e29fe..d85bca911ac7 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/MachineTypeId.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/MachineTypeId.java
@@ -41,7 +41,7 @@ public MachineTypeId apply(String pb) {
new Function() {
@Override
public String apply(MachineTypeId machineTypeId) {
- return machineTypeId.selfLink();
+ return machineTypeId.getSelfLink();
}
};
@@ -61,27 +61,57 @@ private MachineTypeId(String project, String zone, String type) {
/**
* Returns the name of the machine type.
*/
+ @Deprecated
public String type() {
+ return getType();
+ }
+
+ /**
+ * Returns the name of the machine type.
+ */
+ public String getType() {
return type;
}
/**
* Returns the name of the zone this machine type belongs to.
*/
+ @Deprecated
public String zone() {
+ return getZone();
+ }
+
+ /**
+ * Returns the name of the zone this machine type belongs to.
+ */
+ public String getZone() {
return zone;
}
/**
* Returns the identity of the zone this machine type belongs to.
*/
+ @Deprecated
public ZoneId zoneId() {
- return ZoneId.of(project(), zone);
+ return getZoneId();
+ }
+
+ /**
+ * Returns the identity of the zone this machine type belongs to.
+ */
+ public ZoneId getZoneId() {
+ return ZoneId.of(getProject(), zone);
}
@Override
+ @Deprecated
public String selfLink() {
- return super.selfLink() + "/zones/" + zone + "/machineTypes/" + type;
+ return getSelfLink();
+ }
+
+ @Override
+ public String getSelfLink() {
+ return super.getSelfLink() + "/zones/" + zone + "/machineTypes/" + type;
}
@Override
@@ -110,7 +140,7 @@ public boolean equals(Object obj) {
@Override
MachineTypeId setProjectId(String projectId) {
- if (project() != null) {
+ if (getProject() != null) {
return this;
}
return MachineTypeId.of(projectId, zone, type);
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/Metadata.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/Metadata.java
index 22ba59834d4b..0c62fc7bda8a 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/Metadata.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/Metadata.java
@@ -83,7 +83,19 @@ public static final class Builder {
* a URL in the metadata server. Additionally, to avoid ambiguity, keys must not conflict with
* any other metadata keys for the project. Values must be less than or equal to 32768 bytes.
*/
+ @Deprecated
public Builder values(Map values) {
+ return setValues(values);
+ }
+
+ /**
+ * Sets the metadata for the instance as key/value pairs. The total size of all keys and
+ * values must be less than 512 KB. Keys must conform to the following regexp:
+ * {@code [a-zA-Z0-9-_]+}, and be less than 128 bytes in length. This is reflected as part of
+ * a URL in the metadata server. Additionally, to avoid ambiguity, keys must not conflict with
+ * any other metadata keys for the project. Values must be less than or equal to 32768 bytes.
+ */
+ public Builder setValues(Map values) {
this.values = Maps.newHashMap(checkNotNull(values));
return this;
}
@@ -104,7 +116,16 @@ public Builder add(String key, String value) {
* Sets the fingerprint for the metadata. This value can be used to update instance's
* metadata.
*/
+ @Deprecated
public Builder fingerprint(String fingerprint) {
+ return setFingerprint(fingerprint);
+ }
+
+ /**
+ * Sets the fingerprint for the metadata. This value can be used to update instance's
+ * metadata.
+ */
+ public Builder setFingerprint(String fingerprint) {
this.fingerprint = fingerprint;
return this;
}
@@ -125,18 +146,35 @@ private Metadata(Builder builder) {
/**
* Returns instance's metadata as key/value pairs.
*/
+ @Deprecated
public Map values() {
return values;
}
+ /**
+ * Returns instance's metadata as key/value pairs.
+ */
+ public Map getValues() {
+ return values;
+ }
+
/**
* Returns the fingerprint for the metadata. This value can be used to update instance's
* metadata.
*/
+ @Deprecated
public String fingerprint() {
return fingerprint;
}
+ /**
+ * Returns the fingerprint for the metadata. This value can be used to update instance's
+ * metadata.
+ */
+ public String getFingerprint() {
+ return fingerprint;
+ }
+
/**
* Returns a builder for the current instance metadata.
*/
@@ -182,7 +220,15 @@ com.google.api.services.compute.model.Metadata toPb() {
/**
* Returns a builder for a {@code Metadata} object.
*/
+ @Deprecated
public static Builder builder() {
+ return newBuilder();
+ }
+
+ /**
+ * Returns a builder for a {@code Metadata} object.
+ */
+ public static Builder newBuilder() {
return new Builder();
}
@@ -194,19 +240,19 @@ public static Builder builder() {
* other metadata keys for the project. Values must be less than or equal to 32768 bytes.
*/
public static Metadata of(Map values) {
- return builder().values(values).build();
+ return newBuilder().setValues(values).build();
}
static Metadata fromPb(com.google.api.services.compute.model.Metadata metadataPb) {
- Builder builder = builder();
+ Builder builder = newBuilder();
if (metadataPb.getItems() != null) {
Map metadataValues =
Maps.newHashMapWithExpectedSize(metadataPb.getItems().size());
for (com.google.api.services.compute.model.Metadata.Items item : metadataPb.getItems()) {
metadataValues.put(item.getKey(), item.getValue());
}
- builder.values(metadataValues);
+ builder.setValues(metadataValues);
}
- return builder.fingerprint(metadataPb.getFingerprint()).build();
+ return builder.setFingerprint(metadataPb.getFingerprint()).build();
}
}
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/Network.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/Network.java
index 51a0287f3fed..3f57619db859 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/Network.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/Network.java
@@ -53,8 +53,8 @@ public static class Builder extends NetworkInfo.Builder {
Builder(Compute compute, NetworkId networkId, NetworkConfiguration configuration) {
this.compute = compute;
this.infoBuilder = new NetworkInfo.BuilderImpl(networkId, configuration);
- this.infoBuilder.networkId(networkId);
- this.infoBuilder.configuration(configuration);
+ this.infoBuilder.setNetworkId(networkId);
+ this.infoBuilder.setConfiguration(configuration);
}
Builder(Network subnetwork) {
@@ -63,32 +63,50 @@ public static class Builder extends NetworkInfo.Builder {
}
@Override
- Builder generatedId(String generatedId) {
- infoBuilder.generatedId(generatedId);
+ Builder setGeneratedId(String generatedId) {
+ infoBuilder.setGeneratedId(generatedId);
return this;
}
@Override
- Builder creationTimestamp(Long creationTimestamp) {
- infoBuilder.creationTimestamp(creationTimestamp);
+ Builder setCreationTimestamp(Long creationTimestamp) {
+ infoBuilder.setCreationTimestamp(creationTimestamp);
return this;
}
@Override
+ @Deprecated
public Builder networkId(NetworkId networkId) {
- infoBuilder.networkId(networkId);
+ return setNetworkId(networkId);
+ }
+
+ @Override
+ public Builder setNetworkId(NetworkId networkId) {
+ infoBuilder.setNetworkId(networkId);
return this;
}
@Override
+ @Deprecated
public Builder description(String description) {
- infoBuilder.description(description);
+ return setDescription(description);
+ }
+
+ @Override
+ public Builder setDescription(String description) {
+ infoBuilder.setDescription(description);
return this;
}
@Override
+ @Deprecated
public Builder configuration(NetworkConfiguration configuration) {
- infoBuilder.configuration(configuration);
+ return setConfiguration(configuration);
+ }
+
+ @Override
+ public Builder setConfiguration(NetworkConfiguration configuration) {
+ infoBuilder.setConfiguration(configuration);
return this;
}
@@ -123,7 +141,7 @@ public boolean exists() {
* @throws ComputeException upon failure
*/
public Network reload(NetworkOption... options) {
- return compute.getNetwork(networkId().network(), options);
+ return compute.getNetwork(getNetworkId().getNetwork(), options);
}
/**
@@ -134,7 +152,7 @@ public Network reload(NetworkOption... options) {
* @throws ComputeException upon failure
*/
public Operation delete(OperationOption... options) {
- return compute.deleteNetwork(networkId().network(), options);
+ return compute.deleteNetwork(getNetworkId().getNetwork(), options);
}
/**
@@ -150,13 +168,21 @@ public Operation delete(OperationOption... options) {
*/
public Operation createSubnetwork(SubnetworkId subnetworkId, String ipRange,
OperationOption... options) {
- return compute.create(SubnetworkInfo.of(subnetworkId, networkId(), ipRange), options);
+ return compute.create(SubnetworkInfo.of(subnetworkId, getNetworkId(), ipRange), options);
}
/**
* Returns the network's {@code Compute} object used to issue requests.
*/
+ @Deprecated
public Compute compute() {
+ return getCompute();
+ }
+
+ /**
+ * Returns the network's {@code Compute} object used to issue requests.
+ */
+ public Compute getCompute() {
return compute;
}
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/NetworkConfiguration.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/NetworkConfiguration.java
index 4a7500f66d07..6728784fadf8 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/NetworkConfiguration.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/NetworkConfiguration.java
@@ -62,7 +62,17 @@ public enum Type {
* with no subnetworks. This method returns {@link Type#SUBNET} for a network that supports the
* creation of subnetworks (either automatic or manual).
*/
+ @Deprecated
public Type type() {
+ return getType();
+ }
+
+ /**
+ * Returns the network's type. This method returns {@link Type#STANDARD} for a standard networks
+ * with no subnetworks. This method returns {@link Type#SUBNET} for a network that supports the
+ * creation of subnetworks (either automatic or manual).
+ */
+ public Type getType() {
return type;
}
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/NetworkId.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/NetworkId.java
index 1108f126588b..298d78ad3d96 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/NetworkId.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/NetworkId.java
@@ -41,8 +41,8 @@ public final class NetworkId extends ResourceId {
}
private NetworkId(NetworkId networkId) {
- super(networkId.project());
- this.network = checkNotNull(networkId.network());
+ super(networkId.getProject());
+ this.network = checkNotNull(networkId.getNetwork());
}
/**
@@ -54,13 +54,33 @@ private NetworkId(NetworkId networkId) {
*
* @see RFC1035
*/
+ @Deprecated
public String network() {
return network;
}
+ /**
+ * Returns the name of the network. The network name must be 1-63 characters long and comply with
+ * RFC1035. Specifically, the name must match the regular expression
+ * {@code [a-z]([-a-z0-9]*[a-z0-9])?} which means the first character must be a lowercase letter,
+ * and all following characters must be a dash, lowercase letter, or digit, except the last
+ * character, which cannot be a dash.
+ *
+ * @see RFC1035
+ */
+ public String getNetwork() {
+ return network;
+ }
+
@Override
+ @Deprecated
public String selfLink() {
- return super.selfLink() + "/global/networks/" + network;
+ return getSelfLink();
+ }
+
+ @Override
+ public String getSelfLink() {
+ return super.getSelfLink() + "/global/networks/" + network;
}
@Override
@@ -87,7 +107,7 @@ public boolean equals(Object obj) {
@Override
NetworkId setProjectId(String projectId) {
- if (project() != null) {
+ if (getProject() != null) {
return this;
}
return NetworkId.of(projectId, network);
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/NetworkInfo.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/NetworkInfo.java
index a7864135b810..74cde200c509 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/NetworkInfo.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/NetworkInfo.java
@@ -71,28 +71,49 @@ public Network apply(NetworkInfo network) {
*/
public abstract static class Builder {
- abstract Builder generatedId(String generatedId);
+ abstract Builder setGeneratedId(String generatedId);
- abstract Builder creationTimestamp(Long creationTimestamp);
+ abstract Builder setCreationTimestamp(Long creationTimestamp);
/**
* Sets the identity of the network.
*/
+ @Deprecated
public abstract Builder networkId(NetworkId networkId);
+ /**
+ * Sets the identity of the network.
+ */
+ public abstract Builder setNetworkId(NetworkId networkId);
+
/**
* Sets an optional textual description of the network.
*/
+ @Deprecated
public abstract Builder description(String description);
+ /**
+ * Sets an optional textual description of the network.
+ */
+ public abstract Builder setDescription(String description);
+
/**
* Sets the network configuration. Use {@link StandardNetworkConfiguration} to create a standard
* network with associated IPv4 range. Use {@link SubnetNetworkConfiguration} to create a
* network that could be divided into subnetworks, up to one per region, each with its own
* address range.
*/
+ @Deprecated
public abstract Builder configuration(NetworkConfiguration configuration);
+ /**
+ * Sets the network configuration. Use {@link StandardNetworkConfiguration} to create a standard
+ * network with associated IPv4 range. Use {@link SubnetNetworkConfiguration} to create a
+ * network that could be divided into subnetworks, up to one per region, each with its own
+ * address range.
+ */
+ public abstract Builder setConfiguration(NetworkConfiguration configuration);
+
/**
* Creates a {@code NetworkInfo} object.
*/
@@ -133,31 +154,49 @@ static final class BuilderImpl extends Builder {
}
@Override
- BuilderImpl generatedId(String generatedId) {
+ BuilderImpl setGeneratedId(String generatedId) {
this.generatedId = generatedId;
return this;
}
@Override
- BuilderImpl creationTimestamp(Long creationTimestamp) {
+ BuilderImpl setCreationTimestamp(Long creationTimestamp) {
this.creationTimestamp = creationTimestamp;
return this;
}
@Override
+ @Deprecated
public BuilderImpl networkId(NetworkId networkId) {
+ return setNetworkId(networkId);
+ }
+
+ @Override
+ public BuilderImpl setNetworkId(NetworkId networkId) {
this.networkId = checkNotNull(networkId);
return this;
}
@Override
+ @Deprecated
public BuilderImpl description(String description) {
+ return setDescription(description);
+ }
+
+ @Override
+ public BuilderImpl setDescription(String description) {
this.description = description;
return this;
}
@Override
+ @Deprecated
public BuilderImpl configuration(NetworkConfiguration configuration) {
+ return setConfiguration(configuration);
+ }
+
+ @Override
+ public BuilderImpl setConfiguration(NetworkConfiguration configuration) {
this.configuration = checkNotNull(configuration);
return this;
}
@@ -179,28 +218,60 @@ public NetworkInfo build() {
/**
* Returns the service-generated unique identifier for the network.
*/
+ @Deprecated
public String generatedId() {
+ return getGeneratedId();
+ }
+
+ /**
+ * Returns the service-generated unique identifier for the network.
+ */
+ public String getGeneratedId() {
return generatedId;
}
/**
* Returns the creation timestamp in milliseconds since epoch.
*/
+ @Deprecated
public Long creationTimestamp() {
+ return getCreationTimestamp();
+ }
+
+ /**
+ * Returns the creation timestamp in milliseconds since epoch.
+ */
+ public Long getCreationTimestamp() {
return creationTimestamp;
}
/**
* Returns the network identity.
*/
+ @Deprecated
public NetworkId networkId() {
+ return getNetworkId();
+ }
+
+ /**
+ * Returns the network identity.
+ */
+ public NetworkId getNetworkId() {
return networkId;
}
/**
* Returns a textual description of the network.
*/
+ @Deprecated
public String description() {
+ return getDescription();
+ }
+
+ /**
+ * Returns a textual description of the network.
+ */
+ public String getDescription() {
return description;
}
@@ -210,7 +281,18 @@ public String description() {
* that could be divided into subnetworks, up to one per region, each with its own address range.
*/
@SuppressWarnings("unchecked")
+ @Deprecated
public T configuration() {
+ return getConfiguration();
+ }
+
+ /**
+ * Returns the network configuration. Returns a {@link StandardNetworkConfiguration} for standard
+ * networks with associated IPv4 range. Returns {@link SubnetNetworkConfiguration} for networks
+ * that could be divided into subnetworks, up to one per region, each with its own address range.
+ */
+ @SuppressWarnings("unchecked")
+ public T getConfiguration() {
return (T) configuration;
}
@@ -247,7 +329,7 @@ public boolean equals(Object obj) {
NetworkInfo setProjectId(String projectId) {
return toBuilder()
- .networkId(networkId.setProjectId(projectId))
+ .setNetworkId(networkId.setProjectId(projectId))
.build();
}
@@ -259,9 +341,9 @@ Network toPb() {
if (creationTimestamp != null) {
networkPb.setCreationTimestamp(TIMESTAMP_FORMATTER.print(creationTimestamp));
}
- networkPb.setName(networkId.network());
+ networkPb.setName(networkId.getNetwork());
networkPb.setDescription(description);
- networkPb.setSelfLink(networkId.selfLink());
+ networkPb.setSelfLink(networkId.getSelfLink());
return networkPb;
}
@@ -271,7 +353,18 @@ Network toPb() {
* associated address range. Use {@link SubnetNetworkConfiguration} to create a network that
* supports subnetworks, up to one per region, each with its own address range.
*/
+ @Deprecated
public static Builder builder(NetworkId networkId, NetworkConfiguration configuration) {
+ return newBuilder(networkId, configuration);
+ }
+
+ /**
+ * Returns a builder for a {@code NetworkInfo} object given the network identity and its
+ * configuration. Use {@link StandardNetworkConfiguration} to create a standard network with
+ * associated address range. Use {@link SubnetNetworkConfiguration} to create a network that
+ * supports subnetworks, up to one per region, each with its own address range.
+ */
+ public static Builder newBuilder(NetworkId networkId, NetworkConfiguration configuration) {
return new BuilderImpl(networkId, configuration);
}
@@ -282,7 +375,7 @@ public static Builder builder(NetworkId networkId, NetworkConfiguration configur
* to one per region, each with its own address range.
*/
public static NetworkInfo of(NetworkId networkId, NetworkConfiguration configuration) {
- return builder(networkId, configuration).build();
+ return newBuilder(networkId, configuration).build();
}
static NetworkInfo fromPb(Network networkPb) {
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/NetworkInterface.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/NetworkInterface.java
index 06964f6641af..13d8652ace36 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/NetworkInterface.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/NetworkInterface.java
@@ -127,7 +127,15 @@ private Builder(AccessConfig accessConfig) {
/**
* Sets the name of the access configuration.
*/
+ @Deprecated
public Builder name(String name) {
+ return setName(name);
+ }
+
+ /**
+ * Sets the name of the access configuration.
+ */
+ public Builder setName(String name) {
this.name = name;
return this;
}
@@ -144,7 +152,24 @@ public Builder name(String name) {
* href="https://cloud.google.com/compute/docs/instances-and-network#ephemeraladdress">
* Ephemeral external IP addresses
*/
+ @Deprecated
public Builder natIp(String natIp) {
+ return setNatIp(natIp);
+ }
+
+ /**
+ * Sets an external IP address associated with this instance. Specify an unused static
+ * external IP address available to the project or leave this field undefined to use an IP
+ * from a shared ephemeral IP address pool. If you specify a static external IP address, it
+ * must live in the same region as the zone of the instance.
+ *
+ * @see
+ * Ephemeral external IP addresses
+ * @see
+ * Ephemeral external IP addresses
+ */
+ public Builder setNatIp(String natIp) {
this.natIp = natIp;
return this;
}
@@ -153,7 +178,16 @@ public Builder natIp(String natIp) {
* Sets the type of the access configuration. The only supported value is
* {@link Type#ONE_TO_ONE_NAT}.
*/
+ @Deprecated
public Builder type(Type type) {
+ return setType(type);
+ }
+
+ /**
+ * Sets the type of the access configuration. The only supported value is
+ * {@link Type#ONE_TO_ONE_NAT}.
+ */
+ public Builder setType(Type type) {
this.type = type;
return this;
}
@@ -175,14 +209,30 @@ public AccessConfig build() {
/**
* Returns the name of the access configuration.
*/
+ @Deprecated
public String name() {
+ return getName();
+ }
+
+ /**
+ * Returns the name of the access configuration.
+ */
+ public String getName() {
return name;
}
/**
* Returns an external IP address associated with this instance.
*/
+ @Deprecated
public String natIp() {
+ return getNatIp();
+ }
+
+ /**
+ * Returns an external IP address associated with this instance.
+ */
+ public String getNatIp() {
return natIp;
}
@@ -190,7 +240,16 @@ public String natIp() {
* Returns the type of network access configuration. The only supported value is
* {@link Type#ONE_TO_ONE_NAT}.
*/
+ @Deprecated
public Type type() {
+ return getType();
+ }
+
+ /**
+ * Returns the type of network access configuration. The only supported value is
+ * {@link Type#ONE_TO_ONE_NAT}.
+ */
+ public Type getType() {
return type;
}
@@ -236,7 +295,15 @@ com.google.api.services.compute.model.AccessConfig toPb() {
/**
* Returns a builder for an {@code AccessConfig} object.
*/
+ @Deprecated
public static Builder builder() {
+ return newBuilder();
+ }
+
+ /**
+ * Returns a builder for an {@code AccessConfig} object.
+ */
+ public static Builder newBuilder() {
return new Builder();
}
@@ -247,7 +314,7 @@ public static Builder builder() {
* Static external IP addresses
*/
public static AccessConfig of(String natIp) {
- return builder().natIp(natIp).build();
+ return newBuilder().setNatIp(natIp).build();
}
/**
@@ -258,17 +325,17 @@ public static AccessConfig of(String natIp) {
* Ephemeral external IP addresses
*/
public static AccessConfig of() {
- return builder().build();
+ return newBuilder().build();
}
static AccessConfig fromPb(com.google.api.services.compute.model.AccessConfig configPb) {
- Builder builder = builder();
- builder.name(configPb.getName());
+ Builder builder = newBuilder();
+ builder.setName(configPb.getName());
if (configPb.getNatIP() != null) {
- builder.natIp(configPb.getNatIP());
+ builder.setNatIp(configPb.getNatIP());
}
if (configPb.getType() != null) {
- builder.type(Type.valueOf(configPb.getType()));
+ builder.setType(Type.valueOf(configPb.getType()));
}
return builder.build();
}
@@ -294,7 +361,7 @@ private Builder(NetworkInterface networkInterface) {
this.accessConfigurations = networkInterface.accessConfigurations;
}
- Builder name(String name) {
+ Builder setName(String name) {
this.name = name;
return this;
}
@@ -302,12 +369,20 @@ Builder name(String name) {
/**
* Sets the identity of the network this interface applies to.
*/
+ @Deprecated
public Builder network(NetworkId network) {
+ return setNetwork(network);
+ }
+
+ /**
+ * Sets the identity of the network this interface applies to.
+ */
+ public Builder setNetwork(NetworkId network) {
this.network = checkNotNull(network);
return this;
}
- Builder networkIp(String networkIp) {
+ Builder setNetworkIp(String networkIp) {
this.networkIp = networkIp;
return this;
}
@@ -316,7 +391,16 @@ Builder networkIp(String networkIp) {
* Sets the identity of the subnetwork this interface applies to. Setting the subnetwork is
* not necessary when the network is in "automatic subnet mode".
*/
+ @Deprecated
public Builder subnetwork(SubnetworkId subnetwork) {
+ return setSubnetwork(subnetwork);
+ }
+
+ /**
+ * Sets the identity of the subnetwork this interface applies to. Setting the subnetwork is
+ * not necessary when the network is in "automatic subnet mode".
+ */
+ public Builder setSubnetwork(SubnetworkId subnetwork) {
this.subnetwork = subnetwork;
return this;
}
@@ -331,7 +415,22 @@ public Builder subnetwork(SubnetworkId subnetwork) {
* @see
* Ephemeral external IP addresses
*/
+ @Deprecated
public Builder accessConfigurations(List accessConfigurations) {
+ return setAccessConfigurations(accessConfigurations);
+ }
+
+ /**
+ * Sets a list of access configurations for the network interface. Access configurations can be
+ * used to assign either a static or an ephemeral external IP address to Google Compute Engine
+ * instances. At the moment, network interfaces only support one access configuration.
+ *
+ * @see
+ * Static external IP addresses
+ * @see
+ * Ephemeral external IP addresses
+ */
+ public Builder setAccessConfigurations(List accessConfigurations) {
this.accessConfigurations = ImmutableList.copyOf(accessConfigurations);
return this;
}
@@ -346,8 +445,23 @@ public Builder accessConfigurations(List accessConfigurations) {
* @see
* Ephemeral external IP addresses
*/
+ @Deprecated
public Builder accessConfigurations(AccessConfig... accessConfigurations) {
- accessConfigurations(Arrays.asList(accessConfigurations));
+ return setAccessConfigurations(accessConfigurations);
+ }
+
+ /**
+ * Sets a list of access configurations for the network interface. Access configurations can be
+ * used to assign either a static or an ephemeral external IP address to Google Compute Engine
+ * instances. At the moment, network interfaces only support one access configuration.
+ *
+ * @see
+ * Static external IP addresses
+ * @see
+ * Ephemeral external IP addresses
+ */
+ public Builder setAccessConfigurations(AccessConfig... accessConfigurations) {
+ setAccessConfigurations(Arrays.asList(accessConfigurations));
return this;
}
@@ -372,14 +486,31 @@ private NetworkInterface(Builder builder) {
* Returns the name of the network interface, generated by the service. For network devices,
* these are {@code eth0}, {@code eth1}, etc.
*/
+ @Deprecated
public String name() {
+ return getName();
+ }
+
+ /**
+ * Returns the name of the network interface, generated by the service. For network devices,
+ * these are {@code eth0}, {@code eth1}, etc.
+ */
+ public String getName() {
return name;
}
/**
* Returns the identity of the network this interface applies to.
*/
+ @Deprecated
public NetworkId network() {
+ return getNetwork();
+ }
+
+ /**
+ * Returns the identity of the network this interface applies to.
+ */
+ public NetworkId getNetwork() {
return network;
}
@@ -387,21 +518,46 @@ public NetworkId network() {
* An optional IPv4 internal network address assigned by the service to the instance for this
* network interface.
*/
+ @Deprecated
public String networkIp() {
+ return getNetworkIp();
+ }
+
+ /**
+ * An optional IPv4 internal network address assigned by the service to the instance for this
+ * network interface.
+ */
+ public String getNetworkIp() {
return networkIp;
}
/**
* Returns the identity of the subnetwork this interface applies to.
*/
+ @Deprecated
public SubnetworkId subnetwork() {
+ return getSubnetwork();
+ }
+
+ /**
+ * Returns the identity of the subnetwork this interface applies to.
+ */
+ public SubnetworkId getSubnetwork() {
return subnetwork;
}
/**
* Returns a list of access configurations for the network interface.
*/
+ @Deprecated
public List accessConfigurations() {
+ return getAccessConfigurations();
+ }
+
+ /**
+ * Returns a list of access configurations for the network interface.
+ */
+ public List getAccessConfigurations() {
return accessConfigurations;
}
@@ -440,9 +596,9 @@ com.google.api.services.compute.model.NetworkInterface toPb() {
com.google.api.services.compute.model.NetworkInterface interfacePb =
new com.google.api.services.compute.model.NetworkInterface();
interfacePb.setName(name);
- interfacePb.setNetwork(network.selfLink());
+ interfacePb.setNetwork(network.getSelfLink());
if (subnetwork != null) {
- interfacePb.setSubnetwork(subnetwork.selfLink());
+ interfacePb.setSubnetwork(subnetwork.getSelfLink());
}
interfacePb.setNetworkIP(networkIp);
if (accessConfigurations != null) {
@@ -454,9 +610,9 @@ com.google.api.services.compute.model.NetworkInterface toPb() {
NetworkInterface setProjectId(String projectId) {
Builder builder = toBuilder();
- builder.network(network.setProjectId(projectId));
+ builder.setNetwork(network.setProjectId(projectId));
if (subnetwork != null) {
- builder.subnetwork(subnetwork.setProjectId(projectId));
+ builder.setSubnetwork(subnetwork.setProjectId(projectId));
}
return builder.build();
}
@@ -464,40 +620,56 @@ NetworkInterface setProjectId(String projectId) {
/**
* Returns a builder for a {@code NetworkInterface} object given the network's identity.
*/
+ @Deprecated
public static Builder builder(NetworkId networkId) {
+ return newBuilder(networkId);
+ }
+
+ /**
+ * Returns a builder for a {@code NetworkInterface} object given the network's identity.
+ */
+ public static Builder newBuilder(NetworkId networkId) {
return new Builder(networkId);
}
/**
* Returns a builder for a {@code NetworkInterface} object given the network's name.
*/
+ @Deprecated
public static Builder builder(String network) {
- return builder(NetworkId.of(network));
+ return newBuilder(network);
+ }
+
+ /**
+ * Returns a builder for a {@code NetworkInterface} object given the network's name.
+ */
+ public static Builder newBuilder(String network) {
+ return newBuilder(NetworkId.of(network));
}
/**
* Returns a {@code NetworkInterface} object given the network's identity.
*/
public static NetworkInterface of(NetworkId networkId) {
- return builder(networkId).build();
+ return newBuilder(networkId).build();
}
/**
* Returns a {@code NetworkInterface} object given the network's name.
*/
public static NetworkInterface of(String network) {
- return builder(network).build();
+ return newBuilder(network).build();
}
static NetworkInterface fromPb(
com.google.api.services.compute.model.NetworkInterface interfacePb) {
- Builder builder = builder(NetworkId.fromUrl(interfacePb.getNetwork()))
- .name(interfacePb.getName());
+ Builder builder = newBuilder(NetworkId.fromUrl(interfacePb.getNetwork()))
+ .setName(interfacePb.getName());
if (interfacePb.getSubnetwork() != null) {
- builder.subnetwork(SubnetworkId.fromUrl(interfacePb.getSubnetwork()));
+ builder.setSubnetwork(SubnetworkId.fromUrl(interfacePb.getSubnetwork()));
}
- builder.networkIp(interfacePb.getNetworkIP());
- builder.accessConfigurations(interfacePb.getAccessConfigs() != null
+ builder.setNetworkIp(interfacePb.getNetworkIP());
+ builder.setAccessConfigurations(interfacePb.getAccessConfigs() != null
? Lists.transform(interfacePb.getAccessConfigs(), AccessConfig.FROM_PB_FUNCTION) :
ImmutableList.of());
return builder.build();
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/Operation.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/Operation.java
index 78752e9cdaeb..c1034bc2de77 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/Operation.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/Operation.java
@@ -124,21 +124,45 @@ public com.google.api.services.compute.model.Operation.Error.Errors apply(
/**
* Returns an error type identifier for this error.
*/
+ @Deprecated
public String code() {
+ return getCode();
+ }
+
+ /**
+ * Returns an error type identifier for this error.
+ */
+ public String getCode() {
return code;
}
/**
* Returns the field in the request which caused the error. This value is optional.
*/
+ @Deprecated
public String location() {
+ return getLocation();
+ }
+
+ /**
+ * Returns the field in the request which caused the error. This value is optional.
+ */
+ public String getLocation() {
return location;
}
/**
* Returns an optional, human-readable error message.
*/
+ @Deprecated
public String message() {
+ return getMessage();
+ }
+
+ /**
+ * Returns an optional, human-readable error message.
+ */
+ public String getMessage() {
return message;
}
@@ -221,14 +245,31 @@ public com.google.api.services.compute.model.Operation.Warnings apply(
* Returns a warning identifier for this warning. For example, {@code NO_RESULTS_ON_PAGE} if
* there are no results in the response.
*/
+ @Deprecated
public String code() {
+ return getCode();
+ }
+
+ /**
+ * Returns a warning identifier for this warning. For example, {@code NO_RESULTS_ON_PAGE} if
+ * there are no results in the response.
+ */
+ public String getCode() {
return code;
}
/**
* Returns a human-readable error message.
*/
+ @Deprecated
public String message() {
+ return getMessage();
+ }
+
+ /**
+ * Returns a human-readable error message.
+ */
+ public String getMessage() {
return message;
}
@@ -240,7 +281,20 @@ public String message() {
* or a warning about invalid network settings (for example, if an instance attempts to perform
* IP forwarding but is not enabled for IP forwarding).
*/
+ @Deprecated
public Map metadata() {
+ return getMetadata();
+ }
+
+ /**
+ * Returns metadata about this warning. Each key provides more detail on the warning being
+ * returned. For example, for warnings where there are no results in a list request for a
+ * particular zone, this key might be {@code scope} and the key's value might be the zone name.
+ * Other examples might be a key indicating a deprecated resource, and a suggested replacement,
+ * or a warning about invalid network settings (for example, if an instance attempts to perform
+ * IP forwarding but is not enabled for IP forwarding).
+ */
+ public Map getMetadata() {
return metadata;
}
@@ -368,92 +422,92 @@ static final class Builder {
description = operationPb.getDescription();
}
- Builder generatedId(String generatedId) {
+ Builder getGeneratedId(String generatedId) {
this.generatedId = generatedId;
return this;
}
- Builder operationId(OperationId operationId) {
+ Builder setOperationId(OperationId operationId) {
this.operationId = checkNotNull(operationId);
return this;
}
- Builder clientOperationId(String clientOperationId) {
+ Builder setClientOperationId(String clientOperationId) {
this.clientOperationId = clientOperationId;
return this;
}
- Builder operationType(String operationType) {
+ Builder setOperationType(String operationType) {
this.operationType = operationType;
return this;
}
- Builder targetLink(String targetLink) {
+ Builder setTargetLink(String targetLink) {
this.targetLink = targetLink;
return this;
}
- Builder targetId(String targetId) {
+ Builder setTargetId(String targetId) {
this.targetId = targetId;
return this;
}
- Builder status(Status status) {
+ Builder setStatus(Status status) {
this.status = status;
return this;
}
- Builder statusMessage(String statusMessage) {
+ Builder setStatusMessage(String statusMessage) {
this.statusMessage = statusMessage;
return this;
}
- Builder user(String user) {
+ Builder setUser(String user) {
this.user = user;
return this;
}
- Builder progress(Integer progress) {
+ Builder setProgress(Integer progress) {
this.progress = progress;
return this;
}
- Builder insertTime(Long insertTime) {
+ Builder setInsertTime(Long insertTime) {
this.insertTime = insertTime;
return this;
}
- Builder startTime(Long startTime) {
+ Builder setStartTime(Long startTime) {
this.startTime = startTime;
return this;
}
- Builder endTime(Long endTime) {
+ Builder setEndTime(Long endTime) {
this.endTime = endTime;
return this;
}
- Builder errors(List errors) {
+ Builder setErrors(List errors) {
this.errors = ImmutableList.copyOf(checkNotNull(errors));
return this;
}
- Builder warnings(List warnings) {
+ Builder setWarnings(List warnings) {
this.warnings = ImmutableList.copyOf(checkNotNull(warnings));
return this;
}
- Builder httpErrorStatusCode(Integer httpErrorStatusCode) {
+ Builder setHttpErrorStatusCode(Integer httpErrorStatusCode) {
this.httpErrorStatusCode = httpErrorStatusCode;
return this;
}
- Builder httpErrorMessage(String httpErrorMessage) {
+ Builder setHttpErrorMessage(String httpErrorMessage) {
this.httpErrorMessage = httpErrorMessage;
return this;
}
- Builder description(String description) {
+ Builder setDescription(String description) {
this.description = description;
return this;
}
@@ -489,14 +543,30 @@ private Operation(Builder builder) {
/**
* Returns the operation's {@code Compute} object used to issue requests.
*/
+ @Deprecated
public Compute compute() {
+ return getCompute();
+ }
+
+ /**
+ * Returns the operation's {@code Compute} object used to issue requests.
+ */
+ public Compute getCompute() {
return compute;
}
/**
* Returns the service-generated unique identifier for the operation.
*/
+ @Deprecated
public String generatedId() {
+ return getGeneratedId();
+ }
+
+ /**
+ * Returns the service-generated unique identifier for the operation.
+ */
+ public String getGeneratedId() {
return generatedId;
}
@@ -508,28 +578,57 @@ public String generatedId() {
* @see RFC1035
*/
@SuppressWarnings("unchecked")
+ @Deprecated
public T operationId() {
+ return getOperationId();
+ }
+
+ /**
+ * Returns the operation's identity. This method returns an {@link GlobalOperationId} for global
+ * operations, a {@link RegionOperationId} for region operations and a {@link ZoneOperationId} for
+ * zone operations.
+ *
+ * @see RFC1035
+ */
+ @SuppressWarnings("unchecked")
+ public T getOperationId() {
return (T) operationId;
}
/**
* Reserved for future use.
*/
- String clientOperationId() {
+ String getClientOperationId() {
return clientOperationId;
}
/**
* Returns the type of operation.
*/
+ @Deprecated
public String operationType() {
+ return getOperationType();
+ }
+
+ /**
+ * Returns the type of operation.
+ */
+ public String getOperationType() {
return operationType;
}
/**
* Returns the URL of the resource that the operation is modifying.
*/
+ @Deprecated
public String targetLink() {
+ return getTargetLink();
+ }
+
+ /**
+ * Returns the URL of the resource that the operation is modifying.
+ */
+ public String getTargetLink() {
return targetLink;
}
@@ -537,28 +636,61 @@ public String targetLink() {
* Returns the unique service-defined target ID, which identifies the resource that the operation
* is modifying.
*/
+ @Deprecated
public String targetId() {
+ return getTargetId();
+ }
+
+ /**
+ * Returns the unique service-defined target ID, which identifies the resource that the operation
+ * is modifying.
+ */
+ public String getTargetId() {
return targetId;
}
/**
* Returns the status of the operation.
*/
+ @Deprecated
public Status status() {
+ return getStatus();
+ }
+
+ /**
+ * Returns the status of the operation.
+ */
+ public Status getStatus() {
return status;
}
/**
* Returns an optional textual description of the current status of the operation.
*/
+ @Deprecated
public String statusMessage() {
+ return getStatusMessage();
+ }
+
+ /**
+ * Returns an optional textual description of the current status of the operation.
+ */
+ public String getStatusMessage() {
return statusMessage;
}
/**
* Returns the user who requested the operation, for example: {@code user@example.com}.
*/
+ @Deprecated
public String user() {
+ return getUser();
+ }
+
+ /**
+ * Returns the user who requested the operation, for example: {@code user@example.com}.
+ */
+ public String getUser() {
return user;
}
@@ -568,14 +700,33 @@ public String user() {
* the operation will be complete. This number should monotonically increase as the operation
* progresses.
*/
+ @Deprecated
public Integer progress() {
+ return getProgress();
+ }
+
+ /**
+ * Returns an optional progress indicator that ranges from 0 to 100. There is no requirement that
+ * this be linear or support any granularity of operations. This should not be used to guess when
+ * the operation will be complete. This number should monotonically increase as the operation
+ * progresses.
+ */
+ public Integer getProgress() {
return progress;
}
/**
* Returns the time that this operation was requested. In milliseconds since epoch.
*/
+ @Deprecated
public Long insertTime() {
+ return getInsertTime();
+ }
+
+ /**
+ * Returns the time that this operation was requested. In milliseconds since epoch.
+ */
+ public Long getInsertTime() {
return insertTime;
}
@@ -583,7 +734,16 @@ public Long insertTime() {
* Returns the time that this operation was started by the service. In milliseconds since epoch.
* This value will be {@code null} if the operation has not started yet.
*/
+ @Deprecated
public Long startTime() {
+ return getStartTime();
+ }
+
+ /**
+ * Returns the time that this operation was started by the service. In milliseconds since epoch.
+ * This value will be {@code null} if the operation has not started yet.
+ */
+ public Long getStartTime() {
return startTime;
}
@@ -591,7 +751,16 @@ public Long startTime() {
* Returns the time that this operation was completed. In milliseconds since epoch. This value
* will be {@code null} if the operation has not finished yet.
*/
+ @Deprecated
public Long endTime() {
+ return getEndTime();
+ }
+
+ /**
+ * Returns the time that this operation was completed. In milliseconds since epoch. This value
+ * will be {@code null} if the operation has not finished yet.
+ */
+ public Long getEndTime() {
return endTime;
}
@@ -599,7 +768,16 @@ public Long endTime() {
* Returns the errors encountered while processing this operation, if any. Returns {@code null} if
* no error occurred.
*/
+ @Deprecated
public List errors() {
+ return getErrors();
+ }
+
+ /**
+ * Returns the errors encountered while processing this operation, if any. Returns {@code null} if
+ * no error occurred.
+ */
+ public List getErrors() {
return errors;
}
@@ -607,7 +785,16 @@ public List errors() {
* Returns the warnings encountered while processing this operation, if any. Returns {@code null}
* if no warning occurred.
*/
+ @Deprecated
public List warnings() {
+ return getWarnings();
+ }
+
+ /**
+ * Returns the warnings encountered while processing this operation, if any. Returns {@code null}
+ * if no warning occurred.
+ */
+ public List getWarnings() {
return warnings;
}
@@ -615,7 +802,16 @@ public List warnings() {
* Returns the HTTP error status code that was returned, if the operation failed. For example, a
* {@code 404} means the resource was not found.
*/
+ @Deprecated
public Integer httpErrorStatusCode() {
+ return getHttpErrorStatusCode();
+ }
+
+ /**
+ * Returns the HTTP error status code that was returned, if the operation failed. For example, a
+ * {@code 404} means the resource was not found.
+ */
+ public Integer getHttpErrorStatusCode() {
return httpErrorStatusCode;
}
@@ -623,14 +819,31 @@ public Integer httpErrorStatusCode() {
* Returns the the HTTP error message that was returned, if the operation failed. For example, a
* {@code NOT FOUND} message is returned if the resource was not found.
*/
+ @Deprecated
public String httpErrorMessage() {
+ return getHttpErrorMessage();
+ }
+
+ /**
+ * Returns the the HTTP error message that was returned, if the operation failed. For example, a
+ * {@code NOT FOUND} message is returned if the resource was not found.
+ */
+ public String getHttpErrorMessage() {
return httpErrorMessage;
}
/**
* Returns an optional textual description of the operation.
*/
+ @Deprecated
public String description() {
+ return getDescription();
+ }
+
+ /**
+ * Returns an optional textual description of the operation.
+ */
+ public String getDescription() {
return description;
}
@@ -660,7 +873,7 @@ public boolean exists() {
public boolean isDone() {
Operation operation = compute.getOperation(operationId,
OperationOption.fields(Compute.OperationField.STATUS));
- return operation == null || operation.status() == Status.DONE;
+ return operation == null || operation.getStatus() == Status.DONE;
}
/**
@@ -788,14 +1001,14 @@ com.google.api.services.compute.model.Operation toPb() {
if (generatedId != null) {
operationPb.setId(new BigInteger(generatedId));
}
- operationPb.setName(operationId.operation());
+ operationPb.setName(operationId.getOperation());
operationPb.setClientOperationId(clientOperationId);
- switch (operationId.type()) {
+ switch (operationId.getType()) {
case REGION:
- operationPb.setRegion(this.operationId().regionId().selfLink());
+ operationPb.setRegion(this.getOperationId().getRegionId().getSelfLink());
break;
case ZONE:
- operationPb.setZone(this.operationId().zoneId().selfLink());
+ operationPb.setZone(this.getOperationId().getZoneId().getSelfLink());
break;
}
if (operationType != null) {
@@ -829,7 +1042,7 @@ com.google.api.services.compute.model.Operation toPb() {
}
operationPb.setHttpErrorStatusCode(httpErrorStatusCode);
operationPb.setHttpErrorMessage(httpErrorMessage);
- operationPb.setSelfLink(operationId.selfLink());
+ operationPb.setSelfLink(operationId.getSelfLink());
operationPb.setDescription(description);
return operationPb;
}
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/OperationId.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/OperationId.java
index 2a3dc2a28d76..d6f7ddd5dfaf 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/OperationId.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/OperationId.java
@@ -62,12 +62,26 @@ enum Type {
/**
* Returns the type of this operation identity.
*/
+ @Deprecated
public abstract Type type();
+ /**
+ * Returns the type of this operation identity.
+ */
+ public abstract Type getType();
+
/**
* Returns the name of the operation resource.
*/
+ @Deprecated
public String operation() {
+ return getOperation();
+ }
+
+ /**
+ * Returns the name of the operation resource.
+ */
+ public String getOperation() {
return operation;
}
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/Option.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/Option.java
index de8676b2ac79..1e96726ca83d 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/Option.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/Option.java
@@ -39,11 +39,11 @@ class Option implements Serializable {
this.value = value;
}
- ComputeRpc.Option rpcOption() {
+ ComputeRpc.Option getRpcOption() {
return rpcOption;
}
- Object value() {
+ Object getValue() {
return value;
}
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/Region.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/Region.java
index 85845283010c..70c1c5b880c2 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/Region.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/Region.java
@@ -108,21 +108,45 @@ public com.google.api.services.compute.model.Quota apply(Quota quota) {
/**
* Returns the name of the quota metric.
*/
+ @Deprecated
public String metric() {
+ return getMetric();
+ }
+
+ /**
+ * Returns the name of the quota metric.
+ */
+ public String getMetric() {
return metric;
}
/**
* Returns the quota limit for this metric.
*/
+ @Deprecated
public double limit() {
+ return getLimit();
+ }
+
+ /**
+ * Returns the quota limit for this metric.
+ */
+ public double getLimit() {
return limit;
}
/**
* Returns the current usage for this quota.
*/
+ @Deprecated
public double usage() {
+ return getUsage();
+ }
+
+ /**
+ * Returns the current usage for this quota.
+ */
+ public double getUsage() {
return usage;
}
@@ -177,42 +201,42 @@ static final class Builder {
private Builder() {}
- Builder regionId(RegionId regionId) {
+ Builder setRegionId(RegionId regionId) {
this.regionId = regionId;
return this;
}
- Builder generatedId(String generatedId) {
+ Builder setGeneratedId(String generatedId) {
this.generatedId = generatedId;
return this;
}
- Builder creationTimestamp(Long creationTimestamp) {
+ Builder setCreationTimestamp(Long creationTimestamp) {
this.creationTimestamp = creationTimestamp;
return this;
}
- Builder description(String description) {
+ Builder setDescription(String description) {
this.description = description;
return this;
}
- Builder status(Status status) {
+ Builder setStatus(Status status) {
this.status = status;
return this;
}
- Builder zones(List zones) {
+ Builder setZones(List zones) {
this.zones = ImmutableList.copyOf(zones);
return this;
}
- Builder quotas(List quotas) {
+ Builder setQuotas(List quotas) {
this.quotas = ImmutableList.copyOf(quotas);
return this;
}
- Builder deprecationStatus(DeprecationStatus deprecationStatus) {
+ Builder setDeprecationStatus(DeprecationStatus deprecationStatus) {
this.deprecationStatus = deprecationStatus;
return this;
}
@@ -236,49 +260,105 @@ private Region(Builder builder) {
/**
* Returns the region's identity.
*/
+ @Deprecated
public RegionId regionId() {
+ return getRegionId();
+ }
+
+ /**
+ * Returns the region's identity.
+ */
+ public RegionId getRegionId() {
return regionId;
}
/**
* Returns the service-generated unique identifier for the region.
*/
+ @Deprecated
public String generatedId() {
+ return getGeneratedId();
+ }
+
+ /**
+ * Returns the service-generated unique identifier for the region.
+ */
+ public String getGeneratedId() {
return generatedId;
}
/**
* Returns the creation timestamp in milliseconds since epoch.
*/
+ @Deprecated
public Long creationTimestamp() {
+ return getCreationTimestamp();
+ }
+
+ /**
+ * Returns the creation timestamp in milliseconds since epoch.
+ */
+ public Long getCreationTimestamp() {
return creationTimestamp;
}
/**
* Returns an optional textual description of the region.
*/
+ @Deprecated
public String description() {
+ return getDescription();
+ }
+
+ /**
+ * Returns an optional textual description of the region.
+ */
+ public String getDescription() {
return description;
}
/**
* Returns the status of the status.
*/
+ @Deprecated
public Status status() {
+ return getStatus();
+ }
+
+ /**
+ * Returns the status of the status.
+ */
+ public Status getStatus() {
return status;
}
/**
* Returns a list of identities of zones available in this region.
*/
+ @Deprecated
public List zones() {
+ return getZones();
+ }
+
+ /**
+ * Returns a list of identities of zones available in this region.
+ */
+ public List getZones() {
return zones;
}
/**
* Returns quotas assigned to this region.
*/
+ @Deprecated
public List quotas() {
+ return getQuotas();
+ }
+
+ /**
+ * Returns quotas assigned to this region.
+ */
+ public List getQuotas() {
return quotas;
}
@@ -287,7 +367,17 @@ public List quotas() {
* {@link DeprecationStatus.Status#DELETED} or {@link DeprecationStatus.Status#OBSOLETE} the
* region should not be used. Returns {@code null} if the region is not deprecated.
*/
+ @Deprecated
public DeprecationStatus deprecationStatus() {
+ return getDeprecationStatus();
+ }
+
+ /**
+ * Returns the deprecation status of the region. If {@link DeprecationStatus#status()} is either
+ * {@link DeprecationStatus.Status#DELETED} or {@link DeprecationStatus.Status#OBSOLETE} the
+ * region should not be used. Returns {@code null} if the region is not deprecated.
+ */
+ public DeprecationStatus getDeprecationStatus() {
return deprecationStatus;
}
@@ -327,9 +417,9 @@ com.google.api.services.compute.model.Region toPb() {
if (creationTimestamp != null) {
regionPb.setCreationTimestamp(TIMESTAMP_FORMATTER.print(creationTimestamp));
}
- regionPb.setName(regionId.region());
+ regionPb.setName(regionId.getRegion());
regionPb.setDescription(description);
- regionPb.setSelfLink(regionId.selfLink());
+ regionPb.setSelfLink(regionId.getSelfLink());
if (status != null) {
regionPb.setStatus(status.name());
}
@@ -351,25 +441,26 @@ static Builder builder() {
static Region fromPb(com.google.api.services.compute.model.Region regionPb) {
Builder builder = builder();
- builder.regionId(RegionId.fromUrl(regionPb.getSelfLink()));
+ builder.setRegionId(RegionId.fromUrl(regionPb.getSelfLink()));
if (regionPb.getId() != null) {
- builder.generatedId(regionPb.getId().toString());
+ builder.setGeneratedId(regionPb.getId().toString());
}
if (regionPb.getCreationTimestamp() != null) {
- builder.creationTimestamp(TIMESTAMP_FORMATTER.parseMillis(regionPb.getCreationTimestamp()));
+ builder.setCreationTimestamp(
+ TIMESTAMP_FORMATTER.parseMillis(regionPb.getCreationTimestamp()));
}
- builder.description(regionPb.getDescription());
+ builder.setDescription(regionPb.getDescription());
if (regionPb.getStatus() != null) {
- builder.status(Status.valueOf(regionPb.getStatus()));
+ builder.setStatus(Status.valueOf(regionPb.getStatus()));
}
if (regionPb.getZones() != null) {
- builder.zones(Lists.transform(regionPb.getZones(), ZoneId.FROM_URL_FUNCTION));
+ builder.setZones(Lists.transform(regionPb.getZones(), ZoneId.FROM_URL_FUNCTION));
}
if (regionPb.getQuotas() != null) {
- builder.quotas(Lists.transform(regionPb.getQuotas(), Quota.FROM_PB_FUNCTION));
+ builder.setQuotas(Lists.transform(regionPb.getQuotas(), Quota.FROM_PB_FUNCTION));
}
if (regionPb.getDeprecated() != null) {
- builder.deprecationStatus(
+ builder.setDeprecationStatus(
DeprecationStatus.fromPb(regionPb.getDeprecated(), RegionId.FROM_URL_FUNCTION));
}
return builder.build();
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/RegionAddressId.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/RegionAddressId.java
index 9e81b3ca909a..bcc5870a1e26 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/RegionAddressId.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/RegionAddressId.java
@@ -41,27 +41,55 @@ private RegionAddressId(String project, String region, String address) {
}
@Override
+ @Deprecated
public Type type() {
+ return getType();
+ }
+
+ @Override
+ public Type getType() {
return Type.REGION;
}
/**
* Returns the name of the region this address belongs to.
*/
+ @Deprecated
public String region() {
return region;
}
+ /**
+ * Returns the name of the region this address belongs to.
+ */
+ public String getRegion() {
+ return region;
+ }
+
/**
* Returns the identity of the region this address belongs to.
*/
+ @Deprecated
public RegionId regionId() {
- return RegionId.of(project(), region);
+ return RegionId.of(getProject(), region);
+ }
+
+ /**
+ * Returns the identity of the region this address belongs to.
+ */
+ public RegionId getRegionId() {
+ return RegionId.of(getProject(), region);
}
@Override
+ @Deprecated
public String selfLink() {
- return super.selfLink() + "/regions/" + region + "/addresses/" + address();
+ return getSelfLink();
+ }
+
+ @Override
+ public String getSelfLink() {
+ return super.getSelfLink() + "/regions/" + region + "/addresses/" + getAddress();
}
@Override
@@ -88,10 +116,10 @@ public boolean equals(Object obj) {
@Override
RegionAddressId setProjectId(String projectId) {
- if (project() != null) {
+ if (getProject() != null) {
return this;
}
- return RegionAddressId.of(projectId, region, address());
+ return RegionAddressId.of(projectId, region, getAddress());
}
/**
@@ -104,7 +132,7 @@ RegionAddressId setProjectId(String projectId) {
* @see RFC1035
*/
public static RegionAddressId of(RegionId regionId, String address) {
- return new RegionAddressId(regionId.project(), regionId.region(), address);
+ return new RegionAddressId(regionId.getProject(), regionId.getRegion(), address);
}
/**
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/RegionForwardingRuleId.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/RegionForwardingRuleId.java
index f1f2460ef811..a15e03222d9a 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/RegionForwardingRuleId.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/RegionForwardingRuleId.java
@@ -41,7 +41,7 @@ public RegionForwardingRuleId apply(String pb) {
new Function() {
@Override
public String apply(RegionForwardingRuleId forwardingRuleId) {
- return forwardingRuleId.selfLink();
+ return forwardingRuleId.getSelfLink();
}
};
@@ -57,27 +57,55 @@ private RegionForwardingRuleId(String project, String region, String rule) {
}
@Override
+ @Deprecated
public Type type() {
+ return getType();
+ }
+
+ @Override
+ public Type getType() {
return Type.REGION;
}
/**
* Returns the name of the region this forwarding rule belongs to.
*/
+ @Deprecated
public String region() {
return region;
}
+ /**
+ * Returns the name of the region this forwarding rule belongs to.
+ */
+ public String getRegion() {
+ return region;
+ }
+
/**
* Returns the identity of the region this forwarding rule belongs to.
*/
+ @Deprecated
public RegionId regionId() {
- return RegionId.of(project(), region);
+ return RegionId.of(getProject(), region);
+ }
+
+ /**
+ * Returns the identity of the region this forwarding rule belongs to.
+ */
+ public RegionId getRegionId() {
+ return RegionId.of(getProject(), region);
}
@Override
+ @Deprecated
public String selfLink() {
- return super.selfLink() + "/regions/" + region + "/forwardingRules/" + rule();
+ return getSelfLink();
+ }
+
+ @Override
+ public String getSelfLink() {
+ return super.getSelfLink() + "/regions/" + region + "/forwardingRules/" + getRule();
}
@Override
@@ -104,10 +132,10 @@ public boolean equals(Object obj) {
@Override
RegionForwardingRuleId setProjectId(String projectId) {
- if (project() != null) {
+ if (getProject() != null) {
return this;
}
- return RegionForwardingRuleId.of(projectId, region, rule());
+ return RegionForwardingRuleId.of(projectId, region, getRule());
}
/**
@@ -120,7 +148,7 @@ RegionForwardingRuleId setProjectId(String projectId) {
* @see RFC1035
*/
public static RegionForwardingRuleId of(RegionId regionId, String rule) {
- return new RegionForwardingRuleId(regionId.project(), regionId.region(), rule);
+ return new RegionForwardingRuleId(regionId.getProject(), regionId.getRegion(), rule);
}
/**
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/RegionId.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/RegionId.java
index 1f3c74084692..dce62d7bd267 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/RegionId.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/RegionId.java
@@ -39,7 +39,7 @@ public RegionId apply(String pb) {
static final Function TO_URL_FUNCTION = new Function() {
@Override
public String apply(RegionId regionId) {
- return regionId.selfLink();
+ return regionId.getSelfLink();
}
};
@@ -55,20 +55,34 @@ private RegionId(String project, String region) {
}
private RegionId(RegionId regionId) {
- super(regionId.project());
- this.region = checkNotNull(regionId.region());
+ super(regionId.getProject());
+ this.region = checkNotNull(regionId.getRegion());
}
/**
* Returns the name of the region.
*/
+ @Deprecated
public final String region() {
+ return getRegion();
+ }
+
+ /**
+ * Returns the name of the region.
+ */
+ public String getRegion() {
return region;
}
@Override
+ @Deprecated
public String selfLink() {
- return super.selfLink() + "/regions/" + region;
+ return getSelfLink();
+ }
+
+ @Override
+ public String getSelfLink() {
+ return super.getSelfLink() + "/regions/" + region;
}
@Override
@@ -95,7 +109,7 @@ public boolean equals(Object obj) {
@Override
RegionId setProjectId(String projectId) {
- if (project() != null) {
+ if (getProject() != null) {
return this;
}
return RegionId.of(projectId, region);
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/RegionOperationId.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/RegionOperationId.java
index f66f3cc615bc..1bb834118b0a 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/RegionOperationId.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/RegionOperationId.java
@@ -41,27 +41,55 @@ private RegionOperationId(String project, String region, String operation) {
}
@Override
+ @Deprecated
public Type type() {
+ return getType();
+ }
+
+ @Override
+ public Type getType() {
return Type.REGION;
}
/**
* Returns the name of the region this operation belongs to.
*/
+ @Deprecated
public String region() {
return region;
}
+ /**
+ * Returns the name of the region this operation belongs to.
+ */
+ public String getRegion() {
+ return region;
+ }
+
/**
* Returns the identity of the region this operation belongs to.
*/
+ @Deprecated
public RegionId regionId() {
- return RegionId.of(project(), region);
+ return RegionId.of(getProject(), region);
+ }
+
+ /**
+ * Returns the identity of the region this operation belongs to.
+ */
+ public RegionId getRegionId() {
+ return RegionId.of(getProject(), region);
}
@Override
+ @Deprecated
public String selfLink() {
- return super.selfLink() + "/regions/" + region + "/operations/" + operation();
+ return getSelfLink();
+ }
+
+ @Override
+ public String getSelfLink() {
+ return super.getSelfLink() + "/regions/" + region + "/operations/" + getOperation();
}
@Override
@@ -88,17 +116,17 @@ public boolean equals(Object obj) {
@Override
RegionOperationId setProjectId(String projectId) {
- if (project() != null) {
+ if (getProject() != null) {
return this;
}
- return RegionOperationId.of(projectId, region, operation());
+ return RegionOperationId.of(projectId, region, getOperation());
}
/**
* Returns a region operation identity given the region identity and the operation name.
*/
public static RegionOperationId of(RegionId regionId, String operation) {
- return new RegionOperationId(regionId.project(), regionId.region(), operation);
+ return new RegionOperationId(regionId.getProject(), regionId.getRegion(), operation);
}
/**
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/ResourceId.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/ResourceId.java
index fed67c8fd72a..f3d773e247cf 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/ResourceId.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/ResourceId.java
@@ -39,14 +39,30 @@ public abstract class ResourceId implements Serializable {
/**
* Returns a fully qualified URL to the entity.
*/
+ @Deprecated
public String selfLink() {
+ return getSelfLink();
+ }
+
+ /**
+ * Returns a fully qualified URL to the entity.
+ */
+ public String getSelfLink() {
return BASE_URL + project;
}
/**
* Returns the name of the project.
*/
+ @Deprecated
public final String project() {
+ return getProject();
+ }
+
+ /**
+ * Returns the name of the project.
+ */
+ public final String getProject() {
return project;
}
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/SchedulingOptions.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/SchedulingOptions.java
index 8abac14f8fcb..0752b5b308e4 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/SchedulingOptions.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/SchedulingOptions.java
@@ -72,10 +72,18 @@ public Boolean automaticRestart() {
/**
* Returns the maintenance behavior for the instance.
*/
+ @Deprecated
public Maintenance maintenance() {
return maintenance;
}
+ /**
+ * Returns the maintenance behavior for the instance.
+ */
+ public Maintenance getMaintenance() {
+ return maintenance;
+ }
+
/**
* Returns {@code true} if the instance is preemptible, {@code false} otherwhise.
*
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/ServiceAccount.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/ServiceAccount.java
index 65508a0a4c3f..19d0be7cb68b 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/ServiceAccount.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/ServiceAccount.java
@@ -64,17 +64,33 @@ private ServiceAccount(String email, List scopes) {
/**
* Returns the email address of the service account.
*/
+ @Deprecated
public String email() {
return email;
}
+ /**
+ * Returns the email address of the service account.
+ */
+ public String getEmail() {
+ return email;
+ }
+
/**
* Returns the list of scopes to be made available for this service account.
*/
+ @Deprecated
public List scopes() {
return scopes;
}
+ /**
+ * Returns the list of scopes to be made available for this service account.
+ */
+ public List getScopes() {
+ return scopes;
+ }
+
@Override
public String toString() {
return MoreObjects.toStringHelper(this)
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/Snapshot.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/Snapshot.java
index fee0e2fcfac5..3947addb969a 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/Snapshot.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/Snapshot.java
@@ -55,8 +55,8 @@ public static class Builder extends SnapshotInfo.Builder {
Builder(Compute compute, SnapshotId snapshotId, DiskId sourceDisk) {
this.compute = compute;
this.infoBuilder = new SnapshotInfo.BuilderImpl();
- this.infoBuilder.snapshotId(snapshotId);
- this.infoBuilder.sourceDisk(sourceDisk);
+ this.infoBuilder.setSnapshotId(snapshotId);
+ this.infoBuilder.setSourceDisk(sourceDisk);
}
Builder(Snapshot snapshot) {
@@ -65,68 +65,86 @@ public static class Builder extends SnapshotInfo.Builder {
}
@Override
- Builder generatedId(String generatedId) {
- infoBuilder.generatedId(generatedId);
+ Builder setGeneratedId(String generatedId) {
+ infoBuilder.setGeneratedId(generatedId);
return this;
}
@Override
- Builder creationTimestamp(Long creationTimestamp) {
- infoBuilder.creationTimestamp(creationTimestamp);
+ Builder setCreationTimestamp(Long creationTimestamp) {
+ infoBuilder.setCreationTimestamp(creationTimestamp);
return this;
}
@Override
+ @Deprecated
public Builder snapshotId(SnapshotId snapshotId) {
- infoBuilder.snapshotId(snapshotId);
+ return setSnapshotId(snapshotId);
+ }
+
+ @Override
+ public Builder setSnapshotId(SnapshotId snapshotId) {
+ infoBuilder.setSnapshotId(snapshotId);
return this;
}
@Override
+ @Deprecated
public Builder description(String description) {
- infoBuilder.description(description);
+ return setDescription(description);
+ }
+
+ @Override
+ public Builder setDescription(String description) {
+ infoBuilder.setDescription(description);
return this;
}
@Override
- Builder status(Status status) {
- infoBuilder.status(status);
+ Builder setStatus(Status status) {
+ infoBuilder.setStatus(status);
return this;
}
@Override
- Builder diskSizeGb(Long diskSizeGb) {
- infoBuilder.diskSizeGb(diskSizeGb);
+ Builder setDiskSizeGb(Long diskSizeGb) {
+ infoBuilder.setDiskSizeGb(diskSizeGb);
return this;
}
@Override
- Builder licenses(List licenses) {
- infoBuilder.licenses(licenses);
+ Builder setLicenses(List licenses) {
+ infoBuilder.setLicenses(licenses);
return this;
}
@Override
+ @Deprecated
public Builder sourceDisk(DiskId sourceDisk) {
- infoBuilder.sourceDisk(sourceDisk);
+ return setSourceDisk(sourceDisk);
+ }
+
+ @Override
+ public Builder setSourceDisk(DiskId sourceDisk) {
+ infoBuilder.setSourceDisk(sourceDisk);
return this;
}
@Override
- Builder sourceDiskId(String sourceDiskId) {
- infoBuilder.sourceDiskId(sourceDiskId);
+ Builder setSourceDiskId(String sourceDiskId) {
+ infoBuilder.setSourceDiskId(sourceDiskId);
return this;
}
@Override
- Builder storageBytes(Long storageBytes) {
- infoBuilder.storageBytes(storageBytes);
+ Builder setStorageBytes(Long storageBytes) {
+ infoBuilder.setStorageBytes(storageBytes);
return this;
}
@Override
- Builder storageBytesStatus(StorageBytesStatus storageBytesStatus) {
- infoBuilder.storageBytesStatus(storageBytesStatus);
+ Builder setStorageBytesStatus(StorageBytesStatus storageBytesStatus) {
+ infoBuilder.setStorageBytesStatus(storageBytesStatus);
return this;
}
@@ -161,7 +179,7 @@ public boolean exists() {
* @throws ComputeException upon failure
*/
public Snapshot reload(SnapshotOption... options) {
- return compute.getSnapshot(snapshotId().snapshot(), options);
+ return compute.getSnapshot(getSnapshotId().getSnapshot(), options);
}
/**
@@ -172,13 +190,21 @@ public Snapshot reload(SnapshotOption... options) {
* @throws ComputeException upon failure
*/
public Operation delete(OperationOption... options) {
- return compute.deleteSnapshot(snapshotId(), options);
+ return compute.deleteSnapshot(getSnapshotId(), options);
}
/**
* Returns the snapshot's {@code Compute} object used to issue requests.
*/
+ @Deprecated
public Compute compute() {
+ return getCompute();
+ }
+
+ /**
+ * Returns the snapshot's {@code Compute} object used to issue requests.
+ */
+ public Compute getCompute() {
return compute;
}
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/SnapshotDiskConfiguration.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/SnapshotDiskConfiguration.java
index 15909b6092d1..ee64b768c8f2 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/SnapshotDiskConfiguration.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/SnapshotDiskConfiguration.java
@@ -72,20 +72,43 @@ private Builder(Disk diskPb) {
* Restoring a snapshot to a larger size
*/
@Override
+ @Deprecated
public Builder sizeGb(Long sizeGb) {
- super.sizeGb(sizeGb);
+ return setSizeGb(sizeGb);
+ }
+
+ /**
+ * Sets the size of the persistent disk, in GB. If not set the disk will have the size of the
+ * snapshot. This value can be larger than the snapshot's size. If the provided size is smaller
+ * than the snapshot's size then disk creation will fail.
+ *
+ * @see
+ * Restoring a snapshot to a larger size
+ */
+ @Override
+ public Builder setSizeGb(Long sizeGb) {
+ super.setSizeGb(sizeGb);
return this;
}
/**
* Sets the identity of the source snapshot used to create the disk.
*/
+ @Deprecated
public Builder sourceSnapshot(SnapshotId sourceSnapshot) {
+ return setSourceSnapshot(sourceSnapshot);
+ }
+
+ /**
+ * Sets the identity of the source snapshot used to create the disk.
+ */
+ public Builder setSourceSnapshot(SnapshotId sourceSnapshot) {
this.sourceSnapshot = checkNotNull(sourceSnapshot);
return this;
}
- Builder sourceSnapshotId(String sourceSnapshotId) {
+ Builder setSourceSnapshotId(String sourceSnapshotId) {
this.sourceSnapshotId = sourceSnapshotId;
return this;
}
@@ -108,20 +131,39 @@ private SnapshotDiskConfiguration(Builder builder) {
/**
* Returns the identity of the source snapshot used to create the disk.
*/
+ @Deprecated
public SnapshotId sourceSnapshot() {
return sourceSnapshot;
}
+ /**
+ * Returns the identity of the source snapshot used to create the disk.
+ */
+ public SnapshotId getSourceSnapshot() {
+ return sourceSnapshot;
+ }
+
/**
* Returns the service-generated unique id of the snapshot used to create this disk. This value
* identifies the exact snapshot that was used to create the persistent disk. For example, if you
* created the persistent disk from a snapshot that was later deleted and recreated under the same
* name, the source snapshot ID would identify the exact version of the snapshot that was used.
*/
+ @Deprecated
public String sourceSnapshotId() {
return sourceSnapshotId;
}
+ /**
+ * Returns the service-generated unique id of the snapshot used to create this disk. This value
+ * identifies the exact snapshot that was used to create the persistent disk. For example, if you
+ * created the persistent disk from a snapshot that was later deleted and recreated under the same
+ * name, the source snapshot ID would identify the exact version of the snapshot that was used.
+ */
+ public String getSourceSnapshotId() {
+ return sourceSnapshotId;
+ }
+
@Override
public Builder toBuilder() {
return new Builder(this);
@@ -149,9 +191,9 @@ public final boolean equals(Object obj) {
@Override
SnapshotDiskConfiguration setProjectId(String projectId) {
- Builder builder = toBuilder().sourceSnapshot(sourceSnapshot.setProjectId(projectId));
- if (diskType() != null) {
- builder.diskType(diskType().setProjectId(projectId));
+ Builder builder = toBuilder().setSourceSnapshot(sourceSnapshot.setProjectId(projectId));
+ if (getDiskType() != null) {
+ builder.setDiskType(getDiskType().setProjectId(projectId));
}
return builder.build();
}
@@ -159,14 +201,22 @@ SnapshotDiskConfiguration setProjectId(String projectId) {
@Override
Disk toPb() {
return super.toPb()
- .setSourceSnapshot(sourceSnapshot.selfLink())
+ .setSourceSnapshot(sourceSnapshot.getSelfLink())
.setSourceSnapshotId(sourceSnapshotId);
}
/**
* Returns a builder for a {@code SnapshotDiskConfiguration} object given the snapshot identity.
*/
+ @Deprecated
public static Builder builder(SnapshotId sourceSnapshot) {
+ return newBuilder(sourceSnapshot);
+ }
+
+ /**
+ * Returns a builder for a {@code SnapshotDiskConfiguration} object given the snapshot identity.
+ */
+ public static Builder newBuilder(SnapshotId sourceSnapshot) {
return new Builder(sourceSnapshot);
}
@@ -174,7 +224,7 @@ public static Builder builder(SnapshotId sourceSnapshot) {
* Returns a {@code SnapshotDiskConfiguration} object given the snapshot identity.
*/
public static SnapshotDiskConfiguration of(SnapshotId sourceSnapshot) {
- return builder(sourceSnapshot).build();
+ return newBuilder(sourceSnapshot).build();
}
@SuppressWarnings("unchecked")
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/SnapshotId.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/SnapshotId.java
index a30d531b65be..349b22354dda 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/SnapshotId.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/SnapshotId.java
@@ -49,13 +49,33 @@ private SnapshotId(String project, String snapshot) {
*
* @see RFC1035
*/
+ @Deprecated
public String snapshot() {
+ return getSnapshot();
+ }
+
+ /**
+ * Returns the name of the snapshot. The name must be 1-63 characters long and comply with
+ * RFC1035. Specifically, the name must match the regular expression
+ * {@code [a-z]([-a-z0-9]*[a-z0-9])?} which means the first character must be a lowercase letter,
+ * and all following characters must be a dash, lowercase letter, or digit, except the last
+ * character, which cannot be a dash.
+ *
+ * @see RFC1035
+ */
+ public String getSnapshot() {
return snapshot;
}
@Override
+ @Deprecated
public String selfLink() {
- return super.selfLink() + "/global/snapshots/" + snapshot;
+ return getSelfLink();
+ }
+
+ @Override
+ public String getSelfLink() {
+ return super.getSelfLink() + "/global/snapshots/" + snapshot;
}
@Override
@@ -82,7 +102,7 @@ public boolean equals(Object obj) {
@Override
SnapshotId setProjectId(String projectId) {
- if (project() != null) {
+ if (getProject() != null) {
return this;
}
return SnapshotId.of(projectId, snapshot);
diff --git a/google-cloud-compute/src/main/java/com/google/cloud/compute/SnapshotInfo.java b/google-cloud-compute/src/main/java/com/google/cloud/compute/SnapshotInfo.java
index ce9ebbc7825c..618933dc4017 100644
--- a/google-cloud-compute/src/main/java/com/google/cloud/compute/SnapshotInfo.java
+++ b/google-cloud-compute/src/main/java/com/google/cloud/compute/SnapshotInfo.java
@@ -125,36 +125,54 @@ public enum StorageBytesStatus {
*/
public abstract static class Builder {
- abstract Builder generatedId(String generatedId);
+ abstract Builder setGeneratedId(String generatedId);
- abstract Builder creationTimestamp(Long creationTimestamp);
+ abstract Builder setCreationTimestamp(Long creationTimestamp);
/**
* Sets the snapshot identity.
*/
+ @Deprecated
public abstract Builder snapshotId(SnapshotId snapshotId);
+ /**
+ * Sets the snapshot identity.
+ */
+ public abstract Builder setSnapshotId(SnapshotId snapshotId);
+
/**
* Sets an optional textual description of the snapshot.
*/
+ @Deprecated
public abstract Builder description(String description);
- abstract Builder status(Status status);
+ /**
+ * Sets an optional textual description of the snapshot.
+ */
+ public abstract Builder setDescription(String description);
+
+ abstract Builder setStatus(Status status);
- abstract Builder diskSizeGb(Long diskSizeGb);
+ abstract Builder setDiskSizeGb(Long diskSizeGb);
- abstract Builder licenses(List licenses);
+ abstract Builder setLicenses(List licenses);
/**
* Sets the identity of the source disk used to create the snapshot.
*/
+ @Deprecated
public abstract Builder sourceDisk(DiskId sourceDisk);
- abstract Builder sourceDiskId(String sourceDiskId);
+ /**
+ * Sets the identity of the source disk used to create the snapshot.
+ */
+ public abstract Builder setSourceDisk(DiskId sourceDisk);
+
+ abstract Builder setSourceDiskId(String sourceDiskId);
- abstract Builder storageBytes(Long storageBytes);
+ abstract Builder setStorageBytes(Long storageBytes);
- abstract Builder storageBytesStatus(StorageBytesStatus storageBytesStatus);
+ abstract Builder setStorageBytesStatus(StorageBytesStatus storageBytesStatus);
/**
* Creates a {@code SnapshotInfo} object.
@@ -219,67 +237,85 @@ static final class BuilderImpl extends Builder {
}
@Override
- BuilderImpl generatedId(String generatedId) {
+ BuilderImpl setGeneratedId(String generatedId) {
this.generatedId = generatedId;
return this;
}
@Override
- BuilderImpl creationTimestamp(Long creationTimestamp) {
+ BuilderImpl setCreationTimestamp(Long creationTimestamp) {
this.creationTimestamp = creationTimestamp;
return this;
}
@Override
+ @Deprecated
public BuilderImpl snapshotId(SnapshotId snapshotId) {
+ return setSnapshotId(snapshotId);
+ }
+
+ @Override
+ public BuilderImpl setSnapshotId(SnapshotId snapshotId) {
this.snapshotId = checkNotNull(snapshotId);
return this;
}
@Override
+ @Deprecated
public BuilderImpl description(String description) {
+ return setDescription(description);
+ }
+
+ @Override
+ public BuilderImpl setDescription(String description) {
this.description = description;
return this;
}
@Override
- BuilderImpl status(Status status) {
+ BuilderImpl setStatus(Status status) {
this.status = status;
return this;
}
@Override
- BuilderImpl diskSizeGb(Long diskSizeGb) {
+ BuilderImpl setDiskSizeGb(Long diskSizeGb) {
this.diskSizeGb = diskSizeGb;
return this;
}
@Override
- BuilderImpl licenses(List licenses) {
+ BuilderImpl setLicenses(List