You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ni...@apache.org on 2014/03/18 04:00:08 UTC
[16/21] fixing https://issues.apache.org/jira/browse/STRATOS-520 -
adding Openstack-nova module to dependencies
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/d4243b7e/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Server.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Server.java b/dependencies/jclouds/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/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);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/d4243b7e/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerCreated.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerCreated.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerCreated.java
new file mode 100644
index 0000000..dcaf6fc
--- /dev/null
+++ b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerCreated.java
@@ -0,0 +1,127 @@
+/*
+ * 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 java.util.Set;
+
+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.base.Optional;
+
+/**
+ * Server Resource with administrative password returned by ServerApi#CreateServer calls
+ *
+ * @author Adam Lowe
+ * @see <a href=
+ "http://docs.openstack.org/api/openstack-compute/1.1/content/Get_Server_Details-d1e2623.html"
+ />
+*/
+public class ServerCreated extends Resource {
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public Builder toBuilder() {
+ return builder().fromServerCreated(this);
+ }
+
+ public static final class Builder extends Resource.Builder<Builder> {
+ protected String adminPass;
+ protected String diskConfig;
+
+ /**
+ * @see ServerCreated#getAdminPass()
+ */
+ public Builder adminPass(String adminPass) {
+ this.adminPass = adminPass;
+ return self();
+ }
+
+ /**
+ * @see ServerCreated#getDiskConfig()
+ */
+ public Builder diskConfig(String diskConfig) {
+ this.diskConfig = diskConfig;
+ return self();
+ }
+
+ public ServerCreated build() {
+ return new ServerCreated(id, name, links, adminPass, diskConfig);
+ }
+
+ public Builder fromServerCreated(ServerCreated in) {
+ return super.fromResource(in).adminPass(in.getAdminPass().orNull()).diskConfig(in.getDiskConfig().orNull());
+ }
+
+ @Override
+ protected Builder self() {
+ return this;
+ }
+ }
+
+ private final Optional<String> adminPass;
+ private final Optional<String> diskConfig;
+
+ @ConstructorProperties({
+ "id", "name", "links", "adminPass", "OS-DCF:diskConfig"
+ })
+ protected ServerCreated(String id, @Nullable String name, Set<Link> links, @Nullable String adminPass,
+ @Nullable String diskConfig) {
+ super(id, name, links);
+ this.adminPass = Optional.fromNullable(adminPass);
+ this.diskConfig = Optional.fromNullable(diskConfig);
+ }
+
+ /**
+ * present unless the nova install was configured with the option {@code enable_instance_password=false}
+ */
+ public Optional<String> getAdminPass() {
+ return this.adminPass;
+ }
+
+ /**
+ * @see CreateServerOptions#getDiskConfig()
+ */
+ public Optional<String> getDiskConfig() {
+ return this.diskConfig;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(adminPass, diskConfig);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ ServerCreated that = ServerCreated.class.cast(obj);
+ return super.equals(that) && Objects.equal(this.adminPass, that.adminPass)
+ && Objects.equal(this.diskConfig, that.diskConfig);
+ }
+
+ @Override
+ protected ToStringHelper string() {
+ return super.string().add("adminPass", adminPass.orNull()).add("diskConfig", diskConfig.orNull());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/d4243b7e/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerExtendedAttributes.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerExtendedAttributes.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerExtendedAttributes.java
new file mode 100644
index 0000000..1390660
--- /dev/null
+++ b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerExtendedAttributes.java
@@ -0,0 +1,156 @@
+/*
+ * 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 com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+
+/**
+ * Additional attributes delivered by Extended Server Attributes extension (alias "OS-EXT-SRV-ATTR")
+ *
+ * @author Adam Lowe
+ * @see <a href=
+ "http://nova.openstack.org/api/nova.api.openstack.compute.contrib.extended_server_attributes.html"
+ />
+ * @see org.jclouds.openstack.nova.v2_0.features.ExtensionApi#getExtensionByAlias
+ * @see org.jclouds.openstack.nova.v2_0.extensions.ExtensionNamespaces#EXTENDED_STATUS
+*/
+public class ServerExtendedAttributes {
+
+ public static String PREFIX;
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromServerExtendedAttributes(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected String instanceName;
+ protected String hostName;
+ protected String hypervisorHostName;
+
+ /**
+ * @see ServerExtendedAttributes#getInstanceName()
+ */
+ public T instanceName(String instanceName) {
+ this.instanceName = instanceName;
+ return self();
+ }
+
+ /**
+ * @see ServerExtendedAttributes#getHostName()
+ */
+ public T hostName(String hostName) {
+ this.hostName = hostName;
+ return self();
+ }
+
+ /**
+ * @see ServerExtendedAttributes#getHypervisorHostName()
+ */
+ public T hypervisorHostName(String hypervisorHostName) {
+ this.hypervisorHostName = hypervisorHostName;
+ return self();
+ }
+
+ public ServerExtendedAttributes build() {
+ return new ServerExtendedAttributes(instanceName, hostName, hypervisorHostName);
+ }
+
+ public T fromServerExtendedAttributes(ServerExtendedAttributes in) {
+ return this
+ .instanceName(in.getInstanceName())
+ .hostName(in.getHostName())
+ .hypervisorHostName(in.getHypervisorHostName());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ @Named("OS-EXT-SRV-ATTR:instance_name")
+ private final String instanceName;
+ @Named("OS-EXT-SRV-ATTR:host")
+ private final String hostName;
+ @Named("OS-EXT-SRV-ATTR:hypervisor_hostname")
+ private final String hypervisorHostName;
+
+ @ConstructorProperties({
+ "OS-EXT-SRV-ATTR:instance_name", "OS-EXT-SRV-ATTR:host", "OS-EXT-SRV-ATTR:hypervisor_hostname"
+ })
+ protected ServerExtendedAttributes(@Nullable String instanceName, @Nullable String hostName, @Nullable String hypervisorHostName) {
+ this.instanceName = instanceName;
+ this.hostName = hostName;
+ this.hypervisorHostName = hypervisorHostName;
+ }
+
+ @Nullable
+ public String getInstanceName() {
+ return this.instanceName;
+ }
+
+ @Nullable
+ public String getHostName() {
+ return this.hostName;
+ }
+
+ @Nullable
+ public String getHypervisorHostName() {
+ return this.hypervisorHostName;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(instanceName, hostName, hypervisorHostName);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ ServerExtendedAttributes that = ServerExtendedAttributes.class.cast(obj);
+ return Objects.equal(this.instanceName, that.instanceName)
+ && Objects.equal(this.hostName, that.hostName)
+ && Objects.equal(this.hypervisorHostName, that.hypervisorHostName);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("instanceName", instanceName).add("hostName", hostName).add("hypervisorHostName", hypervisorHostName);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/d4243b7e/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerExtendedStatus.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerExtendedStatus.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerExtendedStatus.java
new file mode 100644
index 0000000..33dcb75
--- /dev/null
+++ b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerExtendedStatus.java
@@ -0,0 +1,155 @@
+/*
+ * 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 com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+
+/**
+ * Additional attributes delivered by Extended Server Status extension (alias "OS-EXT-STS")
+ *
+ * @author Adam Lowe
+ * @see <a href=
+ "http://nova.openstack.org/api/nova.api.openstack.compute.contrib.extended_status.html"
+ />
+ * @see org.jclouds.openstack.nova.v2_0.features.ExtensionApi#getExtensionByAlias
+ * @see org.jclouds.openstack.nova.v1_1.extensions.ExtensionNamespaces#EXTENDED_STATUS (extended status?)
+*/
+public class ServerExtendedStatus {
+
+ public static String PREFIX;
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromServerExtendedStatus(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected String taskState;
+ protected String vmState;
+ protected int powerState;
+
+ /**
+ * @see ServerExtendedStatus#getTaskState()
+ */
+ public T taskState(String taskState) {
+ this.taskState = taskState;
+ return self();
+ }
+
+ /**
+ * @see ServerExtendedStatus#getVmState()
+ */
+ public T vmState(String vmState) {
+ this.vmState = vmState;
+ return self();
+ }
+
+ /**
+ * @see ServerExtendedStatus#getPowerState()
+ */
+ public T powerState(int powerState) {
+ this.powerState = powerState;
+ return self();
+ }
+
+ public ServerExtendedStatus build() {
+ return new ServerExtendedStatus(taskState, vmState, powerState);
+ }
+
+ public T fromServerExtendedStatus(ServerExtendedStatus in) {
+ return this
+ .taskState(in.getTaskState())
+ .vmState(in.getVmState())
+ .powerState(in.getPowerState());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ @Named("OS-EXT-STS:task_state")
+ private final String taskState;
+ @Named("OS-EXT-STS:vm_state")
+ private final String vmState;
+ @Named("OS-EXT-STS:power_state")
+ private final int powerState;
+
+ @ConstructorProperties({
+ "OS-EXT-STS:task_state", "OS-EXT-STS:vm_state", "OS-EXT-STS:power_state"
+ })
+ protected ServerExtendedStatus(@Nullable String taskState, @Nullable String vmState, int powerState) {
+ this.taskState = taskState;
+ this.vmState = vmState;
+ this.powerState = powerState;
+ }
+
+ @Nullable
+ public String getTaskState() {
+ return this.taskState;
+ }
+
+ @Nullable
+ public String getVmState() {
+ return this.vmState;
+ }
+
+ public int getPowerState() {
+ return this.powerState;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(taskState, vmState, powerState);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ ServerExtendedStatus that = ServerExtendedStatus.class.cast(obj);
+ return Objects.equal(this.taskState, that.taskState)
+ && Objects.equal(this.vmState, that.vmState)
+ && Objects.equal(this.powerState, that.powerState);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("taskState", taskState).add("vmState", vmState).add("powerState", powerState);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/d4243b7e/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerWithSecurityGroups.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerWithSecurityGroups.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerWithSecurityGroups.java
new file mode 100644
index 0000000..3d7a9b9
--- /dev/null
+++ b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerWithSecurityGroups.java
@@ -0,0 +1,128 @@
+/*
+ * 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 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.ImmutableSet;
+import com.google.common.collect.Multimap;
+
+/**
+ * Extended server returned by ServerWithSecurityGroupsApi
+ *
+ * @author Adam Lowe
+ * @see <a href=
+"http://docs.openstack.org/api/openstack-compute/1.1/content/Get_Server_Details-d1e2623.html"
+/>
+*/
+public class ServerWithSecurityGroups extends Server {
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromServerWithSecurityGroups(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> extends Server.Builder<T> {
+ protected Set<String> securityGroupNames = ImmutableSet.of();
+
+ /**
+ * @see ServerWithSecurityGroups#getSecurityGroupNames()
+ */
+ public T securityGroupNames(Set<String> securityGroupNames) {
+ this.securityGroupNames = ImmutableSet.copyOf(checkNotNull(securityGroupNames, "securityGroupNames"));
+ return self();
+ }
+
+ public T securityGroupNames(String... in) {
+ return securityGroupNames(ImmutableSet.copyOf(in));
+ }
+
+ public ServerWithSecurityGroups build() {
+ return new ServerWithSecurityGroups(id, name, links, uuid, tenantId, userId, updated, created, hostId,
+ accessIPv4, accessIPv6, status, image, flavor, keyName, configDrive, addresses,
+ metadata, extendedStatus, extendedAttributes, diskConfig, securityGroupNames);
+ }
+
+ public T fromServerWithSecurityGroups(ServerWithSecurityGroups in) {
+ return super.fromServer(in)
+ .securityGroupNames(in.getSecurityGroupNames());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ @Named("security_groups")
+ private final Set<String> securityGroupNames;
+
+ @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", "security_groups"
+ })
+ protected ServerWithSecurityGroups(String id, @Nullable String name, Set<Link> links, @Nullable String uuid,
+ String tenantId, String userId, 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, Set<String> securityGroupNames) {
+ super(id, name, links, uuid, tenantId, userId, updated, created, hostId, accessIPv4, accessIPv6, status, image, flavor, keyName, configDrive, addresses, metadata, extendedStatus, extendedAttributes, diskConfig);
+ this.securityGroupNames = ImmutableSet.copyOf(checkNotNull(securityGroupNames, "securityGroupNames"));
+ }
+
+ public Set<String> getSecurityGroupNames() {
+ return this.securityGroupNames;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(securityGroupNames);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ ServerWithSecurityGroups that = ServerWithSecurityGroups.class.cast(obj);
+ return super.equals(that) && Objects.equal(this.securityGroupNames, that.securityGroupNames);
+ }
+
+ protected ToStringHelper string() {
+ return super.string()
+ .add("securityGroupNames", securityGroupNames);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/d4243b7e/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SimpleServerUsage.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SimpleServerUsage.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SimpleServerUsage.java
new file mode 100644
index 0000000..eba8531
--- /dev/null
+++ b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SimpleServerUsage.java
@@ -0,0 +1,312 @@
+/*
+ * 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 javax.inject.Named;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+
+/**
+ * Information the SimpleTenantUsage extension return data about each Server
+ *
+ * @author Adam Lowe
+*/
+public class SimpleServerUsage {
+
+ /**
+ */
+ public static enum Status {
+
+ UNRECOGNIZED, ACTIVE;
+
+ public String value() {
+ return name();
+ }
+
+ public static Status fromValue(String v) {
+ try {
+ return valueOf(v.toUpperCase());
+ } catch (IllegalArgumentException e) {
+ return UNRECOGNIZED;
+ }
+ }
+
+ }
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromSimpleServerUsage(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected String instanceName;
+ protected double hours;
+ protected double flavorMemoryMb;
+ protected double flavorLocalGb;
+ protected double flavorVcpus;
+ protected String tenantId;
+ protected String flavorName;
+ protected Date instanceCreated;
+ protected Date instanceTerminated;
+ protected SimpleServerUsage.Status instanceStatus;
+ protected long uptime;
+
+ /**
+ * @see SimpleServerUsage#getInstanceName()
+ */
+ public T instanceName(String instanceName) {
+ this.instanceName = instanceName;
+ return self();
+ }
+
+ /**
+ * @see SimpleServerUsage#getHours()
+ */
+ public T hours(double hours) {
+ this.hours = hours;
+ return self();
+ }
+
+ /**
+ * @see SimpleServerUsage#getFlavorMemoryMb()
+ */
+ public T flavorMemoryMb(double flavorMemoryMb) {
+ this.flavorMemoryMb = flavorMemoryMb;
+ return self();
+ }
+
+ /**
+ * @see SimpleServerUsage#getFlavorLocalGb()
+ */
+ public T flavorLocalGb(double flavorLocalGb) {
+ this.flavorLocalGb = flavorLocalGb;
+ return self();
+ }
+
+ /**
+ * @see SimpleServerUsage#getFlavorVcpus()
+ */
+ public T flavorVcpus(double flavorVcpus) {
+ this.flavorVcpus = flavorVcpus;
+ return self();
+ }
+
+ /**
+ * @see SimpleServerUsage#getTenantId()
+ */
+ public T tenantId(String tenantId) {
+ this.tenantId = tenantId;
+ return self();
+ }
+
+ /**
+ * @see SimpleServerUsage#getFlavorName()
+ */
+ public T flavorName(String flavorName) {
+ this.flavorName = flavorName;
+ return self();
+ }
+
+ /**
+ * @see SimpleServerUsage#getInstanceCreated()
+ */
+ public T instanceCreated(Date instanceCreated) {
+ this.instanceCreated = instanceCreated;
+ return self();
+ }
+
+ /**
+ * @see SimpleServerUsage#getInstanceTerminated()
+ */
+ public T instanceTerminated(Date instanceTerminated) {
+ this.instanceTerminated = instanceTerminated;
+ return self();
+ }
+
+ /**
+ * @see SimpleServerUsage#getInstanceStatus()
+ */
+ public T instanceStatus(SimpleServerUsage.Status instanceStatus) {
+ this.instanceStatus = instanceStatus;
+ return self();
+ }
+
+ /**
+ * @see SimpleServerUsage#getUptime()
+ */
+ public T uptime(long uptime) {
+ this.uptime = uptime;
+ return self();
+ }
+
+ public SimpleServerUsage build() {
+ return new SimpleServerUsage(instanceName, hours, flavorMemoryMb, flavorLocalGb, flavorVcpus, tenantId, flavorName, instanceCreated, instanceTerminated, instanceStatus, uptime);
+ }
+
+ public T fromSimpleServerUsage(SimpleServerUsage in) {
+ return this
+ .instanceName(in.getInstanceName())
+ .hours(in.getHours())
+ .flavorMemoryMb(in.getFlavorMemoryMb())
+ .flavorLocalGb(in.getFlavorLocalGb())
+ .flavorVcpus(in.getFlavorVcpus())
+ .tenantId(in.getTenantId())
+ .flavorName(in.getFlavorName())
+ .instanceCreated(in.getInstanceCreated())
+ .instanceTerminated(in.getInstanceTerminated())
+ .instanceStatus(in.getInstanceStatus())
+ .uptime(in.getUptime());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ @Named("name")
+ private final String instanceName;
+ private final double hours;
+ @Named("memory_mb")
+ private final double flavorMemoryMb;
+ @Named("local_gb")
+ private final double flavorLocalGb;
+ @Named("vcpus")
+ private final double flavorVcpus;
+ @Named("tenant_id")
+ private final String tenantId;
+ @Named("flavor")
+ private final String flavorName;
+ @Named("started_at")
+ private final Date instanceCreated;
+ @Named("ended_at")
+ private final Date instanceTerminated;
+ @Named("state")
+ private final SimpleServerUsage.Status instanceStatus;
+ private final long uptime;
+
+ @ConstructorProperties({
+ "name", "hours", "memory_mb", "local_gb", "vcpus", "tenant_id", "flavor", "started_at", "ended_at", "state", "uptime"
+ })
+ protected SimpleServerUsage(String instanceName, double hours, double flavorMemoryMb, double flavorLocalGb, double flavorVcpus, String tenantId, String flavorName, Date instanceCreated, @Nullable Date instanceTerminated, SimpleServerUsage.Status instanceStatus, long uptime) {
+ this.instanceName = checkNotNull(instanceName, "instanceName");
+ this.hours = hours;
+ this.flavorMemoryMb = flavorMemoryMb;
+ this.flavorLocalGb = flavorLocalGb;
+ this.flavorVcpus = flavorVcpus;
+ this.tenantId = checkNotNull(tenantId, "tenantId");
+ this.flavorName = checkNotNull(flavorName, "flavorName");
+ this.instanceCreated = checkNotNull(instanceCreated, "instanceCreated");
+ this.instanceTerminated = instanceTerminated;
+ this.instanceStatus = checkNotNull(instanceStatus, "instanceStatus");
+ this.uptime = uptime;
+ }
+
+ public String getInstanceName() {
+ return this.instanceName;
+ }
+
+ public double getHours() {
+ return this.hours;
+ }
+
+ public double getFlavorMemoryMb() {
+ return this.flavorMemoryMb;
+ }
+
+ public double getFlavorLocalGb() {
+ return this.flavorLocalGb;
+ }
+
+ public double getFlavorVcpus() {
+ return this.flavorVcpus;
+ }
+
+ public String getTenantId() {
+ return this.tenantId;
+ }
+
+ public String getFlavorName() {
+ return this.flavorName;
+ }
+
+ public Date getInstanceCreated() {
+ return this.instanceCreated;
+ }
+
+ @Nullable
+ public Date getInstanceTerminated() {
+ return this.instanceTerminated;
+ }
+
+ public SimpleServerUsage.Status getInstanceStatus() {
+ return this.instanceStatus;
+ }
+
+ public long getUptime() {
+ return this.uptime;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(instanceName, hours, flavorMemoryMb, flavorLocalGb, flavorVcpus, tenantId, flavorName, instanceCreated, instanceTerminated, instanceStatus, uptime);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ SimpleServerUsage that = SimpleServerUsage.class.cast(obj);
+ return Objects.equal(this.instanceName, that.instanceName)
+ && Objects.equal(this.hours, that.hours)
+ && Objects.equal(this.flavorMemoryMb, that.flavorMemoryMb)
+ && Objects.equal(this.flavorLocalGb, that.flavorLocalGb)
+ && Objects.equal(this.flavorVcpus, that.flavorVcpus)
+ && Objects.equal(this.tenantId, that.tenantId)
+ && Objects.equal(this.flavorName, that.flavorName)
+ && Objects.equal(this.instanceCreated, that.instanceCreated)
+ && Objects.equal(this.instanceTerminated, that.instanceTerminated)
+ && Objects.equal(this.instanceStatus, that.instanceStatus)
+ && Objects.equal(this.uptime, that.uptime);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("instanceName", instanceName).add("hours", hours).add("flavorMemoryMb", flavorMemoryMb).add("flavorLocalGb", flavorLocalGb).add("flavorVcpus", flavorVcpus).add("tenantId", tenantId).add("flavorName", flavorName).add("instanceCreated", instanceCreated).add("instanceTerminated", instanceTerminated).add("instanceStatus", instanceStatus).add("uptime", uptime);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/d4243b7e/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SimpleTenantUsage.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SimpleTenantUsage.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SimpleTenantUsage.java
new file mode 100644
index 0000000..61cec18
--- /dev/null
+++ b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SimpleTenantUsage.java
@@ -0,0 +1,245 @@
+/*
+ * 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.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;
+
+/**
+ * Information the SimpleTenantUsage extension returns data about each tenant
+ *
+ * @author Adam Lowe
+*/
+public class SimpleTenantUsage {
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromSimpleTenantUsage(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected String tenantId;
+ protected double totalLocalGbUsage;
+ protected double totalVcpusUsage;
+ protected double totalMemoryMbUsage;
+ protected double totalHours;
+ protected Date start;
+ protected Date stop;
+ protected Set<SimpleServerUsage> serverUsages = ImmutableSet.of();
+
+ /**
+ * @see SimpleTenantUsage#getTenantId()
+ */
+ public T tenantId(String tenantId) {
+ this.tenantId = tenantId;
+ return self();
+ }
+
+ /**
+ * @see SimpleTenantUsage#getTotalLocalGbUsage()
+ */
+ public T totalLocalGbUsage(double totalLocalGbUsage) {
+ this.totalLocalGbUsage = totalLocalGbUsage;
+ return self();
+ }
+
+ /**
+ * @see SimpleTenantUsage#getTotalVcpusUsage()
+ */
+ public T totalVcpusUsage(double totalVcpusUsage) {
+ this.totalVcpusUsage = totalVcpusUsage;
+ return self();
+ }
+
+ /**
+ * @see SimpleTenantUsage#getTotalMemoryMbUsage()
+ */
+ public T totalMemoryMbUsage(double totalMemoryMbUsage) {
+ this.totalMemoryMbUsage = totalMemoryMbUsage;
+ return self();
+ }
+
+ /**
+ * @see SimpleTenantUsage#getTotalHours()
+ */
+ public T totalHours(double totalHours) {
+ this.totalHours = totalHours;
+ return self();
+ }
+
+ /**
+ * @see SimpleTenantUsage#getStart()
+ */
+ public T start(Date start) {
+ this.start = start;
+ return self();
+ }
+
+ /**
+ * @see SimpleTenantUsage#getStop()
+ */
+ public T stop(Date stop) {
+ this.stop = stop;
+ return self();
+ }
+
+ /**
+ * @see SimpleTenantUsage#getServerUsages()
+ */
+ public T serverUsages(Set<SimpleServerUsage> serverUsages) {
+ this.serverUsages = ImmutableSet.copyOf(checkNotNull(serverUsages, "serverUsages"));
+ return self();
+ }
+
+ public T serverUsages(SimpleServerUsage... in) {
+ return serverUsages(ImmutableSet.copyOf(in));
+ }
+
+ public SimpleTenantUsage build() {
+ return new SimpleTenantUsage(tenantId, totalLocalGbUsage, totalVcpusUsage, totalMemoryMbUsage, totalHours, start, stop, serverUsages);
+ }
+
+ public T fromSimpleTenantUsage(SimpleTenantUsage in) {
+ return this
+ .tenantId(in.getTenantId())
+ .totalLocalGbUsage(in.getTotalLocalGbUsage())
+ .totalVcpusUsage(in.getTotalVcpusUsage())
+ .totalMemoryMbUsage(in.getTotalMemoryMbUsage())
+ .totalHours(in.getTotalHours())
+ .start(in.getStart())
+ .stop(in.getStop())
+ .serverUsages(in.getServerUsages());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ @Named("tenant_id")
+ private final String tenantId;
+ @Named("total_local_gb_usage")
+ private final double totalLocalGbUsage;
+ @Named("total_vcpus_usage")
+ private final double totalVcpusUsage;
+ @Named("total_memory_mb_usage")
+ private final double totalMemoryMbUsage;
+ @Named("total_hours")
+ private final double totalHours;
+ private final Date start;
+ private final Date stop;
+ @Named("server_usages")
+ private final Set<SimpleServerUsage> serverUsages;
+
+ @ConstructorProperties({
+ "tenant_id", "total_local_gb_usage", "total_vcpus_usage", "total_memory_mb_usage", "total_hours", "start", "stop", "server_usages"
+ })
+ protected SimpleTenantUsage(String tenantId, double totalLocalGbUsage, double totalVcpusUsage, double totalMemoryMbUsage, double totalHours, @Nullable Date start, @Nullable Date stop, @Nullable Set<SimpleServerUsage> serverUsages) {
+ this.tenantId = checkNotNull(tenantId, "tenantId");
+ this.totalLocalGbUsage = totalLocalGbUsage;
+ this.totalVcpusUsage = totalVcpusUsage;
+ this.totalMemoryMbUsage = totalMemoryMbUsage;
+ this.totalHours = totalHours;
+ this.start = start;
+ this.stop = stop;
+ this.serverUsages = serverUsages == null ? ImmutableSet.<SimpleServerUsage>of() : ImmutableSet.copyOf(serverUsages);
+ }
+
+ public String getTenantId() {
+ return this.tenantId;
+ }
+
+ public double getTotalLocalGbUsage() {
+ return this.totalLocalGbUsage;
+ }
+
+ public double getTotalVcpusUsage() {
+ return this.totalVcpusUsage;
+ }
+
+ public double getTotalMemoryMbUsage() {
+ return this.totalMemoryMbUsage;
+ }
+
+ public double getTotalHours() {
+ return this.totalHours;
+ }
+
+ @Nullable
+ public Date getStart() {
+ return this.start;
+ }
+
+ @Nullable
+ public Date getStop() {
+ return this.stop;
+ }
+
+ public Set<SimpleServerUsage> getServerUsages() {
+ return this.serverUsages;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(tenantId, totalLocalGbUsage, totalVcpusUsage, totalMemoryMbUsage, totalHours, start, stop, serverUsages);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ SimpleTenantUsage that = SimpleTenantUsage.class.cast(obj);
+ return Objects.equal(this.tenantId, that.tenantId)
+ && Objects.equal(this.totalLocalGbUsage, that.totalLocalGbUsage)
+ && Objects.equal(this.totalVcpusUsage, that.totalVcpusUsage)
+ && Objects.equal(this.totalMemoryMbUsage, that.totalMemoryMbUsage)
+ && Objects.equal(this.totalHours, that.totalHours)
+ && Objects.equal(this.start, that.start)
+ && Objects.equal(this.stop, that.stop)
+ && Objects.equal(this.serverUsages, that.serverUsages);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("tenantId", tenantId).add("totalLocalGbUsage", totalLocalGbUsage).add("totalVcpusUsage", totalVcpusUsage).add("totalMemoryMbUsage", totalMemoryMbUsage).add("totalHours", totalHours).add("start", start).add("stop", stop).add("serverUsages", serverUsages);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/d4243b7e/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/TenantIdAndName.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/TenantIdAndName.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/TenantIdAndName.java
new file mode 100644
index 0000000..c90f40e
--- /dev/null
+++ b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/TenantIdAndName.java
@@ -0,0 +1,127 @@
+/*
+ * 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;
+
+/**
+ * Class TenantIdAndName
+ *
+ * @author Adrian Cole
+*/
+public class TenantIdAndName {
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromTenantIdAndName(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected String tenantId;
+ protected String name;
+
+ /**
+ * @see TenantIdAndName#getTenantId()
+ */
+ public T tenantId(String tenantId) {
+ this.tenantId = tenantId;
+ return self();
+ }
+
+ /**
+ * @see TenantIdAndName#getName()
+ */
+ public T name(String name) {
+ this.name = name;
+ return self();
+ }
+
+ public TenantIdAndName build() {
+ return new TenantIdAndName(tenantId, name);
+ }
+
+ public T fromTenantIdAndName(TenantIdAndName in) {
+ return this
+ .tenantId(in.getTenantId())
+ .name(in.getName());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ @Named("tenant_id")
+ private final String tenantId;
+ private final String name;
+
+ @ConstructorProperties({
+ "tenant_id", "name"
+ })
+ protected TenantIdAndName(String tenantId, String name) {
+ this.tenantId = checkNotNull(tenantId, "tenantId");
+ this.name = checkNotNull(name, "name");
+ }
+
+ public String getTenantId() {
+ return this.tenantId;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(tenantId, name);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ TenantIdAndName that = TenantIdAndName.class.cast(obj);
+ return Objects.equal(this.tenantId, that.tenantId)
+ && Objects.equal(this.name, that.name);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("tenantId", tenantId).add("name", name);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/d4243b7e/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/VirtualInterface.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/VirtualInterface.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/VirtualInterface.java
new file mode 100644
index 0000000..b77f242
--- /dev/null
+++ b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/VirtualInterface.java
@@ -0,0 +1,128 @@
+/*
+ * 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 a Virtual Interface (VIF)
+ *
+ * @author Adam Lowe
+ * @see org.jclouds.openstack.nova.v2_0.extensions.VirtualInterfaceApi
+*/
+public class VirtualInterface {
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromVirtualInterface(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected String id;
+ protected String macAddress;
+
+ /**
+ * @see VirtualInterface#getId()
+ */
+ public T id(String id) {
+ this.id = id;
+ return self();
+ }
+
+ /**
+ * @see VirtualInterface#getMacAddress()
+ */
+ public T macAddress(String macAddress) {
+ this.macAddress = macAddress;
+ return self();
+ }
+
+ public VirtualInterface build() {
+ return new VirtualInterface(id, macAddress);
+ }
+
+ public T fromVirtualInterface(VirtualInterface in) {
+ return this
+ .id(in.getId())
+ .macAddress(in.getMacAddress());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ private final String id;
+ @Named("mac_address")
+ private final String macAddress;
+
+ @ConstructorProperties({
+ "id", "mac_address"
+ })
+ protected VirtualInterface(String id, String macAddress) {
+ this.id = checkNotNull(id, "id");
+ this.macAddress = checkNotNull(macAddress, "macAddress");
+ }
+
+ public String getId() {
+ return this.id;
+ }
+
+ public String getMacAddress() {
+ return this.macAddress;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(id, macAddress);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ VirtualInterface that = VirtualInterface.class.cast(obj);
+ return Objects.equal(this.id, that.id)
+ && Objects.equal(this.macAddress, that.macAddress);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("id", id).add("macAddress", macAddress);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/d4243b7e/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Volume.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Volume.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Volume.java
new file mode 100644
index 0000000..7fecfb2
--- /dev/null
+++ b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Volume.java
@@ -0,0 +1,346 @@
+/*
+ * 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.CaseFormat;
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * An OpenStack Nova Volume
+*/
+public class Volume {
+
+ /**
+ */
+ public static enum Status {
+ CREATING, AVAILABLE, IN_USE, DELETING, ERROR, UNRECOGNIZED;
+ public String value() {
+ return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name());
+ }
+
+ @Override
+ public String toString() {
+ return value();
+ }
+
+ public static Status fromValue(String status) {
+ try {
+ return valueOf(CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(status, "status")));
+ } catch (IllegalArgumentException e) {
+ return UNRECOGNIZED;
+ }
+ }
+ }
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromVolume(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected String id;
+ protected Volume.Status status;
+ protected int size;
+ protected String zone;
+ protected Date created;
+ protected Set<VolumeAttachment> attachments = ImmutableSet.of();
+ protected String volumeType;
+ protected String snapshotId;
+ protected String name;
+ protected String description;
+ protected Map<String, String> metadata = ImmutableMap.of();
+
+ /**
+ * @see Volume#getId()
+ */
+ public T id(String id) {
+ this.id = id;
+ return self();
+ }
+
+ /**
+ * @see Volume#getStatus()
+ */
+ public T status(Volume.Status status) {
+ this.status = status;
+ return self();
+ }
+
+ /**
+ * @see Volume#getSize()
+ */
+ public T size(int size) {
+ this.size = size;
+ return self();
+ }
+
+ /**
+ * @see Volume#getZone()
+ */
+ public T zone(String zone) {
+ this.zone = zone;
+ return self();
+ }
+
+ /**
+ * @see Volume#getCreated()
+ */
+ public T created(Date created) {
+ this.created = created;
+ return self();
+ }
+
+ /**
+ * @see Volume#getAttachments()
+ */
+ public T attachments(Set<VolumeAttachment> attachments) {
+ this.attachments = ImmutableSet.copyOf(checkNotNull(attachments, "attachments"));
+ return self();
+ }
+
+ public T attachments(VolumeAttachment... in) {
+ return attachments(ImmutableSet.copyOf(in));
+ }
+
+ /**
+ * @see Volume#getVolumeType()
+ */
+ public T volumeType(String volumeType) {
+ this.volumeType = volumeType;
+ return self();
+ }
+
+ /**
+ * @see Volume#getSnapshotId()
+ */
+ public T snapshotId(String snapshotId) {
+ this.snapshotId = snapshotId;
+ return self();
+ }
+
+ /**
+ * @see Volume#getName()
+ */
+ public T name(String name) {
+ this.name = name;
+ return self();
+ }
+
+ /**
+ * @see Volume#getDescription()
+ */
+ public T description(String description) {
+ this.description = description;
+ return self();
+ }
+
+ /**
+ * @see Volume#getMetadata()
+ */
+ public T metadata(Map<String, String> metadata) {
+ this.metadata = ImmutableMap.copyOf(checkNotNull(metadata, "metadata"));
+ return self();
+ }
+
+ public Volume build() {
+ return new Volume(id, status, size, zone, created, attachments, volumeType, snapshotId, name, description, metadata);
+ }
+
+ public T fromVolume(Volume in) {
+ return this
+ .id(in.getId())
+ .status(in.getStatus())
+ .size(in.getSize())
+ .zone(in.getZone())
+ .created(in.getCreated())
+ .attachments(in.getAttachments())
+ .volumeType(in.getVolumeType())
+ .snapshotId(in.getSnapshotId())
+ .name(in.getName())
+ .description(in.getDescription())
+ .metadata(in.getMetadata());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ private final String id;
+ private final Volume.Status status;
+ private final int size;
+ @Named("availabilityZone")
+ private final String zone;
+ @Named("createdAt")
+ private final Date created;
+ private final Set<VolumeAttachment> attachments;
+ private final String volumeType;
+ private final String snapshotId;
+ @Named("displayName")
+ private final String name;
+ @Named("displayDescription")
+ private final String description;
+ private final Map<String, String> metadata;
+
+ @ConstructorProperties({
+ "id", "status", "size", "availabilityZone", "createdAt", "attachments", "volumeType", "snapshotId", "displayName", "displayDescription", "metadata"
+ })
+ protected Volume(String id, Volume.Status status, int size, String zone, Date created, @Nullable Set<VolumeAttachment> attachments, @Nullable String volumeType, @Nullable String snapshotId, @Nullable String name, @Nullable String description, @Nullable Map<String, String> metadata) {
+ this.id = checkNotNull(id, "id");
+ this.status = checkNotNull(status, "status");
+ this.size = size;
+ this.zone = checkNotNull(zone, "zone");
+ this.created = checkNotNull(created, "created");
+ this.attachments = attachments == null ? ImmutableSet.<VolumeAttachment>of() : ImmutableSet.copyOf(attachments);
+ this.volumeType = volumeType;
+ this.snapshotId = snapshotId;
+ this.name = name;
+ this.description = description;
+ this.metadata = metadata == null ? ImmutableMap.<String, String>of() : ImmutableMap.copyOf(metadata);
+ }
+
+ /**
+ * @return the id of this volume
+ */
+ public String getId() {
+ return this.id;
+ }
+
+ /**
+ * @return the status of this volume
+ */
+ public Volume.Status getStatus() {
+ return this.status;
+ }
+
+ /**
+ * @return the size in GB of this volume
+ */
+ public int getSize() {
+ return this.size;
+ }
+
+ /**
+ * @return the availabilityZone containing this volume
+ */
+ public String getZone() {
+ return this.zone;
+ }
+
+ /**
+ * @return the time this volume was created
+ */
+ public Date getCreated() {
+ return this.created;
+ }
+
+ /**
+ * @return the set of attachments (to Servers)
+ */
+ public Set<VolumeAttachment> getAttachments() {
+ return this.attachments;
+ }
+
+ /**
+ * @return the type of this volume
+ */
+ @Nullable
+ public String getVolumeType() {
+ return this.volumeType;
+ }
+
+ @Nullable
+ public String getSnapshotId() {
+ return this.snapshotId;
+ }
+
+ /**
+ * @return the name of this volume - as displayed in the openstack console
+ */
+ @Nullable
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * @return the description of this volume - as displayed in the openstack console
+ */
+ @Nullable
+ public String getDescription() {
+ return this.description;
+ }
+
+ public Map<String, String> getMetadata() {
+ return this.metadata;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(id, status, size, zone, created, attachments, volumeType, snapshotId, name, description, metadata);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ Volume that = Volume.class.cast(obj);
+ return Objects.equal(this.id, that.id)
+ && Objects.equal(this.status, that.status)
+ && Objects.equal(this.size, that.size)
+ && Objects.equal(this.zone, that.zone)
+ && Objects.equal(this.created, that.created)
+ && Objects.equal(this.attachments, that.attachments)
+ && Objects.equal(this.volumeType, that.volumeType)
+ && Objects.equal(this.snapshotId, that.snapshotId)
+ && Objects.equal(this.name, that.name)
+ && Objects.equal(this.description, that.description)
+ && Objects.equal(this.metadata, that.metadata);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("id", id).add("status", status).add("size", size).add("zone", zone).add("created", created).add("attachments", attachments).add("volumeType", volumeType).add("snapshotId", snapshotId).add("name", name).add("description", description).add("metadata", metadata);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/d4243b7e/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/VolumeAttachment.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/VolumeAttachment.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/VolumeAttachment.java
new file mode 100644
index 0000000..894f85b
--- /dev/null
+++ b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/domain/VolumeAttachment.java
@@ -0,0 +1,172 @@
+/*
+ * 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 org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+
+/**
+ * An OpenStack Nova Volume Attachment (describes how Volumes are attached to Servers)
+*/
+public class VolumeAttachment {
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromVolumeAttachment(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected String id;
+ protected String volumeId;
+ protected String serverId;
+ protected String device;
+
+ /**
+ * @see VolumeAttachment#getId()
+ */
+ public T id(String id) {
+ this.id = id;
+ return self();
+ }
+
+ /**
+ * @see VolumeAttachment#getVolumeId()
+ */
+ public T volumeId(String volumeId) {
+ this.volumeId = volumeId;
+ return self();
+ }
+
+ /**
+ * @see VolumeAttachment#getServerId()
+ */
+ public T serverId(String serverId) {
+ this.serverId = serverId;
+ return self();
+ }
+
+ /**
+ * @see VolumeAttachment#getDevice()
+ */
+ public T device(String device) {
+ this.device = device;
+ return self();
+ }
+
+ public VolumeAttachment build() {
+ return new VolumeAttachment(id, volumeId, serverId, device);
+ }
+
+ public T fromVolumeAttachment(VolumeAttachment in) {
+ return this
+ .id(in.getId())
+ .volumeId(in.getVolumeId())
+ .serverId(in.getServerId())
+ .device(in.getDevice());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ private final String id;
+ private final String volumeId;
+ private final String serverId;
+ private final String device;
+
+ @ConstructorProperties({
+ "id", "volumeId", "serverId", "device"
+ })
+ protected VolumeAttachment(String id, String volumeId, @Nullable String serverId, @Nullable String device) {
+ this.id = checkNotNull(id, "id");
+ this.volumeId = checkNotNull(volumeId, "volumeId");
+ this.serverId = serverId;
+ this.device = device;
+ }
+
+ /**
+ * @return the attachment id (typically the same as #getVolumeId())
+ */
+ public String getId() {
+ return this.id;
+ }
+
+ /**
+ * @return the id of the volume attached
+ */
+ public String getVolumeId() {
+ return this.volumeId;
+ }
+
+ /**
+ * @return the id of the server the volume is attached to
+ */
+ @Nullable
+ public String getServerId() {
+ return this.serverId;
+ }
+
+ /**
+ * @return the device name (e.g. "/dev/vdc")
+ */
+ @Nullable
+ public String getDevice() {
+ return this.device;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(id, volumeId, serverId, device);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ VolumeAttachment that = VolumeAttachment.class.cast(obj);
+ return Objects.equal(this.id, that.id)
+ && Objects.equal(this.volumeId, that.volumeId)
+ && Objects.equal(this.serverId, that.serverId)
+ && Objects.equal(this.device, that.device);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("id", id).add("volumeId", volumeId).add("serverId", serverId).add("device", device);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+}