You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by la...@apache.org on 2014/03/31 09:14:00 UTC
[47/52] [partial] Moving jclouds dependencies to accurate parent
directories
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/HostAggregate.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/HostAggregate.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/HostAggregate.java
new file mode 100644
index 0000000..fc6744c
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/HostAggregate.java
@@ -0,0 +1,250 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.openstack.nova.v2_0.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+import java.util.Date;
+import java.util.Map;
+import java.util.Set;
+
+import javax.inject.Named;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.base.Optional;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Aggregates can be manipulated using the Aggregate Extension to Nova (alias "OS-AGGREGATES")
+ *
+ * @see org.jclouds.openstack.nova.v2_0.extensions.HostAggregateApi
+*/
+public class HostAggregate {
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromHostAggregate(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected String id;
+ protected String name;
+ protected String availabilityZone;
+ protected Set<String> hosts = ImmutableSet.of();
+ protected String state;
+ protected Date created;
+ protected Date updated;
+ protected Map<String, String> metadata = ImmutableMap.of();
+
+ /**
+ * @see HostAggregate#getId()
+ */
+ public T id(String id) {
+ this.id = id;
+ return self();
+ }
+
+ /**
+ * @see HostAggregate#getName()
+ */
+ public T name(String name) {
+ this.name = name;
+ return self();
+ }
+
+ /**
+ * @see HostAggregate#getAvailabilityZone()
+ */
+ public T availabilityZone(String availabilityZone) {
+ this.availabilityZone = availabilityZone;
+ return self();
+ }
+
+ /**
+ * @see HostAggregate#getHosts()
+ */
+ public T hosts(Set<String> hosts) {
+ this.hosts = ImmutableSet.copyOf(checkNotNull(hosts, "hosts"));
+ return self();
+ }
+
+ public T hosts(String... in) {
+ return hosts(ImmutableSet.copyOf(in));
+ }
+
+ /**
+ * @see HostAggregate#getState()
+ */
+ public T state(String state) {
+ this.state = state;
+ return self();
+ }
+
+ /**
+ * @see HostAggregate#getCreated()
+ */
+ public T created(Date created) {
+ this.created = created;
+ return self();
+ }
+
+ /**
+ * @see HostAggregate#getUpdated()
+ */
+ public T updated(Date updated) {
+ this.updated = updated;
+ return self();
+ }
+
+ /**
+ * @see HostAggregate#getMetadata()
+ */
+ public T metadata(Map<String, String> metadata) {
+ this.metadata = ImmutableMap.copyOf(checkNotNull(metadata, "metadata"));
+ return self();
+ }
+
+ public HostAggregate build() {
+ return new HostAggregate(id, name, availabilityZone, hosts, state, created, updated, metadata);
+ }
+
+ public T fromHostAggregate(HostAggregate in) {
+ return this
+ .id(in.getId())
+ .name(in.getName())
+ .availabilityZone(in.getAvailabilityZone())
+ .hosts(in.getHosts())
+ .state(in.getState())
+ .created(in.getCreated())
+ .updated(in.getUpdated().get())
+ .metadata(in.getMetadata());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ private final String id;
+ private final String name;
+ @Named("availability_zone")
+ private final String availabilityZone;
+ private final Set<String> hosts;
+ @Named("operational_state")
+ private final String state;
+ @Named("created_at")
+ private final Date created;
+ @Named("updated_at")
+ private final Optional<Date> updated;
+ private final Map<String, String> metadata;
+
+ @ConstructorProperties({
+ "id", "name", "availability_zone", "hosts", "operational_state", "created_at", "updated_at", "metadata"
+ })
+ protected HostAggregate(String id, String name, String availabilityZone, @Nullable Set<String> hosts, String state, Date created,
+ @Nullable Date updated, @Nullable Map<String, String> metadata) {
+ this.id = checkNotNull(id, "id");
+ this.name = checkNotNull(name, "name");
+ this.availabilityZone = checkNotNull(availabilityZone, "availabilityZone");
+ this.hosts = hosts == null ? ImmutableSet.<String>of() : ImmutableSet.copyOf(hosts);
+ this.state = checkNotNull(state, "state");
+ this.created = checkNotNull(created, "created");
+ this.updated = Optional.fromNullable(updated);
+ this.metadata = metadata == null ? ImmutableMap.<String,String>of() : ImmutableMap.copyOf(metadata);
+ }
+
+ public String getId() {
+ return this.id;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * note: an "Availability Zone" is different from a Nova "Zone"
+ *
+ * @return the availability zone this aggregate is in
+ */
+ public String getAvailabilityZone() {
+ return this.availabilityZone;
+ }
+
+ public Set<String> getHosts() {
+ return this.hosts;
+ }
+
+ public String getState() {
+ return this.state;
+ }
+
+ public Date getCreated() {
+ return this.created;
+ }
+
+ public Optional<Date> getUpdated() {
+ return this.updated;
+ }
+
+ public Map<String, String> getMetadata() {
+ return this.metadata;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(id, name, availabilityZone, hosts, state, created, updated, metadata);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ HostAggregate that = HostAggregate.class.cast(obj);
+ return Objects.equal(this.id, that.id)
+ && Objects.equal(this.name, that.name)
+ && Objects.equal(this.availabilityZone, that.availabilityZone)
+ && Objects.equal(this.hosts, that.hosts)
+ && Objects.equal(this.state, that.state)
+ && Objects.equal(this.created, that.created)
+ && Objects.equal(this.updated, that.updated)
+ && Objects.equal(this.metadata, that.metadata);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("id", id).add("name", name).add("availabilityZone", availabilityZone).add("hosts", hosts).add("state", state).add("created", created).add("updated", updated).add("metadata", metadata);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/HostResourceUsage.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/HostResourceUsage.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/HostResourceUsage.java
new file mode 100644
index 0000000..186fb33
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/HostResourceUsage.java
@@ -0,0 +1,180 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.openstack.nova.v2_0.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+
+import javax.inject.Named;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+
+/**
+ * Class HostResourceUsage
+*/
+public class HostResourceUsage {
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromHostResourceUsage(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected String host;
+ protected String project;
+ protected int memoryMb;
+ protected int cpu;
+ protected int diskGb;
+
+ /**
+ * @see HostResourceUsage#getHost()
+ */
+ public T host(String host) {
+ this.host = host;
+ return self();
+ }
+
+ /**
+ * @see HostResourceUsage#getProject()
+ */
+ public T project(String project) {
+ this.project = project;
+ return self();
+ }
+
+ /**
+ * @see HostResourceUsage#getMemoryMb()
+ */
+ public T memoryMb(int memoryMb) {
+ this.memoryMb = memoryMb;
+ return self();
+ }
+
+ /**
+ * @see HostResourceUsage#getCpu()
+ */
+ public T cpu(int cpu) {
+ this.cpu = cpu;
+ return self();
+ }
+
+ /**
+ * @see HostResourceUsage#getDiskGb()
+ */
+ public T diskGb(int diskGb) {
+ this.diskGb = diskGb;
+ return self();
+ }
+
+ public HostResourceUsage build() {
+ return new HostResourceUsage(host, project, memoryMb, cpu, diskGb);
+ }
+
+ public T fromHostResourceUsage(HostResourceUsage in) {
+ return this
+ .host(in.getHost())
+ .project(in.getProject())
+ .memoryMb(in.getMemoryMb())
+ .cpu(in.getCpu())
+ .diskGb(in.getDiskGb());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ private final String host;
+ private final String project;
+ @Named("memory_mb")
+ private final int memoryMb;
+ private final int cpu;
+ @Named("disk_gb")
+ private final int diskGb;
+
+ @ConstructorProperties({
+ "host", "project", "memory_mb", "cpu", "disk_gb"
+ })
+ protected HostResourceUsage(String host, @Nullable String project, int memoryMb, int cpu, int diskGb) {
+ this.host = checkNotNull(host, "host");
+ this.project = project;
+ this.memoryMb = memoryMb;
+ this.cpu = cpu;
+ this.diskGb = diskGb;
+ }
+
+ public String getHost() {
+ return this.host;
+ }
+
+ @Nullable
+ public String getProject() {
+ return this.project;
+ }
+
+ public int getMemoryMb() {
+ return this.memoryMb;
+ }
+
+ public int getCpu() {
+ return this.cpu;
+ }
+
+ public int getDiskGb() {
+ return this.diskGb;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(host, project, memoryMb, cpu, diskGb);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ HostResourceUsage that = HostResourceUsage.class.cast(obj);
+ return Objects.equal(this.host, that.host)
+ && Objects.equal(this.project, that.project)
+ && Objects.equal(this.memoryMb, that.memoryMb)
+ && Objects.equal(this.cpu, that.cpu)
+ && Objects.equal(this.diskGb, that.diskGb);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("host", host).add("project", project).add("memoryMb", memoryMb).add("cpu", cpu).add("diskGb", diskGb);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Image.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Image.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Image.java
new file mode 100644
index 0000000..65cc81d
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Image.java
@@ -0,0 +1,303 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.openstack.nova.v2_0.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+import java.util.Date;
+import java.util.Map;
+
+import javax.inject.Named;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.openstack.v2_0.domain.Link;
+import org.jclouds.openstack.v2_0.domain.Resource;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.collect.ImmutableMap;
+
+/**
+ * An image is a collection of files you use to create or rebuild a server. Operators provide
+ * pre-built OS images by default. You may also create custom images.
+ *
+ * @author Jeremy Daggett
+ * @see <a href= "http://docs.openstack.org/api/openstack-compute/1.1/content/Images-d1e4427.html"
+ />
+*/
+public class Image extends Resource {
+
+ /**
+ * In-flight images will have the status attribute set to SAVING and the conditional progress
+ * element (0-100% completion) will also be returned. Other possible values for the status
+ * attribute include: UNKNOWN, ACTIVE, SAVING, ERROR, and DELETED. Images with an ACTIVE status
+ * are available for install. The optional minDisk and minRam attributes set the minimum disk and
+ * RAM requirements needed to create a server with the image.
+ *
+ * @author Adrian Cole
+ */
+ public static enum Status {
+
+ UNRECOGNIZED, UNKNOWN, ACTIVE, SAVING, ERROR, DELETED;
+
+ public String value() {
+ return name();
+ }
+
+ public static Status fromValue(String v) {
+ try {
+ return valueOf(v);
+ } catch (IllegalArgumentException e) {
+ return UNRECOGNIZED;
+ }
+ }
+
+ }
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromImage(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> extends Resource.Builder<T> {
+ protected Date updated;
+ protected Date created;
+ protected String tenantId;
+ protected String userId;
+ protected Image.Status status;
+ protected int progress;
+ protected int minDisk;
+ protected int minRam;
+ protected Resource server;
+ protected Map<String, String> metadata = ImmutableMap.of();
+
+ /**
+ * @see Image#getUpdated()
+ */
+ public T updated(Date updated) {
+ this.updated = updated;
+ return self();
+ }
+
+ /**
+ * @see Image#getCreated()
+ */
+ public T created(Date created) {
+ this.created = created;
+ return self();
+ }
+
+ /**
+ * @see Image#getTenantId()
+ */
+ public T tenantId(String tenantId) {
+ this.tenantId = tenantId;
+ return self();
+ }
+
+ /**
+ * @see Image#getUserId()
+ */
+ public T userId(String userId) {
+ this.userId = userId;
+ return self();
+ }
+
+ /**
+ * @see Image#getStatus()
+ */
+ public T status(Image.Status status) {
+ this.status = status;
+ return self();
+ }
+
+ /**
+ * @see Image#getProgress()
+ */
+ public T progress(int progress) {
+ this.progress = progress;
+ return self();
+ }
+
+ /**
+ * @see Image#getMinDisk()
+ */
+ public T minDisk(int minDisk) {
+ this.minDisk = minDisk;
+ return self();
+ }
+
+ /**
+ * @see Image#getMinRam()
+ */
+ public T minRam(int minRam) {
+ this.minRam = minRam;
+ return self();
+ }
+
+ /**
+ * @see Image#getServer()
+ */
+ public T server(Resource server) {
+ this.server = server;
+ return self();
+ }
+
+ /**
+ * @see Image#getMetadata()
+ */
+ public T metadata(Map<String, String> metadata) {
+ this.metadata = ImmutableMap.copyOf(checkNotNull(metadata, "metadata"));
+ return self();
+ }
+
+ public Image build() {
+ return new Image(id, name, links, updated, created, tenantId, userId, status, progress, minDisk, minRam, server, metadata);
+ }
+
+ public T fromImage(Image in) {
+ return super.fromResource(in)
+ .updated(in.getUpdated())
+ .created(in.getCreated())
+ .tenantId(in.getTenantId())
+ .userId(in.getUserId())
+ .status(in.getStatus())
+ .progress(in.getProgress())
+ .minDisk(in.getMinDisk())
+ .minRam(in.getMinRam())
+ .server(in.getServer())
+ .metadata(in.getMetadata());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ private final Date updated;
+ private final Date created;
+ @Named("tenant_id")
+ private final String tenantId;
+ @Named("user_id")
+ private final String userId;
+ private final Image.Status status;
+ private final int progress;
+ private final int minDisk;
+ private final int minRam;
+ private final Resource server;
+ private final Map<String, String> metadata;
+
+ @ConstructorProperties({
+ "id", "name", "links", "updated", "created", "tenant_id", "user_id", "status", "progress", "minDisk", "minRam", "server", "metadata"
+ })
+ protected Image(String id, @Nullable String name, java.util.Set<Link> links, @Nullable Date updated, @Nullable Date created,
+ String tenantId, @Nullable String userId, @Nullable Status status, int progress, int minDisk, int minRam,
+ @Nullable Resource server, @Nullable Map<String, String> metadata) {
+ super(id, name, links);
+ this.updated = updated;
+ this.created = created;
+ this.tenantId = tenantId;
+ this.userId = userId;
+ this.status = status;
+ this.progress = progress;
+ this.minDisk = minDisk;
+ this.minRam = minRam;
+ this.server = server;
+ this.metadata = metadata == null ? ImmutableMap.<String, String>of() : ImmutableMap.copyOf(metadata);
+ }
+
+ @Nullable
+ public Date getUpdated() {
+ return this.updated;
+ }
+
+ @Nullable
+ public Date getCreated() {
+ return this.created;
+ }
+
+ @Nullable
+ public String getTenantId() {
+ return this.tenantId;
+ }
+
+ @Nullable
+ public String getUserId() {
+ return this.userId;
+ }
+
+ @Nullable
+ public Status getStatus() {
+ return this.status;
+ }
+
+ public int getProgress() {
+ return this.progress;
+ }
+
+ public int getMinDisk() {
+ return this.minDisk;
+ }
+
+ public int getMinRam() {
+ return this.minRam;
+ }
+
+ @Nullable
+ public Resource getServer() {
+ return this.server;
+ }
+
+ public Map<String, String> getMetadata() {
+ return this.metadata;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(updated, created, tenantId, userId, status, progress, minDisk, minRam, server, metadata);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ Image that = Image.class.cast(obj);
+ return super.equals(that) && Objects.equal(this.updated, that.updated)
+ && Objects.equal(this.created, that.created)
+ && Objects.equal(this.tenantId, that.tenantId)
+ && Objects.equal(this.userId, that.userId)
+ && Objects.equal(this.status, that.status)
+ && Objects.equal(this.progress, that.progress)
+ && Objects.equal(this.minDisk, that.minDisk)
+ && Objects.equal(this.minRam, that.minRam)
+ && Objects.equal(this.server, that.server)
+ && Objects.equal(this.metadata, that.metadata);
+ }
+
+ protected ToStringHelper string() {
+ return super.string()
+ .add("updated", updated).add("created", created).add("tenantId", tenantId).add("userId", userId).add("status", status).add("progress", progress).add("minDisk", minDisk).add("minRam", minRam).add("server", server).add("metadata", metadata);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Ingress.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Ingress.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Ingress.java
new file mode 100644
index 0000000..3a9322d
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Ingress.java
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.openstack.nova.v2_0.domain;
+
+import java.beans.ConstructorProperties;
+
+import javax.inject.Named;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.net.domain.IpProtocol;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+
+/**
+ * Ingress access to a destination protocol on particular ports
+ *
+ * @author Adrian Cole
+*/
+@Beta
+public class Ingress {
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromIngress(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected IpProtocol ipProtocol;
+ protected int fromPort;
+ protected int toPort;
+
+ /**
+ * @see Ingress#getIpProtocol()
+ */
+ public T ipProtocol(IpProtocol ipProtocol) {
+ this.ipProtocol = ipProtocol;
+ return self();
+ }
+
+ /**
+ * @see Ingress#getFromPort()
+ */
+ public T fromPort(int fromPort) {
+ this.fromPort = fromPort;
+ return self();
+ }
+
+ /**
+ * @see Ingress#getToPort()
+ */
+ public T toPort(int toPort) {
+ this.toPort = toPort;
+ return self();
+ }
+
+ public Ingress build() {
+ return new Ingress(ipProtocol, fromPort, toPort);
+ }
+
+ public T fromIngress(Ingress in) {
+ return this
+ .ipProtocol(in.getIpProtocol())
+ .fromPort(in.getFromPort())
+ .toPort(in.getToPort());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ @Named("ip_protocol")
+ private final IpProtocol ipProtocol;
+ @Named("from_port")
+ private final int fromPort;
+ @Named("to_port")
+ private final int toPort;
+
+ @ConstructorProperties({
+ "ip_protocol", "from_port", "to_port"
+ })
+ protected Ingress(@Nullable IpProtocol ipProtocol, int fromPort, int toPort) {
+ this.ipProtocol = ipProtocol == null ? IpProtocol.UNRECOGNIZED : ipProtocol;
+ this.fromPort = fromPort;
+ this.toPort = toPort;
+ }
+
+ /**
+ * destination IP protocol
+ */
+ public IpProtocol getIpProtocol() {
+ return this.ipProtocol;
+ }
+
+ /**
+ * Start of destination port range for the TCP and UDP protocols, or an ICMP type number. An ICMP
+ * type number of -1 indicates a wildcard (i.e., any ICMP type number).
+ */
+ public int getFromPort() {
+ return this.fromPort;
+ }
+
+ /**
+ * End of destination port range for the TCP and UDP protocols, or an ICMP code. An ICMP code of
+ * -1 indicates a wildcard (i.e., any ICMP code).
+ */
+ public int getToPort() {
+ return this.toPort;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(ipProtocol, fromPort, toPort);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ Ingress that = Ingress.class.cast(obj);
+ return Objects.equal(this.ipProtocol, that.ipProtocol)
+ && Objects.equal(this.fromPort, that.fromPort)
+ && Objects.equal(this.toPort, that.toPort);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("ipProtocol", ipProtocol).add("fromPort", fromPort).add("toPort", toPort);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/KeyPair.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/KeyPair.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/KeyPair.java
new file mode 100644
index 0000000..aded550
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/KeyPair.java
@@ -0,0 +1,189 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.openstack.nova.v2_0.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+
+import javax.inject.Named;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+
+/**
+ * Class KeyPair
+*/
+public class KeyPair {
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromKeyPair(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected String publicKey;
+ protected String privateKey;
+ protected String userId;
+ protected String name;
+ protected String fingerprint;
+
+ /**
+ * @see KeyPair#getPublicKey()
+ */
+ public T publicKey(String publicKey) {
+ this.publicKey = publicKey;
+ return self();
+ }
+
+ /**
+ * @see KeyPair#getPrivateKey()
+ */
+ public T privateKey(String privateKey) {
+ this.privateKey = privateKey;
+ return self();
+ }
+
+ /**
+ * @see KeyPair#getUserId()
+ */
+ public T userId(String userId) {
+ this.userId = userId;
+ return self();
+ }
+
+ /**
+ * @see KeyPair#getName()
+ */
+ public T name(String name) {
+ this.name = name;
+ return self();
+ }
+
+ /**
+ * @see KeyPair#getFingerprint()
+ */
+ public T fingerprint(String fingerprint) {
+ this.fingerprint = fingerprint;
+ return self();
+ }
+
+ public KeyPair build() {
+ return new KeyPair(publicKey, privateKey, userId, name, fingerprint);
+ }
+
+ public T fromKeyPair(KeyPair in) {
+ return this
+ .publicKey(in.getPublicKey())
+ .privateKey(in.getPrivateKey())
+ .userId(in.getUserId())
+ .name(in.getName())
+ .fingerprint(in.getFingerprint());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ @Named("public_key")
+ private final String publicKey;
+ @Named("private_key")
+ private final String privateKey;
+ @Named("user_id")
+ private final String userId;
+ private final String name;
+ private final String fingerprint;
+
+ @ConstructorProperties({
+ "public_key", "private_key", "user_id", "name", "fingerprint"
+ })
+ protected KeyPair(@Nullable String publicKey, @Nullable String privateKey, @Nullable String userId, String name, @Nullable String fingerprint) {
+ this.publicKey = publicKey;
+ this.privateKey = privateKey;
+ this.userId = userId;
+ this.name = checkNotNull(name, "name");
+ this.fingerprint = fingerprint;
+ }
+
+ @Nullable
+ public String getPublicKey() {
+ return this.publicKey;
+ }
+
+ @Nullable
+ public String getPrivateKey() {
+ return this.privateKey;
+ }
+
+ @Nullable
+ public String getUserId() {
+ return this.userId;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ @Nullable
+ public String getFingerprint() {
+ return this.fingerprint;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(publicKey, privateKey, userId, name, fingerprint);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ KeyPair that = KeyPair.class.cast(obj);
+ return Objects.equal(this.publicKey, that.publicKey)
+ && Objects.equal(this.privateKey, that.privateKey)
+ && Objects.equal(this.userId, that.userId)
+ && Objects.equal(this.name, that.name)
+ && Objects.equal(this.fingerprint, that.fingerprint);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper("")
+ .omitNullValues()
+ .add("public_key", publicKey)
+ .add("private_key", privateKey)
+ .add("user_id", userId)
+ .add("name", name)
+ .add("fingerprint", fingerprint);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Network.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Network.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Network.java
new file mode 100644
index 0000000..516f6e1
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Network.java
@@ -0,0 +1,173 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.openstack.nova.v2_0.domain;
+
+import java.beans.ConstructorProperties;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+
+import static com.google.common.base.Preconditions.checkArgument;
+
+/**
+ * Nova (or Neutron) network definition
+ * Used to provide support for network, port, and fixed_ip when booting Nova servers.
+ * OpenStack will support either a Nova Network or Neutron, but not both at the same time.
+ * Specifying a port is only possible with Neutron.
+ * @author Zack Shoylev
+ */
+public class Network implements Comparable<Network> {
+ private final String networkUuid;
+ private final String portUuid;
+ private final String fixedIp;
+
+ @ConstructorProperties({
+ "networkUuid", "portUuid", "fixedIp"
+ })
+ protected Network(String networkUuid, String portUuid, String fixedIp) {
+ checkArgument(networkUuid != null || portUuid != null, "At least one of networkUuid or portUuid should be specified");
+ this.networkUuid = networkUuid;
+ this.portUuid = portUuid;
+ this.fixedIp = fixedIp;
+ }
+
+ /**
+ * @return the network uuid - Neutron or Nova
+ */
+ public String getNetworkUuid() {
+ return this.networkUuid;
+ }
+
+ /**
+ * @return the port uuid - Neutron only
+ */
+ public String getPortUuid() {
+ return this.portUuid;
+ }
+
+ /**
+ * @return the fixed IP address - Neutron or Nova
+ */
+ public String getFixedIp() {
+ return this.fixedIp;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(networkUuid, portUuid, fixedIp);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ Network that = Network.class.cast(obj);
+ return Objects.equal(this.networkUuid, that.networkUuid) &&
+ Objects.equal(this.portUuid, that.portUuid) &&
+ Objects.equal(this.fixedIp, that.fixedIp);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("networkUuid", networkUuid)
+ .add("portUuid", portUuid)
+ .add("fixedIp", fixedIp);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+ /**
+ * @return A new builder object
+ */
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ /**
+ * @return A new Builder object from another Network
+ */
+ public Builder toBuilder() {
+ return new Builder().fromNetwork(this);
+ }
+
+ /**
+ * Implements the Builder pattern for this class
+ */
+ public static class Builder {
+ protected String networkUuid;
+ protected String portUuid;
+ protected String fixedIp;
+
+ /**
+ * @param networkUuid The UUID for the Nova network or Neutron subnet to be attached.
+ * @return The builder object.
+ * @see Network#getNetworkUuid()
+ */
+ public Builder networkUuid(String networkUuid) {
+ this.networkUuid = networkUuid;
+ return this;
+ }
+
+ /**
+ * @param portUuid The port UUID for this Neutron Network.
+ * @return The builder object.
+ * @see Network#getPortUuid()
+ */
+ public Builder portUuid(String portUuid) {
+ this.portUuid = portUuid;
+ return this;
+ }
+
+ /**
+ * @param fixedIp The fixed IP address for this Network (if any).
+ * Service automatically assigns IP address if this is not provided.
+ * Fixed IP is compatible with both Nova Network and Neutron.
+ * @return The builder object.
+ * @see Network#getFixedIp()
+ */
+ public Builder fixedIp(String fixedIp) {
+ this.fixedIp = fixedIp;
+ return this;
+ }
+
+ /**
+ * @return A new Network object.
+ */
+ public Network build() {
+ return new Network(networkUuid, portUuid, fixedIp);
+ }
+
+ /**
+ * @param in The target Network
+ * @return A Builder from the provided Network
+ */
+ public Builder fromNetwork(Network in) {
+ return this
+ .networkUuid(in.getNetworkUuid())
+ .portUuid(in.getPortUuid())
+ .fixedIp(in.getFixedIp());
+ }
+ }
+
+ @Override
+ public int compareTo(Network that) {
+ return this.toString().compareTo(that.toString());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Quota.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Quota.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Quota.java
new file mode 100644
index 0000000..c16693e
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Quota.java
@@ -0,0 +1,356 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.openstack.nova.v2_0.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+
+import javax.inject.Named;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+
+/**
+ * Represents the set of limits (quotas) returned by the Quota Extension
+ *
+ * @see org.jclouds.openstack.nova.v2_0.extensions.QuotaApi
+*/
+public class Quota {
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromQuotas(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected String id;
+ protected int metadataItems;
+ protected int injectedFileContentBytes;
+ protected int volumes;
+ protected int gigabytes;
+ protected int ram;
+ protected int floatingIps;
+ protected int instances;
+ protected int injectedFiles;
+ protected int cores;
+ protected int securityGroups;
+ protected int securityGroupRules;
+ protected int keyPairs;
+
+ /**
+ * @see Quota#getId()
+ */
+ public T id(String id) {
+ this.id = id;
+ return self();
+ }
+
+ /**
+ * @see Quota#getMetadatas()
+ */
+ public T metadataItems(int metadataItems) {
+ this.metadataItems = metadataItems;
+ return self();
+ }
+
+ /**
+ * @see Quota#getInjectedFileContentBytes()
+ */
+ public T injectedFileContentBytes(int injectedFileContentBytes) {
+ this.injectedFileContentBytes = injectedFileContentBytes;
+ return self();
+ }
+
+ /**
+ * @see Quota#getVolumes()
+ */
+ public T volumes(int volumes) {
+ this.volumes = volumes;
+ return self();
+ }
+
+ /**
+ * @see Quota#getGigabytes()
+ */
+ public T gigabytes(int gigabytes) {
+ this.gigabytes = gigabytes;
+ return self();
+ }
+
+ /**
+ * @see Quota#getRam()
+ */
+ public T ram(int ram) {
+ this.ram = ram;
+ return self();
+ }
+
+ /**
+ * @see Quota#getFloatingIps()
+ */
+ public T floatingIps(int floatingIps) {
+ this.floatingIps = floatingIps;
+ return self();
+ }
+
+ /**
+ * @see Quota#getInstances()
+ */
+ public T instances(int instances) {
+ this.instances = instances;
+ return self();
+ }
+
+ /**
+ * @see Quota#getInjectedFiles()
+ */
+ public T injectedFiles(int injectedFiles) {
+ this.injectedFiles = injectedFiles;
+ return self();
+ }
+
+ /**
+ * @see Quota#getCores()
+ */
+ public T cores(int cores) {
+ this.cores = cores;
+ return self();
+ }
+
+ /**
+ * @see Quota#getSecurityGroups()
+ */
+ public T securityGroups(int securityGroups) {
+ this.securityGroups = securityGroups;
+ return self();
+ }
+
+ /**
+ * @see Quota#getSecurityGroupRules()
+ */
+ public T securityGroupRules(int securityGroupRules) {
+ this.securityGroupRules = securityGroupRules;
+ return self();
+ }
+
+ /**
+ * @see Quota#getKeyPairs()
+ */
+ public T keyPairs(int keyPairs) {
+ this.keyPairs = keyPairs;
+ return self();
+ }
+
+ public Quota build() {
+ return new Quota(id, metadataItems, injectedFileContentBytes, volumes, gigabytes, ram, floatingIps, instances, injectedFiles, cores, securityGroups, securityGroupRules, keyPairs);
+ }
+
+ public T fromQuotas(Quota in) {
+ return this
+ .id(in.getId())
+ .metadataItems(in.getMetadatas())
+ .injectedFileContentBytes(in.getInjectedFileContentBytes())
+ .volumes(in.getVolumes())
+ .gigabytes(in.getGigabytes())
+ .ram(in.getRam())
+ .floatingIps(in.getFloatingIps())
+ .instances(in.getInstances())
+ .injectedFiles(in.getInjectedFiles())
+ .cores(in.getCores())
+ .securityGroups(in.getSecurityGroups())
+ .securityGroupRules(in.getSecurityGroupRules())
+ .keyPairs(in.getKeyPairs());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ private final String id;
+ @Named("metadata_items")
+ private final int metadataItems;
+ @Named("injected_file_content_bytes")
+ private final int injectedFileContentBytes;
+ private final int volumes;
+ private final int gigabytes;
+ private final int ram;
+ @Named("floating_ips")
+ private final int floatingIps;
+ private final int instances;
+ @Named("injected_files")
+ private final int injectedFiles;
+ private final int cores;
+ @Named("security_groups")
+ private final int securityGroups;
+ @Named("security_group_rules")
+ private final int securityGroupRules;
+ @Named("key_pairs")
+ private final int keyPairs;
+
+ @ConstructorProperties({
+ "id", "metadata_items", "injected_file_content_bytes", "volumes", "gigabytes", "ram", "floating_ips", "instances", "injected_files", "cores", "security_groups", "security_group_rules", "key_pairs"
+ })
+ protected Quota(String id, int metadataItems, int injectedFileContentBytes, int volumes, int gigabytes, int ram, int floatingIps, int instances, int injectedFiles, int cores, int securityGroups, int securityGroupRules, int keyPairs) {
+ this.id = checkNotNull(id, "id");
+ this.metadataItems = metadataItems;
+ this.injectedFileContentBytes = injectedFileContentBytes;
+ this.volumes = volumes;
+ this.gigabytes = gigabytes;
+ this.ram = ram;
+ this.floatingIps = floatingIps;
+ this.instances = instances;
+ this.injectedFiles = injectedFiles;
+ this.cores = cores;
+ this.securityGroups = securityGroups;
+ this.securityGroupRules = securityGroupRules;
+ this.keyPairs = keyPairs;
+ }
+
+ /**
+ * The id of the tenant this set of limits applies to
+ */
+ public String getId() {
+ return this.id;
+ }
+
+ /**
+ * The limit of the number of metadata items for the tenant
+ */
+ public int getMetadatas() {
+ return this.metadataItems;
+ }
+
+ public int getInjectedFileContentBytes() {
+ return this.injectedFileContentBytes;
+ }
+
+ /**
+ * The limit of the number of volumes that can be created for the tenant
+ */
+ public int getVolumes() {
+ return this.volumes;
+ }
+
+ /**
+ * The limit of the total size of all volumes for the tenant
+ */
+ public int getGigabytes() {
+ return this.gigabytes;
+ }
+
+ /**
+ * The limit of total ram available to the tenant
+ */
+ public int getRam() {
+ return this.ram;
+ }
+
+ /**
+ * The limit of the number of floating ips for the tenant
+ */
+ public int getFloatingIps() {
+ return this.floatingIps;
+ }
+
+ /**
+ * The limit of the number of instances that can be created for the tenant
+ */
+ public int getInstances() {
+ return this.instances;
+ }
+
+ public int getInjectedFiles() {
+ return this.injectedFiles;
+ }
+
+ /**
+ * The limit of the number of cores that can be used by the tenant
+ */
+ public int getCores() {
+ return this.cores;
+ }
+
+ /**
+ * @return the limit of the number of security groups that can be created for the tenant
+ * @see org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupApi
+ */
+ public int getSecurityGroups() {
+ return this.securityGroups;
+ }
+
+ /**
+ * @return the limit of the number of security group rules that can be created for the tenant
+ * @see org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupApi
+ */
+ public int getSecurityGroupRules() {
+ return this.securityGroupRules;
+ }
+
+ /**
+ * @return the limit of the number of key pairs that can be created for the tenant
+ * @see org.jclouds.openstack.nova.v2_0.extensions.KeyPairApi
+ */
+ public int getKeyPairs() {
+ return this.keyPairs;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(id, metadataItems, injectedFileContentBytes, volumes, gigabytes, ram, floatingIps, instances, injectedFiles, cores, securityGroups, securityGroupRules, keyPairs);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ Quota that = Quota.class.cast(obj);
+ return Objects.equal(this.id, that.id)
+ && Objects.equal(this.metadataItems, that.metadataItems)
+ && Objects.equal(this.injectedFileContentBytes, that.injectedFileContentBytes)
+ && Objects.equal(this.volumes, that.volumes)
+ && Objects.equal(this.gigabytes, that.gigabytes)
+ && Objects.equal(this.ram, that.ram)
+ && Objects.equal(this.floatingIps, that.floatingIps)
+ && Objects.equal(this.instances, that.instances)
+ && Objects.equal(this.injectedFiles, that.injectedFiles)
+ && Objects.equal(this.cores, that.cores)
+ && Objects.equal(this.securityGroups, that.securityGroups)
+ && Objects.equal(this.securityGroupRules, that.securityGroupRules)
+ && Objects.equal(this.keyPairs, that.keyPairs);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("id", id).add("metadataItems", metadataItems).add("injectedFileContentBytes", injectedFileContentBytes).add("volumes", volumes).add("gigabytes", gigabytes).add("ram", ram).add("floatingIps", floatingIps).add("instances", instances).add("injectedFiles", injectedFiles).add("cores", cores).add("securityGroups", securityGroups).add("securityGroupRules", securityGroupRules).add("keyPairs", keyPairs);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/QuotaClass.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/QuotaClass.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/QuotaClass.java
new file mode 100644
index 0000000..27199ef
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/QuotaClass.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.openstack.nova.v2_0.domain;
+
+import java.beans.ConstructorProperties;
+
+/**
+ * Represents the set of limits (quota class) returned by the Quota Class Extension
+ *
+ * @see org.jclouds.openstack.nova.v2_0.extensions.QuotaClassApi
+*/
+public class QuotaClass extends Quota {
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromQuotaClass(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> extends Quota.Builder<T> {
+
+ public QuotaClass build() {
+ return new QuotaClass(id, metadataItems, injectedFileContentBytes, volumes, gigabytes, ram, floatingIps, instances, injectedFiles, cores, securityGroups, securityGroupRules, keyPairs);
+ }
+
+ public T fromQuotaClass(QuotaClass in) {
+ return super.fromQuotas(in);
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+
+ @ConstructorProperties({
+ "id", "metadata_items", "injected_file_content_bytes", "volumes", "gigabytes", "ram", "floating_ips", "instances", "injected_files", "cores", "security_groups", "security_group_rules", "key_pairs"
+ })
+ protected QuotaClass(String id, int metadataItems, int injectedFileContentBytes, int volumes, int gigabytes, int ram, int floatingIps, int instances, int injectedFiles, int cores, int securityGroups, int securityGroupRules, int keyPairs) {
+ super(id, metadataItems, injectedFileContentBytes, volumes, gigabytes, ram, floatingIps, instances, injectedFiles, cores, securityGroups, securityGroupRules, keyPairs);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/RebootType.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/RebootType.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/RebootType.java
new file mode 100644
index 0000000..453dd77
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/RebootType.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.openstack.nova.v2_0.domain;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+public enum RebootType {
+
+ HARD, SOFT;
+
+ public String value() {
+ return name();
+ }
+
+ public static RebootType fromValue(String v) {
+ return valueOf(v);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SecurityGroup.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SecurityGroup.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SecurityGroup.java
new file mode 100644
index 0000000..a0e2085
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SecurityGroup.java
@@ -0,0 +1,188 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.openstack.nova.v2_0.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+import java.util.Set;
+
+import javax.inject.Named;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Defines a security group
+*/
+public class SecurityGroup {
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromSecurityGroup(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected String id;
+ protected String tenantId;
+ protected String name;
+ protected String description;
+ protected Set<SecurityGroupRule> rules = ImmutableSet.of();
+
+ /**
+ * @see SecurityGroup#getId()
+ */
+ public T id(String id) {
+ this.id = id;
+ return self();
+ }
+
+ /**
+ * @see SecurityGroup#getTenantId()
+ */
+ public T tenantId(String tenantId) {
+ this.tenantId = tenantId;
+ return self();
+ }
+
+ /**
+ * @see SecurityGroup#getName()
+ */
+ public T name(String name) {
+ this.name = name;
+ return self();
+ }
+
+ /**
+ * @see SecurityGroup#getDescription()
+ */
+ public T description(String description) {
+ this.description = description;
+ return self();
+ }
+
+ /**
+ * @see SecurityGroup#getRules()
+ */
+ public T rules(Set<SecurityGroupRule> rules) {
+ this.rules = ImmutableSet.copyOf(checkNotNull(rules, "rules"));
+ return self();
+ }
+
+ public T rules(SecurityGroupRule... in) {
+ return rules(ImmutableSet.copyOf(in));
+ }
+
+ public SecurityGroup build() {
+ return new SecurityGroup(id, tenantId, name, description, rules);
+ }
+
+ public T fromSecurityGroup(SecurityGroup in) {
+ return this
+ .id(in.getId())
+ .tenantId(in.getTenantId())
+ .name(in.getName())
+ .description(in.getDescription())
+ .rules(in.getRules());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ private final String id;
+ @Named("tenant_id")
+ private final String tenantId;
+ private final String name;
+ private final String description;
+ private final Set<SecurityGroupRule> rules;
+
+ @ConstructorProperties({
+ "id", "tenant_id", "name", "description", "rules"
+ })
+ protected SecurityGroup(String id, @Nullable String tenantId, @Nullable String name, @Nullable String description, Set<SecurityGroupRule> rules) {
+ this.id = checkNotNull(id, "id");
+ this.tenantId = tenantId;
+ this.name = name;
+ this.description = description;
+ // if empty, leave null so this doesn't serialize to json
+ this.rules = checkNotNull(rules, "rules").size() == 0 ? null : ImmutableSet.copyOf(rules);
+ }
+
+ public String getId() {
+ return this.id;
+ }
+
+ @Nullable
+ public String getTenantId() {
+ return this.tenantId;
+ }
+
+ @Nullable
+ public String getName() {
+ return this.name;
+ }
+
+ @Nullable
+ public String getDescription() {
+ return this.description;
+ }
+
+ public Set<SecurityGroupRule> getRules() {
+ return this.rules;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(id, tenantId, name, description, rules);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ SecurityGroup that = SecurityGroup.class.cast(obj);
+ return Objects.equal(this.id, that.id)
+ && Objects.equal(this.tenantId, that.tenantId)
+ && Objects.equal(this.name, that.name)
+ && Objects.equal(this.description, that.description)
+ && Objects.equal(this.rules, that.rules);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("id", id).add("tenantId", tenantId).add("name", name).add("description", description).add("rules", rules);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SecurityGroupRule.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SecurityGroupRule.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SecurityGroupRule.java
new file mode 100644
index 0000000..92d58f7
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SecurityGroupRule.java
@@ -0,0 +1,174 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.openstack.nova.v2_0.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+
+import javax.inject.Named;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.net.domain.IpProtocol;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.collect.ForwardingObject;
+
+/**
+ * Defines a security group rule
+ */
+public class SecurityGroupRule extends Ingress {
+
+ public static class Cidr extends ForwardingObject {
+ private String cidr;
+
+ @ConstructorProperties("cidr")
+ protected Cidr(String cidr) {
+ this.cidr = checkNotNull(cidr);
+ }
+
+ @Override
+ protected Object delegate() {
+ return cidr;
+ }
+ }
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromSecurityGroupRule(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> extends Ingress.Builder<T> {
+ protected String id;
+ protected TenantIdAndName group;
+ protected String parentGroupId;
+ protected String ipRange;
+
+ /**
+ * @see SecurityGroupRule#getId()
+ */
+ public T id(String id) {
+ this.id = id;
+ return self();
+ }
+
+ /**
+ * @see SecurityGroupRule#getGroup()
+ */
+ public T group(TenantIdAndName group) {
+ this.group = group;
+ return self();
+ }
+
+ /**
+ * @see SecurityGroupRule#getParentGroupId()
+ */
+ public T parentGroupId(String parentGroupId) {
+ this.parentGroupId = parentGroupId;
+ return self();
+ }
+
+ /**
+ * @see SecurityGroupRule#getIpRange()
+ */
+ public T ipRange(String ipRange) {
+ this.ipRange = ipRange;
+ return self();
+ }
+
+ public SecurityGroupRule build() {
+ return new SecurityGroupRule(ipProtocol, fromPort, toPort, id, group, parentGroupId, ipRange == null ? null : new Cidr(ipRange));
+ }
+
+ public T fromSecurityGroupRule(SecurityGroupRule in) {
+ return super.fromIngress(in)
+ .id(in.getId())
+ .group(in.getGroup())
+ .parentGroupId(in.getParentGroupId())
+ .ipRange(in.getIpRange());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ private final String id;
+ private final TenantIdAndName group;
+ @Named("parent_group_id")
+ private final String parentGroupId;
+ @Named("ip_range")
+ private final SecurityGroupRule.Cidr ipRange;
+
+ @ConstructorProperties({
+ "ip_protocol", "from_port", "to_port", "id", "group", "parent_group_id", "ip_range"
+ })
+ protected SecurityGroupRule(IpProtocol ipProtocol, int fromPort, int toPort, String id, @Nullable TenantIdAndName group, String parentGroupId, @Nullable Cidr ipRange) {
+ super(ipProtocol, fromPort, toPort);
+ this.id = checkNotNull(id, "id");
+ this.group = group;
+ this.parentGroupId = checkNotNull(parentGroupId, "parentGroupId");
+ this.ipRange = ipRange;
+ }
+
+ public String getId() {
+ return this.id;
+ }
+
+ @Nullable
+ public TenantIdAndName getGroup() {
+ return this.group;
+ }
+
+ public String getParentGroupId() {
+ return this.parentGroupId;
+ }
+
+ @Nullable
+ public String getIpRange() {
+ return ipRange == null ? null : ipRange.cidr;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(id, group, parentGroupId, ipRange);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ SecurityGroupRule that = SecurityGroupRule.class.cast(obj);
+ return super.equals(that) && Objects.equal(this.id, that.id)
+ && Objects.equal(this.group, that.group)
+ && Objects.equal(this.parentGroupId, that.parentGroupId)
+ && Objects.equal(this.ipRange, that.ipRange);
+ }
+
+ protected ToStringHelper string() {
+ return super.string()
+ .add("id", id).add("group", group).add("parentGroupId", parentGroupId).add("ipRange", ipRange);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Server.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Server.java b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Server.java
new file mode 100644
index 0000000..a7b316a
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Server.java
@@ -0,0 +1,476 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.openstack.nova.v2_0.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+import java.util.Date;
+import java.util.Map;
+
+import javax.inject.Named;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.openstack.v2_0.domain.Link;
+import org.jclouds.openstack.v2_0.domain.Resource;
+
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.base.Optional;
+import com.google.common.base.Strings;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableMultimap;
+import com.google.common.collect.Multimap;
+
+/**
+ * A server is a virtual machine instance in the compute system. Flavor and image are requisite
+ * elements when creating a server.
+ *
+ * @author Adrian Cole
+ * @see <a href=
+ * "http://docs.openstack.org/api/openstack-compute/1.1/content/Get_Server_Details-d1e2623.html"
+ * />
+ */
+public class Server extends Resource {
+ public static final String DISK_CONFIG_MANUAL = "MANUAL";
+ public static final String DISK_CONFIG_AUTO = "AUTO";
+
+ /**
+ * Servers contain a status attribute that can be used as an indication of the current server
+ * state. Servers with an ACTIVE status are available for use.
+ * <p/>
+ * Other possible values for the status attribute include: BUILD, REBUILD, SUSPENDED, RESIZE,
+ * VERIFY_RESIZE, REVERT_RESIZE, PASSWORD, REBOOT, HARD_REBOOT, DELETED, UNKNOWN, and ERROR.
+ *
+ * @author Adrian Cole
+ */
+ public static enum Status {
+
+ ACTIVE, BUILD, REBUILD, SUSPENDED, PAUSED, RESIZE, VERIFY_RESIZE, REVERT_RESIZE, PASSWORD, REBOOT, HARD_REBOOT, DELETED, UNKNOWN, ERROR, STOPPED, UNRECOGNIZED;
+
+ public String value() {
+ return name();
+ }
+
+ public static Status fromValue(String v) {
+ try {
+ return valueOf(v.replaceAll("\\(.*", ""));
+ } catch (IllegalArgumentException e) {
+ return UNRECOGNIZED;
+ }
+ }
+ }
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromServer(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> extends Resource.Builder<T> {
+ protected String uuid;
+ protected String tenantId;
+ protected String userId;
+ protected Date updated;
+ protected Date created;
+ protected String hostId;
+ protected String accessIPv4;
+ protected String accessIPv6;
+ protected Server.Status status;
+ protected Resource image;
+ protected Resource flavor;
+ protected String keyName;
+ protected String configDrive;
+ protected Multimap<String, Address> addresses = ImmutableMultimap.of();
+ protected Map<String, String> metadata = ImmutableMap.of();
+ protected ServerExtendedStatus extendedStatus;
+ protected ServerExtendedAttributes extendedAttributes;
+ protected String diskConfig;
+
+ /**
+ * @see Server#getUuid()
+ */
+ public T uuid(String uuid) {
+ this.uuid = uuid;
+ return self();
+ }
+
+ /**
+ * @see Server#getTenantId()
+ */
+ public T tenantId(String tenantId) {
+ this.tenantId = tenantId;
+ return self();
+ }
+
+ /**
+ * @see Server#getUserId()
+ */
+ public T userId(String userId) {
+ this.userId = userId;
+ return self();
+ }
+
+ /**
+ * @see Server#getUpdated()
+ */
+ public T updated(Date updated) {
+ this.updated = updated;
+ return self();
+ }
+
+ /**
+ * @see Server#getCreated()
+ */
+ public T created(Date created) {
+ this.created = created;
+ return self();
+ }
+
+ /**
+ * @see Server#getHostId()
+ */
+ public T hostId(String hostId) {
+ this.hostId = hostId;
+ return self();
+ }
+
+ /**
+ * @see Server#getAccessIPv4()
+ */
+ public T accessIPv4(String accessIPv4) {
+ this.accessIPv4 = accessIPv4;
+ return self();
+ }
+
+ /**
+ * @see Server#getAccessIPv6()
+ */
+ public T accessIPv6(String accessIPv6) {
+ this.accessIPv6 = accessIPv6;
+ return self();
+ }
+
+ /**
+ * @see Server#getStatus()
+ */
+ public T status(Server.Status status) {
+ this.status = status;
+ return self();
+ }
+
+ /**
+ * @see Server#getImage()
+ */
+ public T image(Resource image) {
+ this.image = image;
+ return self();
+ }
+
+ /**
+ * @see Server#getFlavor()
+ */
+ public T flavor(Resource flavor) {
+ this.flavor = flavor;
+ return self();
+ }
+
+ /**
+ * @see Server#getKeyName()
+ */
+ public T keyName(String keyName) {
+ this.keyName = keyName;
+ return self();
+ }
+
+ /**
+ * @see Server#getConfigDrive()
+ */
+ public T configDrive(String configDrive) {
+ this.configDrive = configDrive;
+ return self();
+ }
+
+ /**
+ * @see Server#getAddresses()
+ */
+ public T addresses(Multimap<String, Address> addresses) {
+ this.addresses = addresses;
+ return self();
+ }
+
+ /**
+ * @see Server#getMetadata()
+ */
+ public T metadata(Map<String, String> metadata) {
+ this.metadata = ImmutableMap.copyOf(checkNotNull(metadata, "metadata"));
+ return self();
+ }
+
+ /**
+ * @see Server#getExtendedStatus()
+ */
+ public T extendedStatus(ServerExtendedStatus extendedStatus) {
+ this.extendedStatus = extendedStatus;
+ return self();
+ }
+
+ /**
+ * @see Server#getExtendedAttributes()
+ */
+ public T extendedAttributes(ServerExtendedAttributes extendedAttributes) {
+ this.extendedAttributes = extendedAttributes;
+ return self();
+ }
+
+ /**
+ * @see Server#getDiskConfig()
+ */
+ public T diskConfig(String diskConfig) {
+ this.diskConfig = diskConfig;
+ return self();
+ }
+
+ public Server build() {
+ return new Server(id, name, links, uuid, tenantId, userId, updated, created, hostId, accessIPv4, accessIPv6,
+ status, image, flavor, keyName, configDrive, addresses, metadata, extendedStatus,
+ extendedAttributes, diskConfig);
+ }
+
+ public T fromServer(Server in) {
+ return super.fromResource(in)
+ .uuid(in.getUuid())
+ .tenantId(in.getTenantId())
+ .userId(in.getUserId())
+ .updated(in.getUpdated())
+ .created(in.getCreated())
+ .hostId(in.getHostId())
+ .accessIPv4(in.getAccessIPv4())
+ .accessIPv6(in.getAccessIPv6())
+ .status(in.getStatus())
+ .image(in.getImage())
+ .flavor(in.getFlavor())
+ .keyName(in.getKeyName())
+ .configDrive(in.getConfigDrive())
+ .addresses(in.getAddresses())
+ .metadata(in.getMetadata())
+ .extendedStatus(in.getExtendedStatus().orNull())
+ .extendedAttributes(in.getExtendedAttributes().orNull())
+ .diskConfig(in.getDiskConfig().orNull());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ private final String uuid;
+ @Named("tenant_id")
+ private final String tenantId;
+ @Named("user_id")
+ private final String userId;
+ private final Date updated;
+ private final Date created;
+ private final String hostId;
+ private final String accessIPv4;
+ private final String accessIPv6;
+ private final Server.Status status;
+ private final Resource image;
+ private final Resource flavor;
+ @Named("key_name")
+ private final String keyName;
+ @Named("config_drive")
+ private final String configDrive;
+ private final Multimap<String, Address> addresses;
+ private final Map<String, String> metadata;
+ private final Optional<ServerExtendedStatus> extendedStatus;
+ private final Optional<ServerExtendedAttributes> extendedAttributes;
+ @Named("OS-DCF:diskConfig")
+ private final Optional<String> diskConfig;
+
+ @ConstructorProperties({
+ "id", "name", "links", "uuid", "tenant_id", "user_id", "updated", "created", "hostId", "accessIPv4", "accessIPv6", "status", "image", "flavor", "key_name", "config_drive", "addresses", "metadata", "extendedStatus", "extendedAttributes", "OS-DCF:diskConfig"
+ })
+ protected Server(String id, @Nullable String name, java.util.Set<Link> links, @Nullable String uuid, String tenantId,
+ String userId, @Nullable Date updated, Date created, @Nullable String hostId, @Nullable String accessIPv4,
+ @Nullable String accessIPv6, Server.Status status, Resource image, Resource flavor, @Nullable String keyName,
+ @Nullable String configDrive, Multimap<String, Address> addresses, Map<String, String> metadata,
+ @Nullable ServerExtendedStatus extendedStatus, @Nullable ServerExtendedAttributes extendedAttributes,
+ @Nullable String diskConfig) {
+ super(id, name, links);
+ this.uuid = uuid;
+ this.tenantId = checkNotNull(tenantId, "tenantId");
+ this.userId = checkNotNull(userId, "userId");
+ this.updated = updated;
+ this.created = checkNotNull(created, "created");
+ this.hostId = Strings.emptyToNull(hostId);
+ this.accessIPv4 = Strings.emptyToNull(accessIPv4);
+ this.accessIPv6 = Strings.emptyToNull(accessIPv6);
+ this.status = checkNotNull(status, "status");
+ this.image = checkNotNull(image, "image");
+ this.flavor = checkNotNull(flavor, "flavor");
+ this.keyName = Strings.emptyToNull(keyName);
+ this.configDrive = Strings.emptyToNull(configDrive);
+ this.addresses = ImmutableMultimap.copyOf(checkNotNull(addresses, "addresses"));
+ this.metadata = ImmutableMap.copyOf(checkNotNull(metadata, "metadata"));
+ this.extendedStatus = Optional.fromNullable(extendedStatus);
+ this.extendedAttributes = Optional.fromNullable(extendedAttributes);
+ this.diskConfig = Optional.fromNullable(diskConfig);
+ }
+
+ /**
+ * only present until the id is in uuid form
+ *
+ * @return uuid, if id is an integer val
+ */
+ @Nullable
+ public String getUuid() {
+ return this.uuid;
+ }
+
+ public String getTenantId() {
+ return this.tenantId;
+ }
+
+ public String getUserId() {
+ return this.userId;
+ }
+
+ @Nullable
+ public Date getUpdated() {
+ return this.updated;
+ }
+
+ public Date getCreated() {
+ return this.created;
+ }
+
+ /**
+ * @return host identifier, or null if in {@link Status#BUILD}
+ */
+ @Nullable
+ public String getHostId() {
+ return this.hostId;
+ }
+
+ @Nullable
+ public String getAccessIPv4() {
+ return this.accessIPv4;
+ }
+
+ @Nullable
+ public String getAccessIPv6() {
+ return this.accessIPv6;
+ }
+
+ public Status getStatus() {
+ return this.status;
+ }
+
+ @Nullable
+ public String getConfigDrive() {
+ return this.configDrive;
+ }
+
+ public Resource getImage() {
+ return this.image;
+ }
+
+ public Resource getFlavor() {
+ return this.flavor;
+ }
+
+ public Map<String, String> getMetadata() {
+ return metadata;
+ }
+
+ /**
+ * @return the ip addresses assigned to the server
+ */
+ public Multimap<String, Address> getAddresses() {
+ return addresses;
+ }
+
+ /**
+ * @return keyName if extension is present and there is a value for this server
+ * @see KeyPairApi
+ */
+ @Nullable
+ public String getKeyName() {
+ return keyName;
+ }
+
+ /**
+ * Retrieves the extended server status fields (alias "OS-EXT-STS")
+ * <p/>
+ * NOTE: This field is only present if the Extended Status extension is installed.
+ *
+ * @see org.jclouds.openstack.nova.v2_0.features.ExtensionApi#getExtensionByAlias
+ * @see org.jclouds.openstack.nova.v2_0.extensions.ExtensionNamespaces#EXTENDED_STATUS
+ */
+ public Optional<ServerExtendedStatus> getExtendedStatus() {
+ return this.extendedStatus;
+ }
+
+ /**
+ * Retrieves the extended server attributes fields (alias "OS-EXT-SRV-ATTR")
+ * <p/>
+ * NOTE: This field is only present if the The Extended Server Attributes API extension is installed.
+ *
+ * @see org.jclouds.openstack.nova.v2_0.features.ExtensionApi#getExtensionByAlias
+ * @see org.jclouds.openstack.nova.v2_0.extensions.ExtensionNamespaces#EXTENDED_STATUS
+ */
+ public Optional<ServerExtendedAttributes> getExtendedAttributes() {
+ return this.extendedAttributes;
+ }
+
+ /**
+ * Disk config attribute from the Disk Config Extension (alias "OS-DCF").
+ * One of {@link Server#DISK_CONFIG_AUTO} or {@link Server#DISK_CONFIG_MANUAL}.
+ * This field is only present if the Disk Config extension is installed.
+ * <p/>
+ * NOTE: Typically a field like this would be implemented as an enum but this field was
+ * originally implmented as a String and {@link Server#DISK_CONFIG_AUTO} and
+ * {@link Server#DISK_CONFIG_MANUAL} were added later as Strings to preserve backwards
+ * compatibility.
+ *
+ * @see org.jclouds.openstack.nova.v2_0.features.ExtensionApi#getExtensionByAlias
+ * @see org.jclouds.openstack.nova.v2_0.extensions.ExtensionNamespaces#DISK_CONFIG
+ * @see CreateServerOptions#getDiskConfig()
+ */
+ public Optional<String> getDiskConfig() {
+ return this.diskConfig;
+ }
+
+
+ // hashCode/equals from super is ok
+
+ @Override
+ protected ToStringHelper string() {
+ return super.string()
+ .add("uuid", uuid).add("tenantId", tenantId).add("userId", userId).add("updated", updated).add("created", created)
+ .add("hostId", hostId).add("accessIPv4", accessIPv4).add("accessIPv6", accessIPv6).add("status", status).add("image", image)
+ .add("flavor", flavor).add("keyName", keyName).add("configDrive", configDrive).add("addresses", addresses)
+ .add("metadata", metadata).add("extendedStatus", extendedStatus).add("extendedAttributes", extendedAttributes)
+ .add("diskConfig", diskConfig);
+ }
+
+}