You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by na...@apache.org on 2013/11/14 12:23:12 UTC
[09/13] Fix code style of the cloudsigma2 provider.
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Drive.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Drive.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Drive.java
index 13db449..744949a 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Drive.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Drive.java
@@ -27,148 +27,149 @@ import java.net.URI;
*/
public class Drive extends Item {
- public static class Builder extends Item.Builder {
- protected Owner owner;
- protected DriveStatus status = DriveStatus.UNMOUNTED;
-
- /**
- * @param owner Owner of the drive
- * @return Drive Builder
- */
- public Builder owner(Owner owner) {
- this.owner = owner;
- return this;
- }
-
- /**
- * @param status Status of the drive
- * @return Drive Builder
- */
- public Builder status(DriveStatus status) {
- this.status = status;
- return this;
- }
-
- /**
- * @param uuid UUID of the drive
- * @return Drive Builder
- */
- @Override
- public Builder uuid(String uuid) {
- return Builder.class.cast(super.uuid(uuid));
- }
-
- /**
- * @param name Human readable name of the drive
- * @return Drive Builder
- */
- @Override
- public Builder name(String name) {
- return Builder.class.cast(super.name(name));
- }
-
- /**
- * @return Drive Builder
- */
- @Override
- public Builder resourceUri(URI resourceUri) {
- return Builder.class.cast(super.resourceUri(resourceUri));
- }
-
- public Drive build() {
- return new Drive(uuid, name, resourceUri, owner, status);
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- result = prime * result + ((owner == null) ? 0 : owner.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- Drive other = (Drive) obj;
- if (owner != other.owner)
- return false;
- if (!Objects.equal(status, other.status))
- return false;
- if (!Objects.equal(name, other.name))
- return false;
+ public static class Builder extends Item.Builder {
+ protected Owner owner;
+ protected DriveStatus status = DriveStatus.UNMOUNTED;
+
+ /**
+ * @param owner Owner of the drive
+ * @return Drive Builder
+ */
+ public Builder owner(Owner owner) {
+ this.owner = owner;
+ return this;
+ }
+
+ /**
+ * @param status Status of the drive
+ * @return Drive Builder
+ */
+ public Builder status(DriveStatus status) {
+ this.status = status;
+ return this;
+ }
+
+ /**
+ * @param uuid UUID of the drive
+ * @return Drive Builder
+ */
+ @Override
+ public Builder uuid(String uuid) {
+ return Builder.class.cast(super.uuid(uuid));
+ }
+
+ /**
+ * @param name Human readable name of the drive
+ * @return Drive Builder
+ */
+ @Override
+ public Builder name(String name) {
+ return Builder.class.cast(super.name(name));
+ }
+
+ /**
+ * @return Drive Builder
+ */
+ @Override
+ public Builder resourceUri(URI resourceUri) {
+ return Builder.class.cast(super.resourceUri(resourceUri));
+ }
+
+ public Drive build() {
+ return new Drive(uuid, name, resourceUri, owner, status);
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ result = prime * result + ((owner == null) ? 0 : owner.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
return true;
- }
- }
-
- protected final Owner owner;
- protected final DriveStatus status;
-
- @ConstructorProperties({
- "uuid", "name", "resource_uri", "owner", "status"
- })
- public Drive(@Nullable String uuid, String name, @Nullable URI resourceUri, @Nullable Owner owner, DriveStatus status) {
- super(uuid, name, resourceUri);
-
- this.owner = owner;
- this.status = status;
- }
-
- /**
- * @return Owner of the drive
- */
- public Owner getOwner() {
- return owner;
- }
-
- /**
- * @return Status of the drive
- */
- public DriveStatus getStatus() {
- return status;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof Drive)) return false;
- if (!super.equals(o)) return false;
-
- Drive drive = (Drive) o;
-
- if (owner != null ? !owner.equals(drive.owner) : drive.owner != null) return false;
- if (status != drive.status) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = super.hashCode();
- result = 31 * result + (owner != null ? owner.hashCode() : 0);
- result = 31 * result + (status != null ? status.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return "[uuid=" + uuid + ", name=" + name + ", owner=" + owner + ", status=" + status + "]";
- }
-
- /**
- * Creates drive for attaching to server
- *
- * @param bootOrder drive boot order
- * @param deviceChannel device channel in format {controller:unit} ex. 0:1, 0:2, etc.
- * @param deviceEmulationType device emulation type
- */
- public ServerDrive toServerDrive(int bootOrder, String deviceChannel, DeviceEmulationType deviceEmulationType){
- return new ServerDrive(bootOrder, deviceChannel, deviceEmulationType, this.uuid);
- }
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ Drive other = (Drive) obj;
+ if (owner != other.owner)
+ return false;
+ if (!Objects.equal(status, other.status))
+ return false;
+ if (!Objects.equal(name, other.name))
+ return false;
+ return true;
+ }
+ }
+
+ protected final Owner owner;
+ protected final DriveStatus status;
+
+ @ConstructorProperties({
+ "uuid", "name", "resource_uri", "owner", "status"
+ })
+ public Drive(@Nullable String uuid, String name, @Nullable URI resourceUri, @Nullable Owner owner
+ , DriveStatus status) {
+ super(uuid, name, resourceUri);
+
+ this.owner = owner;
+ this.status = status;
+ }
+
+ /**
+ * @return Owner of the drive
+ */
+ public Owner getOwner() {
+ return owner;
+ }
+
+ /**
+ * @return Status of the drive
+ */
+ public DriveStatus getStatus() {
+ return status;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof Drive)) return false;
+ if (!super.equals(o)) return false;
+
+ Drive drive = (Drive) o;
+
+ if (owner != null ? !owner.equals(drive.owner) : drive.owner != null) return false;
+ if (status != drive.status) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = super.hashCode();
+ result = 31 * result + (owner != null ? owner.hashCode() : 0);
+ result = 31 * result + (status != null ? status.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "[uuid=" + uuid + ", name=" + name + ", owner=" + owner + ", status=" + status + "]";
+ }
+
+ /**
+ * Creates drive for attaching to server
+ *
+ * @param bootOrder drive boot order
+ * @param deviceChannel device channel in format {controller:unit} ex. 0:1, 0:2, etc.
+ * @param deviceEmulationType device emulation type
+ */
+ public ServerDrive toServerDrive(int bootOrder, String deviceChannel, DeviceEmulationType deviceEmulationType) {
+ return new ServerDrive(bootOrder, deviceChannel, deviceEmulationType, this.uuid);
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DriveInfo.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DriveInfo.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DriveInfo.java
index f5490d3..ba45c3c 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DriveInfo.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DriveInfo.java
@@ -29,301 +29,317 @@ import java.util.Map;
* @author Vladimir Shevchenko
*/
public class DriveInfo extends Drive {
- public static class Builder extends Drive.Builder {
-
- protected BigInteger size;
- protected boolean allowMultimount;
- protected List<String> affinities;
- protected List<String> jobs;
- protected List<DriveLicense> licenses;
- protected MediaType media = MediaType.UNRECOGNIZED;
- protected Map<String, String> meta;
- protected List<Server> mountedOn;
- protected List<String> tags;
-
- /**
- * @param size Size of the drive in bytes
- * @return DriveInfo Builder
- */
- public Builder size(BigInteger size) {
- this.size = size;
- return this;
- }
-
- /**
- * @param allowMultimount Allow the drive to be mounted on multiple guests
- * @return DriveInfo Builder
- */
- public Builder allowMultimount(boolean allowMultimount) {
- this.allowMultimount = allowMultimount;
- return this;
- }
-
- /**
- * @param affinities A list of affinities this drive should belong to
- * @return DriveInfo Builder
- */
- public Builder affinities(List<String> affinities) {
- this.affinities = ImmutableList.copyOf(affinities);
- return this;
- }
-
- /**
- * @param jobs Background jobs related to this resource
- * @return DriveInfo Builder
- */
- public Builder jobs(List<String> jobs) {
- this.jobs = ImmutableList.copyOf(jobs);
- return this;
- }
-
- /**
- * @param licenses A list of licences attached to this drive
- * @return DriveInfo Builder
- */
- public Builder licenses(List<DriveLicense> licenses) {
- this.licenses = licenses;
- return this;
- }
-
- /**
- * @param media Media representation type
- * @return DriveInfo Builder
- */
- public Builder media(MediaType media) {
- this.media = media;
- return this;
- }
-
- /**
- * @param meta User defined meta information
- * @return DriveInfo Builder
- */
- public Builder meta(Map<String, String> meta) {
- this.meta = meta;
- return this;
- }
-
- /**
- * @param mountedOn Servers on which this drive is mounted on
- * @return DriveInfo Builder
- */
- public Builder mountedOn(List<Server> mountedOn) {
- this.mountedOn = ImmutableList.copyOf(mountedOn);
- return this;
- }
-
- /**
- * @param tags Tags associated with this drive
- * @return DriveInfo Builder
- */
- public Builder tags(List<String> tags) {
- this.tags = ImmutableList.copyOf(tags);
- return this;
- }
-
- /**
- * {@inheritDoc}
- * @return DriveInfo Builder
- */
- @Override
- public Builder uuid(String uuid) {
- return Builder.class.cast(super.uuid(uuid));
- }
-
- /**
- * {@inheritDoc}
- * @return DriveInfo Builder
- */
- @Override
- public Builder name(String name) {
- return Builder.class.cast(super.name(name));
- }
-
- /**
- * {@inheritDoc}
- * @return DriveInfo Builder
- */
- @Override
- public Builder resourceUri(URI resourceUri) {
- return Builder.class.cast(super.resourceUri(resourceUri));
- }
-
- /**
- * {@inheritDoc}
- * @return DriveInfo Builder
- */
- @Override
- public Builder owner(Owner owner) {
- return Builder.class.cast(super.owner(owner));
- }
-
- /**
- * {@inheritDoc}
- * @return DriveInfo Builder
- */
- @Override
- public Builder status(DriveStatus status) {
- return Builder.class.cast(super.status(status));
- }
-
- public static Builder fromDriveInfo(DriveInfo in) {
- return new Builder().uuid(in.getUuid()).name(in.getName()).resourceUri(in.getResourceUri())
- .owner(in.getOwner()).status(in.getStatus()).size(in.getSize())
- .allowMultimount(in.isAllowMultimount()).affinities(in.getAffinities()).jobs(in.getJobs())
- .licenses(in.getLicenses()).media(in.getMedia()).meta(in.getMeta()).mountedOn(in.getMountedOn()).tags(in.getTags());
- }
-
- /**
- * Warning: media, name & size should be specified
- *
- * @return DriveInfo instance
- */
- @Override
- public DriveInfo build() {
- return new DriveInfo(uuid, name, resourceUri, size, owner, status, allowMultimount, affinities, jobs, licenses
- , media, meta, mountedOn, tags);
- }
-
- }
-
- protected final BigInteger size;
- @Named("allow_multimount")
- protected final boolean allowMultimount;
- protected final List<String> affinities;
- protected final List<String> jobs;
- protected final List<DriveLicense> licenses;
- protected final MediaType media;
- protected final Map<String, String> meta;
- @Named("mounted_on")
- protected final List<Server> mountedOn;
- protected final List<String> tags;
-
- @ConstructorProperties({
- "uuid", "name", "resource_uri", "size", "owner", "status",
- "allow_multimount", "affinities", "jobs", "licenses",
- "media", "meta", "mounted_on", "tags"
- })
- public DriveInfo(String uuid, String name, URI resourceUri,
- BigInteger size, Owner owner, DriveStatus status,
- boolean allowMultimount, List<String> affinities, List<String> jobs, List<DriveLicense> licenses,
- MediaType media, Map<String, String> meta, List<Server> mountedOn, List<String> tags) {
- super(uuid, name, resourceUri, owner, status);
- this.size = size;
- this.allowMultimount = allowMultimount;
- this.affinities = affinities;
- this.jobs = jobs;
- this.licenses = licenses;
- this.media = media;
- this.meta = meta;
- this.mountedOn = mountedOn;
- this.tags = tags;
- }
-
- /**
- * @return Size of the drive in bytes
- */
- public BigInteger getSize() {
- return size;
- }
-
- /**
- * @return A list of affinities this drive should belong to
- */
- public List<String> getAffinities() {
- return affinities;
- }
-
- /**
- * @return Allow the drive to be mounted on multiple guests
- */
- public boolean isAllowMultimount() {
- return allowMultimount;
- }
-
- /**
- * @return Background jobs related to this resource
- */
- public List<String> getJobs() {
- return jobs;
- }
-
- /**
- * @return A list of licences attached to this drive
- */
- public List<DriveLicense> getLicenses() {
- return licenses;
- }
-
- /**
- * @return Media representation type
- */
- public MediaType getMedia() {
- return media;
- }
-
- /**
- * @return User defined meta information
- */
- public Map<String, String> getMeta() {
- return meta;
- }
-
- /**
- * @return Servers on which this drive is mounted on
- */
- public List<Server> getMountedOn() {
- return mountedOn;
- }
-
- /**
- * @return Tags associated with this drive
- */
- public List<String> getTags() {
- return tags;
- }
-
- @Override
- public int hashCode() {
- int result = super.hashCode();
- result = 31 * result + (size != null ? size.hashCode() : 0);
- result = 31 * result + (allowMultimount ? 1 : 0);
- result = 31 * result + (affinities != null ? affinities.hashCode() : 0);
- result = 31 * result + (jobs != null ? jobs.hashCode() : 0);
- result = 31 * result + (licenses != null ? licenses.hashCode() : 0);
- result = 31 * result + (media != null ? media.hashCode() : 0);
- result = 31 * result + (meta != null ? meta.hashCode() : 0);
- result = 31 * result + (mountedOn != null ? mountedOn.hashCode() : 0);
- result = 31 * result + (tags != null ? tags.hashCode() : 0);
- return result;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof DriveInfo)) return false;
- if (!super.equals(o)) return false;
-
- DriveInfo driveInfo = (DriveInfo) o;
-
- if (allowMultimount != driveInfo.allowMultimount) return false;
- if (affinities != null ? !affinities.equals(driveInfo.affinities) : driveInfo.affinities != null) return false;
- if (jobs != null ? !jobs.equals(driveInfo.jobs) : driveInfo.jobs != null) return false;
- if (licenses != null ? !licenses.equals(driveInfo.licenses) : driveInfo.licenses != null) return false;
- if (media != driveInfo.media) return false;
- if (meta != null ? !meta.equals(driveInfo.meta) : driveInfo.meta != null) return false;
- if (mountedOn != null ? !mountedOn.equals(driveInfo.mountedOn) : driveInfo.mountedOn != null) return false;
- if (size != null ? !size.equals(driveInfo.size) : driveInfo.size != null) return false;
- if (tags != null ? !tags.equals(driveInfo.tags) : driveInfo.tags != null) return false;
-
- return true;
- }
-
- @Override
- public String toString() {
- return "[uuid=" + uuid + ", name=" + name + ", size=" + size + ", owner=" + owner + ", status=" + status
- + ", affinities=" + affinities + ", jobs=" + jobs + ", licenses=" + licenses + ", media=" + media
- + ", meta=" + meta + ", mountedOn=" + mountedOn + ", tags=" + tags + "]";
- }
+ public static class Builder extends Drive.Builder {
+
+ protected BigInteger size;
+ protected boolean allowMultimount;
+ protected List<String> affinities;
+ protected List<String> jobs;
+ protected List<DriveLicense> licenses;
+ protected MediaType media = MediaType.UNRECOGNIZED;
+ protected Map<String, String> meta;
+ protected List<Server> mountedOn;
+ protected List<String> tags;
+
+ /**
+ * @param size Size of the drive in bytes
+ * @return DriveInfo Builder
+ */
+ public Builder size(BigInteger size) {
+ this.size = size;
+ return this;
+ }
+
+ /**
+ * @param allowMultimount Allow the drive to be mounted on multiple guests
+ * @return DriveInfo Builder
+ */
+ public Builder allowMultimount(boolean allowMultimount) {
+ this.allowMultimount = allowMultimount;
+ return this;
+ }
+
+ /**
+ * @param affinities A list of affinities this drive should belong to
+ * @return DriveInfo Builder
+ */
+ public Builder affinities(List<String> affinities) {
+ this.affinities = ImmutableList.copyOf(affinities);
+ return this;
+ }
+
+ /**
+ * @param jobs Background jobs related to this resource
+ * @return DriveInfo Builder
+ */
+ public Builder jobs(List<String> jobs) {
+ this.jobs = ImmutableList.copyOf(jobs);
+ return this;
+ }
+
+ /**
+ * @param licenses A list of licences attached to this drive
+ * @return DriveInfo Builder
+ */
+ public Builder licenses(List<DriveLicense> licenses) {
+ this.licenses = licenses;
+ return this;
+ }
+
+ /**
+ * @param media Media representation type
+ * @return DriveInfo Builder
+ */
+ public Builder media(MediaType media) {
+ this.media = media;
+ return this;
+ }
+
+ /**
+ * @param meta User defined meta information
+ * @return DriveInfo Builder
+ */
+ public Builder meta(Map<String, String> meta) {
+ this.meta = meta;
+ return this;
+ }
+
+ /**
+ * @param mountedOn Servers on which this drive is mounted on
+ * @return DriveInfo Builder
+ */
+ public Builder mountedOn(List<Server> mountedOn) {
+ this.mountedOn = ImmutableList.copyOf(mountedOn);
+ return this;
+ }
+
+ /**
+ * @param tags Tags associated with this drive
+ * @return DriveInfo Builder
+ */
+ public Builder tags(List<String> tags) {
+ this.tags = ImmutableList.copyOf(tags);
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @return DriveInfo Builder
+ */
+ @Override
+ public Builder uuid(String uuid) {
+ return Builder.class.cast(super.uuid(uuid));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @return DriveInfo Builder
+ */
+ @Override
+ public Builder name(String name) {
+ return Builder.class.cast(super.name(name));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @return DriveInfo Builder
+ */
+ @Override
+ public Builder resourceUri(URI resourceUri) {
+ return Builder.class.cast(super.resourceUri(resourceUri));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @return DriveInfo Builder
+ */
+ @Override
+ public Builder owner(Owner owner) {
+ return Builder.class.cast(super.owner(owner));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @return DriveInfo Builder
+ */
+ @Override
+ public Builder status(DriveStatus status) {
+ return Builder.class.cast(super.status(status));
+ }
+
+ public static Builder fromDriveInfo(DriveInfo in) {
+ return new Builder()
+ .uuid(in.getUuid())
+ .name(in.getName())
+ .resourceUri(in.getResourceUri())
+ .owner(in.getOwner())
+ .status(in.getStatus())
+ .size(in.getSize())
+ .allowMultimount(in.isAllowMultimount())
+ .affinities(in.getAffinities())
+ .jobs(in.getJobs())
+ .licenses(in.getLicenses())
+ .media(in.getMedia())
+ .meta(in.getMeta())
+ .mountedOn(in.getMountedOn())
+ .tags(in.getTags());
+ }
+
+ /**
+ * Warning: media, name & size should be specified
+ *
+ * @return DriveInfo instance
+ */
+ @Override
+ public DriveInfo build() {
+ return new DriveInfo(uuid, name, resourceUri, size, owner, status, allowMultimount, affinities, jobs, licenses
+ , media, meta, mountedOn, tags);
+ }
+
+ }
+
+ protected final BigInteger size;
+ @Named("allow_multimount")
+ protected final boolean allowMultimount;
+ protected final List<String> affinities;
+ protected final List<String> jobs;
+ protected final List<DriveLicense> licenses;
+ protected final MediaType media;
+ protected final Map<String, String> meta;
+ @Named("mounted_on")
+ protected final List<Server> mountedOn;
+ protected final List<String> tags;
+
+ @ConstructorProperties({
+ "uuid", "name", "resource_uri", "size", "owner", "status",
+ "allow_multimount", "affinities", "jobs", "licenses",
+ "media", "meta", "mounted_on", "tags"
+ })
+ public DriveInfo(String uuid, String name, URI resourceUri,
+ BigInteger size, Owner owner, DriveStatus status,
+ boolean allowMultimount, List<String> affinities, List<String> jobs, List<DriveLicense> licenses,
+ MediaType media, Map<String, String> meta, List<Server> mountedOn, List<String> tags) {
+ super(uuid, name, resourceUri, owner, status);
+ this.size = size;
+ this.allowMultimount = allowMultimount;
+ this.affinities = affinities;
+ this.jobs = jobs;
+ this.licenses = licenses;
+ this.media = media;
+ this.meta = meta;
+ this.mountedOn = mountedOn;
+ this.tags = tags;
+ }
+
+ /**
+ * @return Size of the drive in bytes
+ */
+ public BigInteger getSize() {
+ return size;
+ }
+
+ /**
+ * @return A list of affinities this drive should belong to
+ */
+ public List<String> getAffinities() {
+ return affinities;
+ }
+
+ /**
+ * @return Allow the drive to be mounted on multiple guests
+ */
+ public boolean isAllowMultimount() {
+ return allowMultimount;
+ }
+
+ /**
+ * @return Background jobs related to this resource
+ */
+ public List<String> getJobs() {
+ return jobs;
+ }
+
+ /**
+ * @return A list of licences attached to this drive
+ */
+ public List<DriveLicense> getLicenses() {
+ return licenses;
+ }
+
+ /**
+ * @return Media representation type
+ */
+ public MediaType getMedia() {
+ return media;
+ }
+
+ /**
+ * @return User defined meta information
+ */
+ public Map<String, String> getMeta() {
+ return meta;
+ }
+
+ /**
+ * @return Servers on which this drive is mounted on
+ */
+ public List<Server> getMountedOn() {
+ return mountedOn;
+ }
+
+ /**
+ * @return Tags associated with this drive
+ */
+ public List<String> getTags() {
+ return tags;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = super.hashCode();
+ result = 31 * result + (size != null ? size.hashCode() : 0);
+ result = 31 * result + (allowMultimount ? 1 : 0);
+ result = 31 * result + (affinities != null ? affinities.hashCode() : 0);
+ result = 31 * result + (jobs != null ? jobs.hashCode() : 0);
+ result = 31 * result + (licenses != null ? licenses.hashCode() : 0);
+ result = 31 * result + (media != null ? media.hashCode() : 0);
+ result = 31 * result + (meta != null ? meta.hashCode() : 0);
+ result = 31 * result + (mountedOn != null ? mountedOn.hashCode() : 0);
+ result = 31 * result + (tags != null ? tags.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof DriveInfo)) return false;
+ if (!super.equals(o)) return false;
+
+ DriveInfo driveInfo = (DriveInfo) o;
+
+ if (allowMultimount != driveInfo.allowMultimount) return false;
+ if (affinities != null ? !affinities.equals(driveInfo.affinities) : driveInfo.affinities != null) return false;
+ if (jobs != null ? !jobs.equals(driveInfo.jobs) : driveInfo.jobs != null) return false;
+ if (licenses != null ? !licenses.equals(driveInfo.licenses) : driveInfo.licenses != null) return false;
+ if (media != driveInfo.media) return false;
+ if (meta != null ? !meta.equals(driveInfo.meta) : driveInfo.meta != null) return false;
+ if (mountedOn != null ? !mountedOn.equals(driveInfo.mountedOn) : driveInfo.mountedOn != null) return false;
+ if (size != null ? !size.equals(driveInfo.size) : driveInfo.size != null) return false;
+ if (tags != null ? !tags.equals(driveInfo.tags) : driveInfo.tags != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "[uuid=" + uuid + ", name=" + name + ", size=" + size + ", owner=" + owner + ", status=" + status
+ + ", affinities=" + affinities + ", jobs=" + jobs + ", licenses=" + licenses + ", media=" + media
+ + ", meta=" + meta + ", mountedOn=" + mountedOn + ", tags=" + tags + "]";
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DriveLicense.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DriveLicense.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DriveLicense.java
index 48b75f7..4f02fcb 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DriveLicense.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DriveLicense.java
@@ -23,84 +23,84 @@ import java.beans.ConstructorProperties;
*/
public class DriveLicense {
- public static class Builder{
- private int amount;
- private License license;
- private Owner user;
-
- public Builder amount(int amount){
- this.amount = amount;
- return this;
- }
-
- public Builder license(License license){
- this.license = license;
- return this;
- }
-
- public Builder user(Owner user){
- this.user = user;
- return this;
- }
-
- public DriveLicense build(){
- return new DriveLicense(amount, license, user);
- }
- }
-
- private final int amount;
- private final License license;
- private final Owner user;
-
- @ConstructorProperties({
- "amount", "license", "user"
- })
- public DriveLicense(int amount, License license, Owner user) {
- this.amount = amount;
- this.license = license;
- this.user = user;
- }
-
- public int getAmount() {
- return amount;
- }
-
- public License getLicense() {
- return license;
- }
-
- public Owner getUser() {
- return user;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof DriveLicense)) return false;
-
- DriveLicense that = (DriveLicense) o;
-
- if (amount != that.amount) return false;
- if (license != null ? !license.equals(that.license) : that.license != null) return false;
- if (user != null ? !user.equals(that.user) : that.user != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = amount;
- result = 31 * result + (license != null ? license.hashCode() : 0);
- result = 31 * result + (user != null ? user.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return "[" +
- "amount=" + amount +
- ", license='" + license + '\'' +
- ", user=" + user +
- "]";
- }
+ public static class Builder {
+ private int amount;
+ private License license;
+ private Owner user;
+
+ public Builder amount(int amount) {
+ this.amount = amount;
+ return this;
+ }
+
+ public Builder license(License license) {
+ this.license = license;
+ return this;
+ }
+
+ public Builder user(Owner user) {
+ this.user = user;
+ return this;
+ }
+
+ public DriveLicense build() {
+ return new DriveLicense(amount, license, user);
+ }
+ }
+
+ private final int amount;
+ private final License license;
+ private final Owner user;
+
+ @ConstructorProperties({
+ "amount", "license", "user"
+ })
+ public DriveLicense(int amount, License license, Owner user) {
+ this.amount = amount;
+ this.license = license;
+ this.user = user;
+ }
+
+ public int getAmount() {
+ return amount;
+ }
+
+ public License getLicense() {
+ return license;
+ }
+
+ public Owner getUser() {
+ return user;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof DriveLicense)) return false;
+
+ DriveLicense that = (DriveLicense) o;
+
+ if (amount != that.amount) return false;
+ if (license != null ? !license.equals(that.license) : that.license != null) return false;
+ if (user != null ? !user.equals(that.user) : that.user != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = amount;
+ result = 31 * result + (license != null ? license.hashCode() : 0);
+ result = 31 * result + (user != null ? user.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "[" +
+ "amount=" + amount +
+ ", license='" + license + '\'' +
+ ", user=" + user +
+ "]";
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DriveStatus.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DriveStatus.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DriveStatus.java
index e5f74e3..328a17f 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DriveStatus.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DriveStatus.java
@@ -19,7 +19,6 @@ package org.jclouds.cloudsigma2.domain;
import static com.google.common.base.Preconditions.checkNotNull;
/**
- *
* @author Adrian Cole
*/
public enum DriveStatus {
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DrivesListRequestFieldsGroup.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DrivesListRequestFieldsGroup.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DrivesListRequestFieldsGroup.java
index 17def00..ad8d3df 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DrivesListRequestFieldsGroup.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DrivesListRequestFieldsGroup.java
@@ -22,30 +22,30 @@ import java.util.Iterator;
* @author Vladimir Shevchenko
*/
public class DrivesListRequestFieldsGroup {
- private final Iterable<String> fields;
+ private final Iterable<String> fields;
- public DrivesListRequestFieldsGroup(Iterable<String> fields) {
- this.fields = fields;
- }
+ public DrivesListRequestFieldsGroup(Iterable<String> fields) {
+ this.fields = fields;
+ }
- public Iterable<String> getFields() {
- return fields;
- }
+ public Iterable<String> getFields() {
+ return fields;
+ }
- @Override
- public String toString() {
- String returnString = "";
+ @Override
+ public String toString() {
+ String returnString = "";
- Iterator iterator = fields.iterator();
+ Iterator iterator = fields.iterator();
- while (iterator.hasNext()){
- returnString += iterator.next();
+ while (iterator.hasNext()) {
+ returnString += iterator.next();
- if(iterator.hasNext()){
- returnString += ",";
- }
- }
+ if (iterator.hasNext()) {
+ returnString += ",";
+ }
+ }
- return returnString;
- }
+ return returnString;
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallAction.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallAction.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallAction.java
index 9da05d3..8f5f279 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallAction.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallAction.java
@@ -22,22 +22,22 @@ import static com.google.common.base.Preconditions.checkNotNull;
* @author Vladimir Shevchenko
*/
public enum FirewallAction {
- DROP, ACCEPT;
+ DROP, ACCEPT;
- public String value() {
- return name().toLowerCase();
- }
+ public String value() {
+ return name().toLowerCase();
+ }
- @Override
- public String toString() {
- return value();
- }
+ @Override
+ public String toString() {
+ return value();
+ }
- public static FirewallAction fromValue(String type) {
- try {
- return valueOf(checkNotNull(type, "type").toUpperCase());
- } catch (IllegalArgumentException e) {
- return null;
- }
- }
+ public static FirewallAction fromValue(String type) {
+ try {
+ return valueOf(checkNotNull(type, "type").toUpperCase());
+ } catch (IllegalArgumentException e) {
+ return null;
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallDirection.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallDirection.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallDirection.java
index 36e729a..10cff38 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallDirection.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallDirection.java
@@ -22,22 +22,22 @@ import static com.google.common.base.Preconditions.checkNotNull;
* @author Vladimir Shevchenko
*/
public enum FirewallDirection {
- IN, OUT, BOTH;
+ IN, OUT, BOTH;
- public String value() {
- return name().toLowerCase();
- }
+ public String value() {
+ return name().toLowerCase();
+ }
- @Override
- public String toString() {
- return value();
- }
+ @Override
+ public String toString() {
+ return value();
+ }
- public static FirewallDirection fromValue(String type) {
- try {
- return valueOf(checkNotNull(type, "type").toUpperCase());
- } catch (IllegalArgumentException e) {
- return null;
- }
- }
+ public static FirewallDirection fromValue(String type) {
+ try {
+ return valueOf(checkNotNull(type, "type").toUpperCase());
+ } catch (IllegalArgumentException e) {
+ return null;
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallIpProtocol.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallIpProtocol.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallIpProtocol.java
index cd7ffcc..54f22c7 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallIpProtocol.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallIpProtocol.java
@@ -22,22 +22,22 @@ import static com.google.common.base.Preconditions.checkNotNull;
* @author Vladimir Shevchenko
*/
public enum FirewallIpProtocol {
- TCP, UDP;
+ TCP, UDP;
- public String value() {
- return name().toLowerCase();
- }
+ public String value() {
+ return name().toLowerCase();
+ }
- @Override
- public String toString() {
- return value();
- }
+ @Override
+ public String toString() {
+ return value();
+ }
- public static FirewallIpProtocol fromValue(String type) {
- try {
- return valueOf(checkNotNull(type, "type").toUpperCase());
- } catch (IllegalArgumentException e) {
- return null;
- }
- }
+ public static FirewallIpProtocol fromValue(String type) {
+ try {
+ return valueOf(checkNotNull(type, "type").toUpperCase());
+ } catch (IllegalArgumentException e) {
+ return null;
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallPolicy.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallPolicy.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallPolicy.java
index efd17b9..e3caba6 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallPolicy.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallPolicy.java
@@ -27,191 +27,191 @@ import java.util.Map;
/**
* @author Vladimir Shevchenko
*/
-public class FirewallPolicy extends Item{
-
- public static class Builder extends Item.Builder{
- private Map<String, String> meta;
- private Owner owner;
- private List<FirewallRule> rules;
- private List<Server> servers;
-
- /**
- * @param meta User assigned meta information for this policy
- * @return
- */
- public Builder meta(Map<String, String> meta){
- this.meta = meta;
- return this;
- }
-
- /**
- * @param owner Owner of the policy
- * @return
- */
- public Builder owner(Owner owner){
- this.owner = owner;
- return this;
- }
-
- /**
- * @param rules List of rules to be applied for this policy
- * @return
- */
- public Builder rules(List<FirewallRule> rules){
- this.rules = ImmutableList.copyOf(rules);
- return this;
- }
-
- /**
- * @param servers Servers which have nics with this policy applied
- * @return
- */
- public Builder servers(List<Server> servers){
- this.servers = ImmutableList.copyOf(servers);
- return this;
- }
-
- /**
- * @param resourceUri Resource URI
- * @return
- */
- @Override
- public Builder resourceUri(URI resourceUri){
- this.resourceUri = resourceUri;
- return this;
- }
-
- /**
- * @param name Human readable name of the firewall policy
- * @return
- */
- @Override
- public Builder name(String name){
- this.name = name;
- return this;
- }
-
- /**
- * @param uuid UUID of the policy
- * @return
- */
- @Override
- public Builder uuid(String uuid){
- this.uuid = uuid;
- return this;
- }
-
- public FirewallPolicy build(){
- return new FirewallPolicy(meta, name, owner, resourceUri, rules, servers, uuid);
- }
- }
-
- private final Map<String, String> meta;
- private final Owner owner;
- private final List<FirewallRule> rules;
- private final List<Server> servers;
-
- @ConstructorProperties({
- "meta", "name", "owner", "resource_uri", "rules", "servers", "uuid"
- })
- public FirewallPolicy(Map<String, String> meta, String name, Owner owner, URI resourceUri, List<FirewallRule> rules
- , List<Server> servers, String uuid) {
- super(uuid, name, resourceUri);
- this.meta = meta;
- this.owner = owner;
- this.rules = rules == null ? new ArrayList<FirewallRule>() : rules;
- this.servers = servers == null ? new ArrayList<Server>() : servers;
- }
-
- /**
- * @return User assigned meta information for this policy
- */
- public Map<String, String> getMeta() {
- return meta;
- }
-
- /**
- * @return Human readable name of the firewall policy
- */
- public String getName() {
- return name;
- }
-
- /**
- * @return Owner of the policy
- */
- public Owner getOwner() {
- return owner;
- }
-
- /**
- * @return resource uri
- */
- public URI getResourceUri() {
- return resourceUri;
- }
-
- /**
- * @return List of rules to be applied for this policy
- */
- public List<FirewallRule> getRules() {
- return rules;
- }
-
- /**
- * @return Servers which have nics with this policy applied
- */
- public List<Server> getServers() {
- return servers;
- }
-
- /**
- * @return UUID of the policy
- */
- public String getUuid() {
- return uuid;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof FirewallPolicy)) return false;
- if (!super.equals(o)) return false;
-
- FirewallPolicy that = (FirewallPolicy) o;
-
- if (meta != null ? !meta.equals(that.meta) : that.meta != null) return false;
- if (owner != null ? !owner.equals(that.owner) : that.owner != null) return false;
- if (rules != null ? !rules.equals(that.rules) : that.rules != null) return false;
- if (servers != null ? !servers.equals(that.servers) : that.servers != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = super.hashCode();
- result = 31 * result + (meta != null ? meta.hashCode() : 0);
- result = 31 * result + (owner != null ? owner.hashCode() : 0);
- result = 31 * result + (rules != null ? rules.hashCode() : 0);
- result = 31 * result + (servers != null ? servers.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return "[" +
- "meta=" + meta +
- ", name='" + name + '\'' +
- ", owner=" + owner +
- ", resourceUri='" + resourceUri + '\'' +
- ", rules=" + rules +
- ", servers=" + servers +
- ", uuid='" + uuid + '\'' +
- "]";
- }
-
- public NIC toNIC(){
- return new NIC.Builder().firewallPolicy(this).build();
- }
+public class FirewallPolicy extends Item {
+
+ public static class Builder extends Item.Builder {
+ private Map<String, String> meta;
+ private Owner owner;
+ private List<FirewallRule> rules;
+ private List<Server> servers;
+
+ /**
+ * @param meta User assigned meta information for this policy
+ * @return
+ */
+ public Builder meta(Map<String, String> meta) {
+ this.meta = meta;
+ return this;
+ }
+
+ /**
+ * @param owner Owner of the policy
+ * @return
+ */
+ public Builder owner(Owner owner) {
+ this.owner = owner;
+ return this;
+ }
+
+ /**
+ * @param rules List of rules to be applied for this policy
+ * @return
+ */
+ public Builder rules(List<FirewallRule> rules) {
+ this.rules = ImmutableList.copyOf(rules);
+ return this;
+ }
+
+ /**
+ * @param servers Servers which have nics with this policy applied
+ * @return
+ */
+ public Builder servers(List<Server> servers) {
+ this.servers = ImmutableList.copyOf(servers);
+ return this;
+ }
+
+ /**
+ * @param resourceUri Resource URI
+ * @return
+ */
+ @Override
+ public Builder resourceUri(URI resourceUri) {
+ this.resourceUri = resourceUri;
+ return this;
+ }
+
+ /**
+ * @param name Human readable name of the firewall policy
+ * @return
+ */
+ @Override
+ public Builder name(String name) {
+ this.name = name;
+ return this;
+ }
+
+ /**
+ * @param uuid UUID of the policy
+ * @return
+ */
+ @Override
+ public Builder uuid(String uuid) {
+ this.uuid = uuid;
+ return this;
+ }
+
+ public FirewallPolicy build() {
+ return new FirewallPolicy(meta, name, owner, resourceUri, rules, servers, uuid);
+ }
+ }
+
+ private final Map<String, String> meta;
+ private final Owner owner;
+ private final List<FirewallRule> rules;
+ private final List<Server> servers;
+
+ @ConstructorProperties({
+ "meta", "name", "owner", "resource_uri", "rules", "servers", "uuid"
+ })
+ public FirewallPolicy(Map<String, String> meta, String name, Owner owner, URI resourceUri, List<FirewallRule> rules
+ , List<Server> servers, String uuid) {
+ super(uuid, name, resourceUri);
+ this.meta = meta;
+ this.owner = owner;
+ this.rules = rules == null ? new ArrayList<FirewallRule>() : rules;
+ this.servers = servers == null ? new ArrayList<Server>() : servers;
+ }
+
+ /**
+ * @return User assigned meta information for this policy
+ */
+ public Map<String, String> getMeta() {
+ return meta;
+ }
+
+ /**
+ * @return Human readable name of the firewall policy
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @return Owner of the policy
+ */
+ public Owner getOwner() {
+ return owner;
+ }
+
+ /**
+ * @return resource uri
+ */
+ public URI getResourceUri() {
+ return resourceUri;
+ }
+
+ /**
+ * @return List of rules to be applied for this policy
+ */
+ public List<FirewallRule> getRules() {
+ return rules;
+ }
+
+ /**
+ * @return Servers which have nics with this policy applied
+ */
+ public List<Server> getServers() {
+ return servers;
+ }
+
+ /**
+ * @return UUID of the policy
+ */
+ public String getUuid() {
+ return uuid;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof FirewallPolicy)) return false;
+ if (!super.equals(o)) return false;
+
+ FirewallPolicy that = (FirewallPolicy) o;
+
+ if (meta != null ? !meta.equals(that.meta) : that.meta != null) return false;
+ if (owner != null ? !owner.equals(that.owner) : that.owner != null) return false;
+ if (rules != null ? !rules.equals(that.rules) : that.rules != null) return false;
+ if (servers != null ? !servers.equals(that.servers) : that.servers != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = super.hashCode();
+ result = 31 * result + (meta != null ? meta.hashCode() : 0);
+ result = 31 * result + (owner != null ? owner.hashCode() : 0);
+ result = 31 * result + (rules != null ? rules.hashCode() : 0);
+ result = 31 * result + (servers != null ? servers.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "[" +
+ "meta=" + meta +
+ ", name='" + name + '\'' +
+ ", owner=" + owner +
+ ", resourceUri='" + resourceUri + '\'' +
+ ", rules=" + rules +
+ ", servers=" + servers +
+ ", uuid='" + uuid + '\'' +
+ "]";
+ }
+
+ public NIC toNIC() {
+ return new NIC.Builder().firewallPolicy(this).build();
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallRule.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallRule.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallRule.java
index eaf9df0..f948ec7 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallRule.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallRule.java
@@ -24,224 +24,225 @@ import java.beans.ConstructorProperties;
*/
public class FirewallRule {
- public static class Builder{
- private FirewallAction action;
- private String comment;
- private FirewallDirection direction;
- private String destinationIp;
- private String destinationPort;
- private FirewallIpProtocol ipProtocol;
- private String sourceIp;
- private String sourcePort;
-
- /**
- * @param action Action to be taken
- * @return FirewallRule Builder
- */
- public Builder action(FirewallAction action){
- this.action = action;
- return this;
- }
-
- /**
- * @param comment Optional rule comment
- * @return FirewallRule Builder
- */
- public Builder comment(String comment){
- this.comment = comment;
- return this;
- }
-
- /**
- * @param direction Packet direction
- * @return FirewallRule Builder
- */
- public Builder direction(FirewallDirection direction){
- this.direction = direction;
- return this;
- }
-
- /**
- * @param destinationIp Destination IP address
- * @return FirewallRule Builder
- */
- public Builder destinationIp(String destinationIp){
- this.destinationIp = destinationIp;
- return this;
- }
-
- /**
- * @param destinationPort Destination port
- * @return FirewallRule Builder
- */
- public Builder destinationPort(String destinationPort){
- this.destinationPort = destinationPort;
- return this;
- }
-
- /**
- * @param ipProtocol IP protocol
- * @return FirewallRule Builder
- */
- public Builder ipProtocol(FirewallIpProtocol ipProtocol){
- this.ipProtocol = ipProtocol;
- return this;
- }
-
- /**
- * @param sourceIp Source IP address
- * @return FirewallRule Builder
- */
- public Builder sourceIp(String sourceIp){
- this.sourceIp = sourceIp;
- return this;
- }
-
- /**
- * @param sourcePort Source port
- * @return FirewallRule Builder
- */
- public Builder sourcePort(String sourcePort){
- this.sourcePort = sourcePort;
- return this;
- }
-
- public FirewallRule build(){
- return new FirewallRule(action, comment, direction, destinationIp, destinationPort, ipProtocol, sourceIp, sourcePort);
- }
- }
-
- private final FirewallAction action;
- private final String comment;
- private final FirewallDirection direction;
- @Named("dst_ip")
- private final String destinationIp;
- @Named("dst_port")
- private final String destinationPort;
- @Named("ip_proto")
- private final FirewallIpProtocol ipProtocol;
- @Named("src_ip")
- private final String sourceIp;
- @Named("src_port")
- private final String sourcePort;
-
- @ConstructorProperties({
- "action", "comment", "direction", "dst_ip",
- "dst_port", "ip_proto", "src_ip", "src_port"
- })
- public FirewallRule(FirewallAction action, String comment, FirewallDirection direction, String destinationIp
- , String destinationPort, FirewallIpProtocol ipProtocol, String sourceIp, String sourcePort) {
- this.action = action;
- this.comment = comment;
- this.direction = direction;
- this.destinationIp = destinationIp;
- this.destinationPort = destinationPort;
- this.ipProtocol = ipProtocol;
- this.sourceIp = sourceIp;
- this.sourcePort = sourcePort;
- }
-
- /**
- * @return Action to be taken
- */
- public FirewallAction getAction() {
- return action;
- }
-
- /**
- * @return Optional rule comment
- */
- public String getComment() {
- return comment;
- }
-
- /**
- * @return Packet direction
- */
- public FirewallDirection getDirection() {
- return direction;
- }
-
- /**
- * @return Destination IP address
- */
- public String getDestinationIp() {
- return destinationIp;
- }
-
- /**
- * @return Destination port
- */
- public String getDestinationPort() {
- return destinationPort;
- }
-
- /**
- * @return IP protocol
- */
- public FirewallIpProtocol getIpProtocol() {
- return ipProtocol;
- }
-
- /**
- * @return Source IP address
- */
- public String getSourceIp() {
- return sourceIp;
- }
-
- /**
- * @return Source port
- */
- public String getSourcePort() {
- return sourcePort;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof FirewallRule)) return false;
-
- FirewallRule that = (FirewallRule) o;
-
- if (action != that.action) return false;
- if (comment != null ? !comment.equals(that.comment) : that.comment != null) return false;
- if (destinationIp != null ? !destinationIp.equals(that.destinationIp) : that.destinationIp != null)
- return false;
- if (destinationPort != null ? !destinationPort.equals(that.destinationPort) : that.destinationPort != null)
- return false;
- if (direction != that.direction) return false;
- if (ipProtocol != that.ipProtocol) return false;
- if (sourceIp != null ? !sourceIp.equals(that.sourceIp) : that.sourceIp != null) return false;
- if (sourcePort != null ? !sourcePort.equals(that.sourcePort) : that.sourcePort != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = action != null ? action.hashCode() : 0;
- result = 31 * result + (comment != null ? comment.hashCode() : 0);
- result = 31 * result + (direction != null ? direction.hashCode() : 0);
- result = 31 * result + (destinationIp != null ? destinationIp.hashCode() : 0);
- result = 31 * result + (destinationPort != null ? destinationPort.hashCode() : 0);
- result = 31 * result + (ipProtocol != null ? ipProtocol.hashCode() : 0);
- result = 31 * result + (sourceIp != null ? sourceIp.hashCode() : 0);
- result = 31 * result + (sourcePort != null ? sourcePort.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return "[" +
- "action=" + action +
- ", comment='" + comment + '\'' +
- ", direction=" + direction +
- ", destinationIp='" + destinationIp + '\'' +
- ", destinationPort='" + destinationPort + '\'' +
- ", ipProtocol=" + ipProtocol +
- ", sourceIp='" + sourceIp + '\'' +
- ", sourcePort='" + sourcePort + '\'' +
- "]";
- }
+ public static class Builder {
+ private FirewallAction action;
+ private String comment;
+ private FirewallDirection direction;
+ private String destinationIp;
+ private String destinationPort;
+ private FirewallIpProtocol ipProtocol;
+ private String sourceIp;
+ private String sourcePort;
+
+ /**
+ * @param action Action to be taken
+ * @return FirewallRule Builder
+ */
+ public Builder action(FirewallAction action) {
+ this.action = action;
+ return this;
+ }
+
+ /**
+ * @param comment Optional rule comment
+ * @return FirewallRule Builder
+ */
+ public Builder comment(String comment) {
+ this.comment = comment;
+ return this;
+ }
+
+ /**
+ * @param direction Packet direction
+ * @return FirewallRule Builder
+ */
+ public Builder direction(FirewallDirection direction) {
+ this.direction = direction;
+ return this;
+ }
+
+ /**
+ * @param destinationIp Destination IP address
+ * @return FirewallRule Builder
+ */
+ public Builder destinationIp(String destinationIp) {
+ this.destinationIp = destinationIp;
+ return this;
+ }
+
+ /**
+ * @param destinationPort Destination port
+ * @return FirewallRule Builder
+ */
+ public Builder destinationPort(String destinationPort) {
+ this.destinationPort = destinationPort;
+ return this;
+ }
+
+ /**
+ * @param ipProtocol IP protocol
+ * @return FirewallRule Builder
+ */
+ public Builder ipProtocol(FirewallIpProtocol ipProtocol) {
+ this.ipProtocol = ipProtocol;
+ return this;
+ }
+
+ /**
+ * @param sourceIp Source IP address
+ * @return FirewallRule Builder
+ */
+ public Builder sourceIp(String sourceIp) {
+ this.sourceIp = sourceIp;
+ return this;
+ }
+
+ /**
+ * @param sourcePort Source port
+ * @return FirewallRule Builder
+ */
+ public Builder sourcePort(String sourcePort) {
+ this.sourcePort = sourcePort;
+ return this;
+ }
+
+ public FirewallRule build() {
+ return new FirewallRule(action, comment, direction, destinationIp, destinationPort, ipProtocol, sourceIp
+ , sourcePort);
+ }
+ }
+
+ private final FirewallAction action;
+ private final String comment;
+ private final FirewallDirection direction;
+ @Named("dst_ip")
+ private final String destinationIp;
+ @Named("dst_port")
+ private final String destinationPort;
+ @Named("ip_proto")
+ private final FirewallIpProtocol ipProtocol;
+ @Named("src_ip")
+ private final String sourceIp;
+ @Named("src_port")
+ private final String sourcePort;
+
+ @ConstructorProperties({
+ "action", "comment", "direction", "dst_ip",
+ "dst_port", "ip_proto", "src_ip", "src_port"
+ })
+ public FirewallRule(FirewallAction action, String comment, FirewallDirection direction, String destinationIp
+ , String destinationPort, FirewallIpProtocol ipProtocol, String sourceIp, String sourcePort) {
+ this.action = action;
+ this.comment = comment;
+ this.direction = direction;
+ this.destinationIp = destinationIp;
+ this.destinationPort = destinationPort;
+ this.ipProtocol = ipProtocol;
+ this.sourceIp = sourceIp;
+ this.sourcePort = sourcePort;
+ }
+
+ /**
+ * @return Action to be taken
+ */
+ public FirewallAction getAction() {
+ return action;
+ }
+
+ /**
+ * @return Optional rule comment
+ */
+ public String getComment() {
+ return comment;
+ }
+
+ /**
+ * @return Packet direction
+ */
+ public FirewallDirection getDirection() {
+ return direction;
+ }
+
+ /**
+ * @return Destination IP address
+ */
+ public String getDestinationIp() {
+ return destinationIp;
+ }
+
+ /**
+ * @return Destination port
+ */
+ public String getDestinationPort() {
+ return destinationPort;
+ }
+
+ /**
+ * @return IP protocol
+ */
+ public FirewallIpProtocol getIpProtocol() {
+ return ipProtocol;
+ }
+
+ /**
+ * @return Source IP address
+ */
+ public String getSourceIp() {
+ return sourceIp;
+ }
+
+ /**
+ * @return Source port
+ */
+ public String getSourcePort() {
+ return sourcePort;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof FirewallRule)) return false;
+
+ FirewallRule that = (FirewallRule) o;
+
+ if (action != that.action) return false;
+ if (comment != null ? !comment.equals(that.comment) : that.comment != null) return false;
+ if (destinationIp != null ? !destinationIp.equals(that.destinationIp) : that.destinationIp != null)
+ return false;
+ if (destinationPort != null ? !destinationPort.equals(that.destinationPort) : that.destinationPort != null)
+ return false;
+ if (direction != that.direction) return false;
+ if (ipProtocol != that.ipProtocol) return false;
+ if (sourceIp != null ? !sourceIp.equals(that.sourceIp) : that.sourceIp != null) return false;
+ if (sourcePort != null ? !sourcePort.equals(that.sourcePort) : that.sourcePort != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = action != null ? action.hashCode() : 0;
+ result = 31 * result + (comment != null ? comment.hashCode() : 0);
+ result = 31 * result + (direction != null ? direction.hashCode() : 0);
+ result = 31 * result + (destinationIp != null ? destinationIp.hashCode() : 0);
+ result = 31 * result + (destinationPort != null ? destinationPort.hashCode() : 0);
+ result = 31 * result + (ipProtocol != null ? ipProtocol.hashCode() : 0);
+ result = 31 * result + (sourceIp != null ? sourceIp.hashCode() : 0);
+ result = 31 * result + (sourcePort != null ? sourcePort.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "[" +
+ "action=" + action +
+ ", comment='" + comment + '\'' +
+ ", direction=" + direction +
+ ", destinationIp='" + destinationIp + '\'' +
+ ", destinationPort='" + destinationPort + '\'' +
+ ", ipProtocol=" + ipProtocol +
+ ", sourceIp='" + sourceIp + '\'' +
+ ", sourcePort='" + sourcePort + '\'' +
+ "]";
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/IOStats.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/IOStats.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/IOStats.java
index b71a369..4a10789 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/IOStats.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/IOStats.java
@@ -24,99 +24,99 @@ import java.beans.ConstructorProperties;
*/
public class IOStats {
- @Named("bytes_recv")
- private final String bytesReceived;
- @Named("bytes_sent")
- private final String bytesSent;
- @Named("packets_recv")
- private final String packetsReceived;
- @Named("packets_sent")
- private final String packetsSent;
+ @Named("bytes_recv")
+ private final String bytesReceived;
+ @Named("bytes_sent")
+ private final String bytesSent;
+ @Named("packets_recv")
+ private final String packetsReceived;
+ @Named("packets_sent")
+ private final String packetsSent;
- @ConstructorProperties({
- "bytes_recv", "bytes_sent", "packets_recv", "packets_sent"
- })
- public IOStats(String bytesReceived, String bytesSent, String packetsReceived, String packetsSent){
- this.bytesReceived = bytesReceived;
- this.bytesSent = bytesSent;
- this.packetsReceived = packetsReceived;
- this.packetsSent = packetsSent;
- }
+ @ConstructorProperties({
+ "bytes_recv", "bytes_sent", "packets_recv", "packets_sent"
+ })
+ public IOStats(String bytesReceived, String bytesSent, String packetsReceived, String packetsSent) {
+ this.bytesReceived = bytesReceived;
+ this.bytesSent = bytesSent;
+ this.packetsReceived = packetsReceived;
+ this.packetsSent = packetsSent;
+ }
- /**
- * @return Bytes received on this interface
- */
- public String getBytesReceived() {
- return bytesReceived;
- }
+ /**
+ * @return Bytes received on this interface
+ */
+ public String getBytesReceived() {
+ return bytesReceived;
+ }
- /**
- * @return Packets received on this interface
- */
- public String getBytesSent() {
- return bytesSent;
- }
+ /**
+ * @return Packets received on this interface
+ */
+ public String getBytesSent() {
+ return bytesSent;
+ }
- /**
- * @return Bytes sent from this interface
- */
- public String getPacketsReceived() {
- return packetsReceived;
- }
+ /**
+ * @return Bytes sent from this interface
+ */
+ public String getPacketsReceived() {
+ return packetsReceived;
+ }
- /**
- * @return Packets sent from this interface
- */
- public String getPacketsSent() {
- return packetsSent;
- }
+ /**
+ * @return Packets sent from this interface
+ */
+ public String getPacketsSent() {
+ return packetsSent;
+ }
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result + ((bytesReceived == null) ? 0 : bytesReceived.hashCode());
- result = prime * result + ((bytesSent == null) ? 0 : bytesSent.hashCode());
- result = prime * result + ((packetsReceived == null) ? 0 : packetsReceived.hashCode());
- result = prime * result + ((packetsSent == null) ? 0 : packetsSent.hashCode());
- return result;
- }
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((bytesReceived == null) ? 0 : bytesReceived.hashCode());
+ result = prime * result + ((bytesSent == null) ? 0 : bytesSent.hashCode());
+ result = prime * result + ((packetsReceived == null) ? 0 : packetsReceived.hashCode());
+ result = prime * result + ((packetsSent == null) ? 0 : packetsSent.hashCode());
+ return result;
+ }
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (!super.equals(obj))
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ IOStats other = (IOStats) obj;
+ if (bytesReceived == null) {
+ if (other.bytesReceived != null)
return false;
- if (getClass() != obj.getClass())
+ } else if (!bytesReceived.equals(other.bytesReceived))
+ return false;
+ if (bytesSent == null) {
+ if (other.bytesSent != null)
return false;
- IOStats other = (IOStats) obj;
- if (bytesReceived == null) {
- if (other.bytesReceived != null)
- return false;
- } else if (!bytesReceived.equals(other.bytesReceived))
+ } else if (!bytesSent.equals(other.bytesSent))
+ return false;
+ if (packetsReceived == null) {
+ if (other.packetsReceived != null)
return false;
- if (bytesSent == null) {
- if (other.bytesSent != null)
- return false;
- } else if (!bytesSent.equals(other.bytesSent))
+ } else if (!packetsReceived.equals(other.packetsReceived))
+ return false;
+ if (packetsSent == null) {
+ if (other.packetsSent != null)
return false;
- if (packetsReceived == null) {
- if (other.packetsReceived != null)
- return false;
- } else if (!packetsReceived.equals(other.packetsReceived))
- return false;
- if (packetsSent == null) {
- if (other.packetsSent != null)
- return false;
- } else if (!packetsSent.equals(other.packetsSent))
- return false;
- return true;
- }
+ } else if (!packetsSent.equals(other.packetsSent))
+ return false;
+ return true;
+ }
- @Override
- public String toString() {
- return "[bytesReceived=" + bytesReceived + ", bytesSent=" + bytesSent + ", packetsReceived=" + packetsReceived
- + ", packetsSent=" + packetsSent + "]";
- }
+ @Override
+ public String toString() {
+ return "[bytesReceived=" + bytesReceived + ", bytesSent=" + bytesSent + ", packetsReceived=" + packetsReceived
+ + ", packetsSent=" + packetsSent + "]";
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/IP.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/IP.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/IP.java
index 730c031..de7891a 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/IP.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/IP.java
@@ -26,226 +26,226 @@ import java.net.URI;
*/
public class IP {
- public static class Builder {
- protected Owner owner;
- protected String uuid;
- protected Server server;
- protected URI resourceUri;
-
- /**
- * @param uuid Uuid of the ip.
- * @return IP Builder
- */
- public Builder uuid(String uuid) {
- this.uuid = uuid;
- return this;
- }
-
- /**
- * @param owner Owner of the ip.
- * @return IP Builder
- */
- public Builder owner(Owner owner) {
- this.owner = owner;
- return this;
- }
-
- /**
- * @param server Server this IP assigned to
- * @return IP Builder
- */
- public Builder server(Server server) {
- this.server = server;
- return this;
- }
-
- /**
- * @param resourceUri Resource uri
- * @return IP Builder
- */
- public Builder resourceUri(URI resourceUri) {
- this.resourceUri = resourceUri;
- return this;
- }
-
- public IP build() {
- return new IP(uuid, owner, server, resourceUri);
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof Builder)) return false;
-
- Builder builder = (Builder) o;
-
- if (owner != null ? !owner.equals(builder.owner) : builder.owner != null) return false;
- if (resourceUri != null ? !resourceUri.equals(builder.resourceUri) : builder.resourceUri != null)
- return false;
- if (server != null ? !server.equals(builder.server) : builder.server != null) return false;
- if (uuid != null ? !uuid.equals(builder.uuid) : builder.uuid != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = owner != null ? owner.hashCode() : 0;
- result = 31 * result + (uuid != null ? uuid.hashCode() : 0);
- result = 31 * result + (server != null ? server.hashCode() : 0);
- result = 31 * result + (resourceUri != null ? resourceUri.hashCode() : 0);
- return result;
- }
- }
-
- protected final Owner owner;
- protected final String uuid;
- protected final Server server;
- protected final URI resourceUri;
-
- @ConstructorProperties({
- "uuid", "owner", "server", "resource_uri"
- })
- public IP(String uuid, Owner owner, Server server, URI resourceUri) {
- this.owner = owner;
- this.uuid = uuid;
- this.server = server;
- this.resourceUri = resourceUri;
- }
-
- /**
- * @return Uuid of the ip.
- */
- @Nullable
- public String getUuid() {
- return uuid;
- }
-
- /**
- * @return Owner of the ip.
- */
- public Owner getOwner() {
- return owner;
- }
-
- /**
- * @return Server this IP assigned to
- */
- public Server getServer() {
- return server;
- }
-
- /**
- * @return Resource uri
- */
- public URI getResourceUri() {
- return resourceUri;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof IP)) return false;
-
- IP ip = (IP) o;
-
- if (owner != null ? !owner.equals(ip.owner) : ip.owner != null) return false;
- if (resourceUri != null ? !resourceUri.equals(ip.resourceUri) : ip.resourceUri != null) return false;
- if (server != null ? !server.equals(ip.server) : ip.server != null) return false;
- if (uuid != null ? !uuid.equals(ip.uuid) : ip.uuid != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = owner != null ? owner.hashCode() : 0;
- result = 31 * result + (uuid != null ? uuid.hashCode() : 0);
- result = 31 * result + (server != null ? server.hashCode() : 0);
- result = 31 * result + (resourceUri != null ? resourceUri.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return "[" +
- "owner=" + owner +
- ", uuid='" + uuid + '\'' +
- ", server=" + server +
- ", resourceUri=" + resourceUri +
- "]";
- }
-
- /**
- * Creates DHCP V4 NIC for attaching to server
- *
- * @param model Interface model
- * @param firewallPolicy Firewall policy for interface
- * @return server's NIC
- */
- public static NIC createDHCPIPv4ConfNIC(Model model, FirewallPolicy firewallPolicy){
- return new NIC.Builder()
- .ipV4Configuration(new IPConfiguration(IPConfigurationType.DHCP, null))
- .model(model)
- .firewallPolicy(firewallPolicy)
- .build();
- }
-
- /**
- * Creates DHCP V4 NIC for attaching to server
- *
- * @param model Interface model
- * @return server's NIC
- */
- public static NIC createDHCPIPv4ConfNIC(Model model){
- return createDHCPIPv4ConfNIC(model, null);
- }
-
- /**
- * Creates DHCP V6 NIC for attaching to server
- *
- * @param model Interface model
- * @param firewallPolicy Firewall policy for interface
- * @return server's NIC
- */
- public static NIC createDHCPIPv6ConfNIC(Model model, FirewallPolicy firewallPolicy){
- return new NIC.Builder()
- .ipV4Configuration(new IPConfiguration(IPConfigurationType.DHCP, null))
- .model(model)
- .firewallPolicy(firewallPolicy)
- .build();
- }
-
- /**
- * Creates DHCP V6 NIC for attaching to server
- *
- * @param model Interface model
- * @return server's NIC
- */
- public static NIC createDHCPIPv6ConfNIC(Model model){
- return createDHCPIPv6ConfNIC(model, null);
- }
-
- /**
- * Creates NIC with static IP for attaching to server
- *
- * @param model Interface model
- * @param firewallPolicy Firewall policy
- * @return server's NIC
- */
- public NIC toNIC(Model model, FirewallPolicy firewallPolicy){
- return new NIC.Builder()
- .ipV4Configuration(new IPConfiguration(IPConfigurationType.STATIC, this))
- .firewallPolicy(firewallPolicy)
- .build();
- }
-
- /**
- * Creates NIC with static IP for attaching to server
- *
- * @return server's NIC
- */
- public NIC toNIC(){
- return toNIC(null, null);
- }
+ public static class Builder {
+ protected Owner owner;
+ protected String uuid;
+ protected Server server;
+ protected URI resourceUri;
+
+ /**
+ * @param uuid Uuid of the ip.
+ * @return IP Builder
+ */
+ public Builder uuid(String uuid) {
+ this.uuid = uuid;
+ return this;
+ }
+
+ /**
+ * @param owner Owner of the ip.
+ * @return IP Builder
+ */
+ public Builder owner(Owner owner) {
+ this.owner = owner;
+ return this;
+ }
+
+ /**
+ * @param server Server this IP assigned to
+ * @return IP Builder
+ */
+ public Builder server(Server server) {
+ this.server = server;
+ return this;
+ }
+
+ /**
+ * @param resourceUri Resource uri
+ * @return IP Builder
+ */
+ public Builder resourceUri(URI resourceUri) {
+ this.resourceUri = resourceUri;
+ return this;
+ }
+
+ public IP build() {
+ return new IP(uuid, owner, server, resourceUri);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof Builder)) return false;
+
+ Builder builder = (Builder) o;
+
+ if (owner != null ? !owner.equals(builder.owner) : builder.owner != null) return false;
+ if (resourceUri != null ? !resourceUri.equals(builder.resourceUri) : builder.resourceUri != null)
+ return false;
+ if (server != null ? !server.equals(builder.server) : builder.server != null) return false;
+ if (uuid != null ? !uuid.equals(builder.uuid) : builder.uuid != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = owner != null ? owner.hashCode() : 0;
+ result = 31 * result + (uuid != null ? uuid.hashCode() : 0);
+ result = 31 * result + (server != null ? server.hashCode() : 0);
+ result = 31 * result + (resourceUri != null ? resourceUri.hashCode() : 0);
+ return result;
+ }
+ }
+
+ protected final Owner owner;
+ protected final String uuid;
+ protected final Server server;
+ protected final URI resourceUri;
+
+ @ConstructorProperties({
+ "uuid", "owner", "server", "resource_uri"
+ })
+ public IP(String uuid, Owner owner, Server server, URI resourceUri) {
+ this.owner = owner;
+ this.uuid = uuid;
+ this.server = server;
+ this.resourceUri = resourceUri;
+ }
+
+ /**
+ * @return Uuid of the ip.
+ */
+ @Nullable
+ public String getUuid() {
+ return uuid;
+ }
+
+ /**
+ * @return Owner of the ip.
+ */
+ public Owner getOwner() {
+ return owner;
+ }
+
+ /**
+ * @return Server this IP assigned to
+ */
+ public Server getServer() {
+ return server;
+ }
+
+ /**
+ * @return Resource uri
+ */
+ public URI getResourceUri() {
+ return resourceUri;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof IP)) return false;
+
+ IP ip = (IP) o;
+
+ if (owner != null ? !owner.equals(ip.owner) : ip.owner != null) return false;
+ if (resourceUri != null ? !resourceUri.equals(ip.resourceUri) : ip.resourceUri != null) return false;
+ if (server != null ? !server.equals(ip.server) : ip.server != null) return false;
+ if (uuid != null ? !uuid.equals(ip.uuid) : ip.uuid != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = owner != null ? owner.hashCode() : 0;
+ result = 31 * result + (uuid != null ? uuid.hashCode() : 0);
+ result = 31 * result + (server != null ? server.hashCode() : 0);
+ result = 31 * result + (resourceUri != null ? resourceUri.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "[" +
+ "owner=" + owner +
+ ", uuid='" + uuid + '\'' +
+ ", server=" + server +
+ ", resourceUri=" + resourceUri +
+ "]";
+ }
+
+ /**
+ * Creates DHCP V4 NIC for attaching to server
+ *
+ * @param model Interface model
+ * @param firewallPolicy Firewall policy for interface
+ * @return server's NIC
+ */
+ public static NIC createDHCPIPv4ConfNIC(Model model, FirewallPolicy firewallPolicy) {
+ return new NIC.Builder()
+ .ipV4Configuration(new IPConfiguration(IPConfigurationType.DHCP, null))
+ .model(model)
+ .firewallPolicy(firewallPolicy)
+ .build();
+ }
+
+ /**
+ * Creates DHCP V4 NIC for attaching to server
+ *
+ * @param model Interface model
+ * @return server's NIC
+ */
+ public static NIC createDHCPIPv4ConfNIC(Model model) {
+ return createDHCPIPv4ConfNIC(model, null);
+ }
+
+ /**
+ * Creates DHCP V6 NIC for attaching to server
+ *
+ * @param model Interface model
+ * @param firewallPolicy Firewall policy for interface
+ * @return server's NIC
+ */
+ public static NIC createDHCPIPv6ConfNIC(Model model, FirewallPolicy firewallPolicy) {
+ return new NIC.Builder()
+ .ipV4Configuration(new IPConfiguration(IPConfigurationType.DHCP, null))
+ .model(model)
+ .firewallPolicy(firewallPolicy)
+ .build();
+ }
+
+ /**
+ * Creates DHCP V6 NIC for attaching to server
+ *
+ * @param model Interface model
+ * @return server's NIC
+ */
+ public static NIC createDHCPIPv6ConfNIC(Model model) {
+ return createDHCPIPv6ConfNIC(model, null);
+ }
+
+ /**
+ * Creates NIC with static IP for attaching to server
+ *
+ * @param model Interface model
+ * @param firewallPolicy Firewall policy
+ * @return server's NIC
+ */
+ public NIC toNIC(Model model, FirewallPolicy firewallPolicy) {
+ return new NIC.Builder()
+ .ipV4Configuration(new IPConfiguration(IPConfigurationType.STATIC, this))
+ .firewallPolicy(firewallPolicy)
+ .build();
+ }
+
+ /**
+ * Creates NIC with static IP for attaching to server
+ *
+ * @return server's NIC
+ */
+ public NIC toNIC() {
+ return toNIC(null, null);
+ }
}