http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/RunningInstance.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/RunningInstance.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/RunningInstance.java deleted file mode 100644 index 725165a..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/RunningInstance.java +++ /dev/null @@ -1,525 +0,0 @@ -/* - * 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.ec2.domain; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Date; -import java.util.Map; -import java.util.Set; - -import org.jclouds.javax.annotation.Nullable; - -import com.google.common.base.Objects; -import com.google.common.base.Objects.ToStringHelper; -import com.google.common.base.Strings; -import com.google.common.collect.ComparisonChain; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Maps; -import com.google.common.collect.Ordering; -import com.google.common.collect.Sets; - -/** - * - * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-ItemType-RunningInstancesItemType.html" - * /> - * @author Adrian Cole - */ -public class RunningInstance implements Comparable<RunningInstance> { - - public static Builder<?> builder() { - return new ConcreteBuilder(); - } - - public Builder<?> toBuilder() { - return new ConcreteBuilder().fromRunningInstance(this); - } - - public abstract static class Builder<T extends Builder<T>> { - protected abstract T self(); - - protected String region; - protected Set<String> groupNames = Sets.newLinkedHashSet(); - protected String amiLaunchIndex; - protected String dnsName; - protected String imageId; - protected String instanceId; - protected InstanceState instanceState; - protected String rawState; - protected String instanceType; - protected String ipAddress; - protected String kernelId; - protected String keyName; - protected Date launchTime; - protected String availabilityZone; - protected String virtualizationType = "paravirtual"; - protected String platform; - protected String privateDnsName; - protected String privateIpAddress; - protected String ramdiskId; - protected String reason; - protected RootDeviceType rootDeviceType = RootDeviceType.INSTANCE_STORE; - protected String rootDeviceName; - protected Map<String, BlockDevice> ebsBlockDevices = Maps.newLinkedHashMap(); - protected Map<String, String> tags = Maps.newLinkedHashMap(); - - public T tags(Map<String, String> tags) { - this.tags = ImmutableMap.copyOf(checkNotNull(tags, "tags")); - return self(); - } - - public T tag(String key, String value) { - if (key != null) - this.tags.put(key, Strings.nullToEmpty(value)); - return self(); - } - - public T region(String region) { - this.region = region; - return self(); - } - - public T groupNames(Iterable<String> groupNames) { - this.groupNames = ImmutableSet.copyOf(checkNotNull(groupNames, "groupNames")); - return self(); - } - - public T groupName(String groupName) { - if (groupName != null) - this.groupNames.add(groupName); - return self(); - } - - public T amiLaunchIndex(String amiLaunchIndex) { - this.amiLaunchIndex = amiLaunchIndex; - return self(); - } - - public T dnsName(String dnsName) { - this.dnsName = dnsName; - return self(); - } - - public T imageId(String imageId) { - this.imageId = imageId; - return self(); - } - - public T instanceId(String instanceId) { - this.instanceId = instanceId; - return self(); - } - - public T instanceState(InstanceState instanceState) { - this.instanceState = instanceState; - return self(); - } - - public T rawState(String rawState) { - this.rawState = rawState; - return self(); - } - - public T instanceType(String instanceType) { - this.instanceType = instanceType; - return self(); - } - - public T ipAddress(String ipAddress) { - this.ipAddress = ipAddress; - return self(); - } - - public T kernelId(String kernelId) { - this.kernelId = kernelId; - return self(); - } - - public T keyName(String keyName) { - this.keyName = keyName; - return self(); - } - - public T launchTime(Date launchTime) { - this.launchTime = launchTime; - return self(); - } - - public T availabilityZone(String availabilityZone) { - this.availabilityZone = availabilityZone; - return self(); - } - - public T virtualizationType(String virtualizationType) { - this.virtualizationType = virtualizationType; - return self(); - } - - public T platform(String platform) { - this.platform = platform; - return self(); - } - - public T privateDnsName(String privateDnsName) { - this.privateDnsName = privateDnsName; - return self(); - } - - public T privateIpAddress(String privateIpAddress) { - this.privateIpAddress = privateIpAddress; - return self(); - } - - public T ramdiskId(String ramdiskId) { - this.ramdiskId = ramdiskId; - return self(); - } - - public T reason(String reason) { - this.reason = reason; - return self(); - } - - public T rootDeviceType(RootDeviceType rootDeviceType) { - this.rootDeviceType = rootDeviceType; - return self(); - } - - public T rootDeviceName(String rootDeviceName) { - this.rootDeviceName = rootDeviceName; - return self(); - } - - public T devices(Map<String, BlockDevice> ebsBlockDevices) { - this.ebsBlockDevices = ImmutableMap.copyOf(checkNotNull(ebsBlockDevices, "ebsBlockDevices")); - return self(); - } - - public T device(String key, BlockDevice value) { - if (key != null && value != null) - this.ebsBlockDevices.put(key, value); - return self(); - } - - public T fromRunningInstance(RunningInstance in) { - return region(in.region).groupNames(in.groupNames).amiLaunchIndex(in.amiLaunchIndex).dnsName(in.dnsName) - .imageId(in.imageId).instanceId(in.instanceId).instanceState(in.instanceState).rawState(in.rawState) - .instanceType(in.instanceType).ipAddress(in.ipAddress).kernelId(in.kernelId).keyName(in.keyName) - .launchTime(in.launchTime).availabilityZone(in.availabilityZone) - .virtualizationType(in.virtualizationType).platform(in.platform).privateDnsName(in.privateDnsName) - .privateIpAddress(in.privateIpAddress).ramdiskId(in.ramdiskId).reason(in.reason) - .rootDeviceType(in.rootDeviceType).rootDeviceName(in.rootDeviceName).devices(in.ebsBlockDevices) - .tags(in.tags); - } - - public abstract RunningInstance build(); - - } - - private static class ConcreteBuilder extends Builder<ConcreteBuilder> { - @Override - protected ConcreteBuilder self() { - return this; - } - - @Override - public RunningInstance build() { - return new RunningInstance(region, groupNames, amiLaunchIndex, dnsName, imageId, instanceId, instanceState, - rawState, instanceType, ipAddress, kernelId, keyName, launchTime, availabilityZone, virtualizationType, - platform, privateDnsName, privateIpAddress, ramdiskId, reason, rootDeviceType, rootDeviceName, - ebsBlockDevices, tags); - } - } - - protected final String region; - protected final Set<String> groupNames; - protected final String amiLaunchIndex; - @Nullable - protected final String dnsName; - protected final String imageId; - protected final String instanceId; - protected final InstanceState instanceState; - protected final String rawState; - protected final String instanceType; - @Nullable - protected final String ipAddress; - @Nullable - protected final String kernelId; - @Nullable - protected final String keyName; - protected final Date launchTime; - protected final String availabilityZone; - protected final String virtualizationType; - @Nullable - protected final String platform; - @Nullable - protected final String privateDnsName; - @Nullable - protected final String privateIpAddress; - @Nullable - protected final String ramdiskId; - @Nullable - protected final String reason; - protected final RootDeviceType rootDeviceType; - @Nullable - protected final String rootDeviceName; - protected final Map<String, BlockDevice> ebsBlockDevices; - protected final Map<String, String> tags; - - protected RunningInstance(String region, Iterable<String> groupNames, @Nullable String amiLaunchIndex, - @Nullable String dnsName, String imageId, String instanceId, InstanceState instanceState, String rawState, - String instanceType, @Nullable String ipAddress, @Nullable String kernelId, @Nullable String keyName, - Date launchTime, String availabilityZone, String virtualizationType, @Nullable String platform, - @Nullable String privateDnsName, @Nullable String privateIpAddress, @Nullable String ramdiskId, - @Nullable String reason, RootDeviceType rootDeviceType, @Nullable String rootDeviceName, - Map<String, BlockDevice> ebsBlockDevices, Map<String, String> tags) { - this.region = checkNotNull(region, "region"); - this.amiLaunchIndex = amiLaunchIndex; // nullable on runinstances. - this.dnsName = dnsName; // nullable on runinstances. - this.imageId = imageId; // nullable on runinstances. - this.instanceId = checkNotNull(instanceId, "instanceId"); - this.instanceState = checkNotNull(instanceState, "instanceState for %s/%s", region, instanceId); - this.rawState = checkNotNull(rawState, "rawState for %s/%s", region, instanceId); - this.instanceType = checkNotNull(instanceType, "instanceType for %s/%s", region, instanceId); - this.ipAddress = ipAddress; - this.kernelId = kernelId; - this.keyName = keyName; - this.launchTime = launchTime;// nullable on spot. - this.availabilityZone = availabilityZone;// nullable on spot. - this.virtualizationType = virtualizationType; - this.platform = platform; - this.privateDnsName = privateDnsName;// nullable on runinstances. - this.privateIpAddress = privateIpAddress;// nullable on runinstances. - this.ramdiskId = ramdiskId; - this.reason = reason; - this.rootDeviceType = checkNotNull(rootDeviceType, "rootDeviceType for %s/%s", region, instanceId); - this.rootDeviceName = rootDeviceName; - this.ebsBlockDevices = ImmutableMap.copyOf(checkNotNull(ebsBlockDevices, "ebsBlockDevices for %s/%s", region, instanceId)); - this.groupNames = ImmutableSet.copyOf(checkNotNull(groupNames, "groupNames for %s/%s", region, instanceId)); - this.tags = ImmutableMap.<String, String> copyOf(checkNotNull(tags, "tags")); - } - - /** - * To be removed in jclouds 1.6 <h4>Warning</h4> - * - * Especially on EC2 clones that may not support regions, this value is fragile. Consider - * alternate means to determine context. - */ - @Deprecated - public String getRegion() { - return region; - } - - /** - * The AMI launch index, which can be used to find this instance within the launch group. For - * more information, go to the Metadata section of the Amazon Elastic Compute Cloud Developer - * Guide. - * - * @see <a href="http://docs.amazonwebservices.com/AWSEC2/2010-08-31/DeveloperGuide/" /> - */ - public String getAmiLaunchIndex() { - return amiLaunchIndex; - } - - /** - * The public DNS name assigned to the instance. This DNS name is contactable from outside the - * Amazon EC2 network. This element remains empty until the instance enters a running state. - */ - public String getDnsName() { - return dnsName; - } - - /** - * Image ID of the AMI used to launch the instance. - */ - public String getImageId() { - return imageId; - } - - /** - * Unique ID of the instance launched. - */ - public String getId() { - return instanceId; - } - - /** - * The current state of the instance. - */ - public InstanceState getInstanceState() { - return instanceState; - } - - /** - * The current state of the instance, as returned literally from the input XML - */ - public String getRawState() { - return rawState; - } - - /** - * The instance type. - */ - public String getInstanceType() { - return instanceType; - } - - /** - * Specifies the IP address of the instance. - */ - public String getIpAddress() { - return ipAddress; - } - - /** - * Optional. Kernel associated with this instance. - */ - public String getKernelId() { - return kernelId; - } - - /** - * If this instance was launched with an associated key pair, this displays the key pair name. - */ - public String getKeyName() { - return keyName; - } - - /** - * The time the instance launched. - */ - public Date getLaunchTime() { - return launchTime; - } - - /** - * The location where the instance launched. - */ - public String getAvailabilityZone() { - return availabilityZone; - } - - /** - * Specifies the instance's virtualization type. Valid values are paravirtual or hvm. - */ - public String getVirtualizationType() { - return virtualizationType; - } - - /** - * Platform of the instance (e.g., Windows). - */ - public String getPlatform() { - return platform; - } - - /** - * The private DNS name assigned to the instance. This DNS name can only be used inside the - * Amazon EC2 network. This element remains empty until the instance enters a running state. - */ - public String getPrivateDnsName() { - return privateDnsName; - } - - /** - * Specifies the private IP address that is assigned to the instance (Amazon VPC). - */ - public String getPrivateIpAddress() { - return privateIpAddress; - } - - /** - * Optional. RAM disk associated with this instance. - */ - public String getRamdiskId() { - return ramdiskId; - } - - /** - * Reason for the most recent state transition. This might be an empty string. - */ - public String getReason() { - return reason; - } - - public RootDeviceType getRootDeviceType() { - return rootDeviceType; - } - - public String getRootDeviceName() { - return rootDeviceName; - } - - /** - * EBS volumes associated with the instance. - */ - public Map<String, BlockDevice> getEbsBlockDevices() { - return ebsBlockDevices; - } - - /** - * Names of the security groups. - */ - public Set<String> getGroupNames() { - return groupNames; - } - - /** - * tags that are present in the instance - */ - public Map<String, String> getTags() { - return tags; - } - - @Override - public int compareTo(RunningInstance other) { - return ComparisonChain.start().compare(region, other.region).compare(instanceId, other.instanceId, Ordering.natural().nullsLast()).result(); - } - - @Override - public int hashCode() { - return Objects.hashCode(region, instanceId); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null || getClass() != obj.getClass()) - return false; - RunningInstance that = RunningInstance.class.cast(obj); - return Objects.equal(this.region, that.region) && Objects.equal(this.instanceId, that.instanceId); - } - - protected ToStringHelper string() { - return Objects.toStringHelper(this).omitNullValues().add("region", region) - .add("availabilityZone", availabilityZone).add("id", instanceId).add("state", rawState) - .add("type", instanceType).add("virtualizationType", virtualizationType).add("imageId", imageId) - .add("ipAddress", ipAddress).add("dnsName", dnsName).add("privateIpAddress", privateIpAddress) - .add("privateDnsName", privateDnsName).add("keyName", keyName).add("groupNames", groupNames) - .add("platform", platform).add("launchTime", launchTime).add("rootDeviceName", rootDeviceName) - .add("rootDeviceType", rootDeviceType).add("ebsBlockDevices", ebsBlockDevices).add("tags", tags); - } - - @Override - public String toString() { - return string().toString(); - } - - -}
http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/SecurityGroup.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/SecurityGroup.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/SecurityGroup.java deleted file mode 100644 index caccebc..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/SecurityGroup.java +++ /dev/null @@ -1,229 +0,0 @@ -/* - * 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.ec2.domain; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Set; - -import org.jclouds.javax.annotation.Nullable; -import org.jclouds.net.domain.IpPermission; - -import com.google.common.base.Objects; -import com.google.common.base.Objects.ToStringHelper; -import com.google.common.collect.ForwardingSet; -import com.google.common.collect.ImmutableSet; - -/** - * - * @see <a href= - * "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-ItemType-SecurityGroupItemType.html" - * /> - * @author Adrian Cole - */ -public class SecurityGroup extends ForwardingSet<IpPermission> { - - 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 region; - protected String id; - protected String name; - protected String ownerId; - protected String description; - protected ImmutableSet.Builder<IpPermission> ipPermissions = ImmutableSet.<IpPermission> builder(); - - /** - * @see SecurityGroup#getRegion() - */ - public T region(String region) { - this.region = region; - return self(); - } - - /** - * @see SecurityGroup#getId() - */ - public T id(String id) { - this.id = id; - return self(); - } - - /** - * @see SecurityGroup#getName() - */ - public T name(String name) { - this.name = name; - return self(); - } - - /** - * @see SecurityGroup#getOwnerId() - */ - public T ownerId(String ownerId) { - this.ownerId = ownerId; - return self(); - } - - /** - * @see SecurityGroup#getDescription() - */ - public T description(String description) { - this.description = description; - return self(); - } - - /** - * @see SecurityGroup#delegate() - */ - public T role(IpPermission role) { - this.ipPermissions.add(role); - return self(); - } - - /** - * @see SecurityGroup#delegate() - */ - public T ipPermissions(Iterable<IpPermission> ipPermissions) { - this.ipPermissions.addAll(checkNotNull(ipPermissions, "ipPermissions")); - return self(); - } - - /** - * @see SecurityGroup#delegate() - */ - public T ipPermission(IpPermission ipPermission) { - this.ipPermissions.add(checkNotNull(ipPermission, "ipPermission")); - return self(); - } - - public SecurityGroup build() { - return new SecurityGroup(region, id, name, ownerId, description, ipPermissions.build()); - } - - public T fromSecurityGroup(SecurityGroup in) { - return region(in.region).id(in.id).name(in.name).ownerId(in.ownerId).description(in.description) - .ipPermissions(in); - } - } - - private static class ConcreteBuilder extends Builder<ConcreteBuilder> { - @Override - protected ConcreteBuilder self() { - return this; - } - } - - private final String region; - private final String id; - private final String name; - private final String ownerId; - private final String description; - private final Set<IpPermission> ipPermissions; - - public SecurityGroup(String region, String id, String name, String ownerId, String description, - Iterable<IpPermission> ipPermissions) { - this.region = checkNotNull(region, "region"); - this.id = id; - this.name = name; - this.ownerId = ownerId; - this.description = description; - this.ipPermissions = ImmutableSet.copyOf(checkNotNull(ipPermissions, "ipPermissions")); - } - - /** - * To be removed in jclouds 1.6 <h4>Warning</h4> - * - * Especially on EC2 clones that may not support regions, this value is - * fragile. Consider alternate means to determine context. - */ - @Deprecated - public String getRegion() { - return region; - } - - /** - * id of the security group. Not in all EC2 impls - */ - @Nullable - public String getId() { - return id; - } - - /** - * Name of the security group. - */ - public String getName() { - return name; - } - - /** - * AWS Access Key ID of the owner of the security group. - */ - public String getOwnerId() { - return ownerId; - } - - /** - * Description of the security group. - */ - public String getDescription() { - return description; - } - - @Override - public int hashCode() { - return Objects.hashCode(region, id, name, ownerId); - } - - @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.region, that.region) - && Objects.equal(this.id, that.id) - && Objects.equal(this.name, that.name) - && Objects.equal(this.ownerId, that.ownerId); - } - - protected ToStringHelper string() { - return Objects.toStringHelper(this).omitNullValues().add("region", region).add("id", id).add("name", name) - .add("ownerId", ownerId).add("description", description) - .add("ipPermissions", ipPermissions.size() == 0 ? null : ipPermissions); - } - - @Override - public String toString() { - return string().toString(); - } - - @Override - protected Set<IpPermission> delegate() { - return ipPermissions; - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/Snapshot.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/Snapshot.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/Snapshot.java deleted file mode 100644 index 1800d33..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/Snapshot.java +++ /dev/null @@ -1,235 +0,0 @@ -/* - * 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.ec2.domain; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Date; - -/** - * - * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CreateSnapshot.html" - * /> - * @author Adrian Cole - */ -public class Snapshot implements Comparable<Snapshot> { - public static enum Status { - PENDING, COMPLETED, ERROR, UNRECOGNIZED; - public String value() { - return name().toLowerCase(); - } - - @Override - public String toString() { - return value(); - } - - public static Status fromValue(String status) { - try { - return valueOf(checkNotNull(status, "status").toUpperCase()); - } catch (IllegalArgumentException e) { - return UNRECOGNIZED; - } - } - } - - private final String region; - private final String id; - private final String volumeId; - private final int volumeSize; - private final Status status; - private final Date startTime; - private final int progress; - private final String ownerId; - private final String description; - private final String ownerAlias; - - public Snapshot(String region, String id, String volumeId, int volumeSize, Status status, Date startTime, - int progress, String ownerId, String description, String ownerAlias) { - this.region = checkNotNull(region, "region"); - this.id = id; - this.volumeId = volumeId; - this.volumeSize = volumeSize; - this.status = status; - this.startTime = startTime; - this.progress = progress; - this.ownerId = ownerId; - this.description = description; - this.ownerAlias = ownerAlias; - } - - /** - * To be removed in jclouds 1.6 <h4>Warning</h4> - * - * Especially on EC2 clones that may not support regions, this value is fragile. Consider - * alternate means to determine context. - */ - @Deprecated - public String getRegion() { - return region; - } - - /** - * The ID of the snapshot. - */ - public String getId() { - return id; - } - - /** - * The ID of the volume. - */ - public String getVolumeId() { - return volumeId; - } - - /** - * The size of the volume, in GiB. - */ - public int getVolumeSize() { - return volumeSize; - } - - /** - * Snapshot state (e.g., pending, completed, or error) - */ - public Status getStatus() { - return status; - } - - /** - * Time stamp when the snapshot was initiated. - */ - public Date getStartTime() { - return startTime; - } - - /** - * The progress of the snapshot, in percentage. - */ - public int getProgress() { - return progress; - } - - /** - * AWS Access Key ID of the user who owns the snapshot. - */ - public String getOwnerId() { - return ownerId; - } - - /** - * Description of the snapshot. - */ - public String getDescription() { - return description; - } - - /** - * The AWS identity alias (e.g., "amazon", "redhat", "self", etc.) or AWS identity ID that owns - * the AMI. - */ - public String getOwnerAlias() { - return ownerAlias; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((description == null) ? 0 : description.hashCode()); - result = prime * result + ((id == null) ? 0 : id.hashCode()); - result = prime * result + ((ownerAlias == null) ? 0 : ownerAlias.hashCode()); - result = prime * result + ((ownerId == null) ? 0 : ownerId.hashCode()); - result = prime * result + progress; - result = prime * result + ((region == null) ? 0 : region.hashCode()); - result = prime * result + ((startTime == null) ? 0 : startTime.hashCode()); - result = prime * result + ((status == null) ? 0 : status.hashCode()); - result = prime * result + ((volumeId == null) ? 0 : volumeId.hashCode()); - result = prime * result + volumeSize; - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Snapshot other = (Snapshot) obj; - if (description == null) { - if (other.description != null) - return false; - } else if (!description.equals(other.description)) - return false; - if (id == null) { - if (other.id != null) - return false; - } else if (!id.equals(other.id)) - return false; - if (ownerAlias == null) { - if (other.ownerAlias != null) - return false; - } else if (!ownerAlias.equals(other.ownerAlias)) - return false; - if (ownerId == null) { - if (other.ownerId != null) - return false; - } else if (!ownerId.equals(other.ownerId)) - return false; - if (progress != other.progress) - return false; - if (region == null) { - if (other.region != null) - return false; - } else if (!region.equals(other.region)) - return false; - if (startTime == null) { - if (other.startTime != null) - return false; - } else if (!startTime.equals(other.startTime)) - return false; - if (status == null) { - if (other.status != null) - return false; - } else if (!status.equals(other.status)) - return false; - if (volumeId == null) { - if (other.volumeId != null) - return false; - } else if (!volumeId.equals(other.volumeId)) - return false; - if (volumeSize != other.volumeSize) - return false; - return true; - } - - @Override - public String toString() { - return "Snapshot [description=" + description + ", id=" + id + ", ownerAlias=" + ownerAlias + ", ownerId=" - + ownerId + ", progress=" + progress + ", startTime=" + startTime + ", status=" + status + ", volumeId=" - + volumeId + ", volumeSize=" + volumeSize + "]"; - } - - @Override - public int compareTo(Snapshot o) { - return startTime.compareTo(o.startTime); - } - -} http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/Subnet.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/Subnet.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/Subnet.java deleted file mode 100644 index 5e14ad8..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/Subnet.java +++ /dev/null @@ -1,253 +0,0 @@ -/* - * 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.ec2.domain; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Map; - -import com.google.common.base.Objects; -import com.google.common.base.Objects.ToStringHelper; -import com.google.common.collect.ImmutableMap; - -/** - * Amazon EC2 VPCs contain one or more subnets. - * - * @see <a href="http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Subnets.html" >doc</a> - * - * @author Adrian Cole - * @author Andrew Bayer - */ -public final class Subnet { - - public static enum State { - /** - * The subnet is available for use. - */ - AVAILABLE, - /** - * The subnet is not yet available for use. - */ - PENDING, UNRECOGNIZED; - public String value() { - return name().toLowerCase(); - } - - public static State fromValue(String v) { - try { - return valueOf(v.toUpperCase()); - } catch (IllegalArgumentException e) { - return UNRECOGNIZED; - } - } - } - - private final String subnetId; - private final State subnetState; - private final String vpcId; - private final String cidrBlock; - private final int availableIpAddressCount; - private final String availabilityZone; - private final Map<String, String> tags; - - private Subnet(String subnetId, State subnetState, String vpcId, String cidrBlock, int availableIpAddressCount, - String availabilityZone, ImmutableMap<String, String> tags) { - this.subnetId = checkNotNull(subnetId, "subnetId"); - this.subnetState = checkNotNull(subnetState, "subnetState for %s", subnetId); - this.vpcId = checkNotNull(vpcId, "vpcId for %s", subnetId); - this.cidrBlock = checkNotNull(cidrBlock, "cidrBlock for %s", subnetId); - this.availableIpAddressCount = availableIpAddressCount; - this.availabilityZone = checkNotNull(availabilityZone, "availabilityZone for %s", subnetId); - this.tags = checkNotNull(tags, "tags for %s", subnetId); - } - - /** - * The subnet ID, ex. subnet-c5473ba8 - */ - public String getSubnetId() { - return subnetId; - } - - /** - * The subnet state - either available or pending. - */ - public State getSubnetState() { - return subnetState; - } - - /** - * The vpc ID this subnet belongs to. - */ - public String getVpcId() { - return vpcId; - } - - /** - * The CIDR block for this subnet. - */ - public String getCidrBlock() { - return cidrBlock; - } - - /** - * The number of available IPs in this subnet. - */ - public int getAvailableIpAddressCount() { - return availableIpAddressCount; - } - - /** - * The availability zone this subnet is in. - */ - public String getAvailabilityZone() { - return availabilityZone; - } - - /** - * Tags that are attached to this subnet. - */ - public Map<String, String> getTags() { - return tags; - } - - @Override - public int hashCode() { - return Objects.hashCode(subnetId, vpcId, availabilityZone); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null || getClass() != obj.getClass()) - return false; - Subnet that = Subnet.class.cast(obj); - return Objects.equal(this.subnetId, that.subnetId) && Objects.equal(this.vpcId, that.vpcId) - && Objects.equal(this.availabilityZone, that.availabilityZone); - } - - @Override - public String toString() { - return string().toString(); - } - - private ToStringHelper string() { - return Objects.toStringHelper(this).omitNullValues().add("subnetId", subnetId).add("subnetState", subnetState) - .add("vpcId", vpcId).add("cidrBlock", cidrBlock).add("availableIpAddressCount", availableIpAddressCount) - .add("availabilityZone", availabilityZone).add("tags", tags); - } - - public static Builder builder() { - return new Builder(); - } - - public Builder toBuilder() { - return builder().from(this); - } - - public static final class Builder { - private String subnetId; - private State subnetState; - private String vpcId; - private String cidrBlock; - private int availableIpAddressCount; - private String availabilityZone; - private ImmutableMap.Builder<String, String> tags = ImmutableMap.<String, String> builder(); - - /** - * @see Subnet#getSubnetId() - */ - public Builder subnetId(String subnetId) { - this.subnetId = subnetId; - return this; - } - - /** - * @see Subnet#getState() - */ - public Builder subnetState(State subnetState) { - this.subnetState = subnetState; - return this; - } - - /** - * @see Subnet#getVpcId() - */ - public Builder vpcId(String vpcId) { - this.vpcId = vpcId; - return this; - } - - /** - * @see Subnet#getCidrBlock() - */ - public Builder cidrBlock(String cidrBlock) { - this.cidrBlock = cidrBlock; - return this; - } - - /** - * @see Subnet#getAvailableIpAddressCount() - */ - public Builder availableIpAddressCount(int availableIpAddressCount) { - this.availableIpAddressCount = availableIpAddressCount; - return this; - } - - /** - * @see Subnet#getAvailabilityZone() - */ - public Builder availabilityZone(String availabilityZone) { - this.availabilityZone = availabilityZone; - return this; - } - - /** - * @see Subnet#getTags() - */ - public Builder tags(Map<String, String> tags) { - this.tags.putAll(checkNotNull(tags, "tags")); - return this; - } - - /** - * @see Subnet#getTags() - */ - public Builder tag(String key) { - return tag(key, ""); - } - - /** - * @see Subnet#getTags() - */ - public Builder tag(String key, String value) { - this.tags.put(checkNotNull(key, "key"), checkNotNull(value, "value")); - return this; - } - - public Subnet build() { - return new Subnet(subnetId, subnetState, vpcId, cidrBlock, availableIpAddressCount, availabilityZone, - tags.build()); - } - - public Builder from(Subnet in) { - return this.subnetId(in.getSubnetId()).subnetState(in.getSubnetState()).vpcId(in.getVpcId()) - .cidrBlock(in.getCidrBlock()).availableIpAddressCount(in.getAvailableIpAddressCount()) - .availabilityZone(in.getAvailabilityZone()).tags(in.getTags()); - } - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/Tag.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/Tag.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/Tag.java deleted file mode 100644 index e640488..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/Tag.java +++ /dev/null @@ -1,196 +0,0 @@ -/* - * 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.ec2.domain; - -import static com.google.common.base.Preconditions.checkNotNull; - -import com.google.common.base.Objects; -import com.google.common.base.Objects.ToStringHelper; -import com.google.common.base.Optional; - -/** - * To help you manage your Amazon EC2 instances, images, and other Amazon EC2 - * resources, you can assign your own metadata to each resource in the form of - * tags. - * - * @see <a - * href="http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/Using_Tags.html" - * >doc</a> - * - * @author Adrian Cole - */ -public class Tag { - - /** - * Describes the well-known resource types that can be tagged. - */ - public interface ResourceType { - public static final String CUSTOMER_GATEWAY = "customer-gateway"; - public static final String DHCP_OPTIONS = "dhcp-options"; - public static final String IMAGE = "image"; - public static final String INSTANCE = "instance"; - public static final String INTERNET_GATEWAY = "internet-gateway"; - public static final String NETWORK_ACL = "network-acl"; - public static final String RESERVED_INSTANCES = "reserved-instances"; - public static final String ROUTE_TABLE = "route-table"; - public static final String SECURITY_GROUP = "security-group"; - public static final String SNAPSHOT = "snapshot"; - public static final String SPOT_INSTANCES_REQUEST = "spot-instances-request"; - public static final String SUBNET = "subnet"; - public static final String VOLUME = "volume"; - public static final String VPC = "vpc"; - public static final String VPN_CONNECTION = "vpn-connection"; - public static final String VPN_GATEWAY = "vpn-gateway"; - } - - public static Builder builder() { - return new Builder(); - } - - public Builder toBuilder() { - return builder().fromTag(this); - } - - public static class Builder { - - protected String resourceId; - protected String resourceType; - protected String key; - protected Optional<String> value = Optional.absent(); - - /** - * @see Tag#getResourceId() - */ - public Builder resourceId(String resourceId) { - this.resourceId = resourceId; - return this; - } - - /** - * @see Tag#getResourceType() - */ - public Builder resourceType(String resourceType) { - this.resourceType = resourceType; - return this; - } - - /** - * @see Tag#getKey() - */ - public Builder key(String key) { - this.key = key; - return this; - } - - /** - * @see TagGroup#getValue() - */ - public Builder value(String value) { - this.value = Optional.fromNullable(value); - return this; - } - - public Tag build() { - return new Tag(resourceId, resourceType, key, value); - } - - public Builder fromTag(Tag in) { - return this.resourceId(in.getResourceId()).resourceType(in.getResourceType()).key(in.getKey()) - .value(in.getValue().orNull()); - } - } - - protected final String resourceId; - protected final String resourceType; - protected final String key; - protected final Optional<String> value; - - protected Tag(String resourceId, String resourceType, String key, Optional<String> value) { - this.resourceId = checkNotNull(resourceId, "resourceId"); - this.resourceType = checkNotNull(resourceType, "resourceType"); - this.key = checkNotNull(key, "key"); - this.value = checkNotNull(value, "value"); - } - - /** - * The resource ID ex. i-erf235 - */ - public String getResourceId() { - return resourceId; - } - - /** - * The resource type. ex. customer-gateway, dhcp-options, image, instance, - * internet-gateway, network-acl, reserved-instances, route-table, - * security-group, snapshot, spot-instances-request, subnet, volume, vpc, - * vpn-connection, vpn-gateway - */ - public String getResourceType() { - return resourceType; - } - - /** - * The tag key. - */ - public String getKey() { - return key; - } - - /** - * The tag value. - */ - public Optional<String> getValue() { - return value; - } - - /** - * {@inheritDoc} - */ - @Override - public int hashCode() { - return Objects.hashCode(resourceId, key); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Tag other = (Tag) obj; - return Objects.equal(this.resourceId, other.resourceId) && Objects.equal(this.key, other.key); - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return string().toString(); - } - - protected ToStringHelper string() { - return Objects.toStringHelper(this).omitNullValues().add("resourceId", resourceId) - .add("resourceType", resourceType).add("key", key).add("value", value.orNull()); - } - -} http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/UserIdGroupPair.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/UserIdGroupPair.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/UserIdGroupPair.java deleted file mode 100644 index 657ad17..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/UserIdGroupPair.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * 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.ec2.domain; - -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * - * @see <a href= - * "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-ItemType-UserIdGroupPairType.html" - * /> - * @author Adrian Cole - */ -public class UserIdGroupPair implements Comparable<UserIdGroupPair> { - private final String userId; - private final String groupName; - - public UserIdGroupPair(String userId, String groupName) { - this.userId = checkNotNull(userId,"userId"); - this.groupName = checkNotNull(groupName,"groupName"); - } - - - @Override - public String toString() { - return "[userId=" + userId + ", groupName=" + groupName + "]"; - } - - - /** - * {@inheritDoc} - */ - public int compareTo(UserIdGroupPair o) { - return (this == o) ? 0 : getUserId().compareTo(o.getUserId()); - } - - - /** - * AWS User ID of an identity. Cannot be used when specifying a CIDR IP address. - */ - public String getUserId() { - return userId; - } - - - /** - * Name of the security group. Cannot be used when specifying a CIDR IP address. - */ - public String getGroupName() { - return groupName; - } - - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((groupName == null) ? 0 : groupName.hashCode()); - result = prime * result + ((userId == null) ? 0 : userId.hashCode()); - return result; - } - - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - UserIdGroupPair other = (UserIdGroupPair) obj; - if (groupName == null) { - if (other.groupName != null) - return false; - } else if (!groupName.equals(other.groupName)) - return false; - if (userId == null) { - if (other.userId != null) - return false; - } else if (!userId.equals(other.userId)) - return false; - return true; - } - -} http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/VirtualizationType.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/VirtualizationType.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/VirtualizationType.java deleted file mode 100644 index ce5dc33..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/VirtualizationType.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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.ec2.domain; - -import com.google.common.base.CaseFormat; - -/** - * Virtualization type of the image. - * - * @author Adrian Cole - */ -public enum VirtualizationType { - - PARAVIRTUAL, - - HVM, UNRECOGNIZED; - - public String value() { - return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name()); - } - - public String toString() { - return value(); - } - - public static VirtualizationType fromValue(String v) { - try { - return valueOf(CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_UNDERSCORE, v)); - } catch (IllegalArgumentException e) { - return UNRECOGNIZED; - } - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/Volume.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/Volume.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/Volume.java deleted file mode 100644 index a5ca30b..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/Volume.java +++ /dev/null @@ -1,296 +0,0 @@ -/* - * 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.ec2.domain; - -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.collect.Sets.newHashSet; - -import java.util.Date; -import java.util.Set; - -import org.jclouds.javax.annotation.Nullable; - -import com.google.common.base.CaseFormat; -import com.google.common.collect.ImmutableSet; - -/** - * - * @see <a href= - * "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CreateVolume.html" - * /> - * @author Adrian Cole, Andrei Savu - */ -public class Volume implements Comparable<Volume> { - - public Builder toBuilder() { - return builder().fromVolume(this); - } - - /** - * Specifies whether the instance's Amazon EBS volumes are stopped or terminated when the - * instance is shut down. - * - * @author Adrian Cole - */ - public static enum InstanceInitiatedShutdownBehavior { - STOP, TERMINATE, UNRECOGNIZED; - public String value() { - return name().toLowerCase(); - } - - @Override - public String toString() { - return value(); - } - - public static InstanceInitiatedShutdownBehavior fromValue(String status) { - try { - return valueOf(checkNotNull(status, "status").toUpperCase()); - } catch (IllegalArgumentException e) { - return UNRECOGNIZED; - } - } - } - - 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 Builder(); - } - - public static class Builder { - private String region; - private String id; - private int size; - @Nullable - private String snapshotId; - private String availabilityZone; - private Status status; - private Date createTime; - private Set<Attachment> attachments = ImmutableSet.of(); - - public Builder region(String region) { - this.region = region; - return this; - } - - public Builder id(String id) { - this.id = id; - return this; - } - - public Builder size(int size) { - this.size = size; - return this; - } - - public Builder snapshotId(String snapshotId) { - this.snapshotId = snapshotId; - return this; - } - - public Builder availabilityZone(String availabilityZone) { - this.availabilityZone = availabilityZone; - return this; - } - - public Builder status(Status status) { - this.status = status; - return this; - } - - public Builder createTime(Date createTime) { - this.createTime = createTime; - return this; - } - - public Builder attachments(Attachment... attachments) { - this.attachments = newHashSet(attachments); - return this; - } - - public Builder attachments(Set<Attachment> attachments) { - this.attachments = ImmutableSet.copyOf(attachments); - return this; - } - - public Volume build() { - return new Volume(region, id, size, snapshotId, availabilityZone, status, createTime, attachments); - } - - public Builder fromVolume(Volume in) { - return region(in.region).id(in.id).size(in.size).snapshotId(in.snapshotId) - .availabilityZone(in.availabilityZone).status(in.status).createTime(in.createTime) - .attachments(in.attachments); - } - } - - private final String region; - private final String id; - private final int size; - @Nullable - private final String snapshotId; - private final String availabilityZone; - private final Status status; - private final Date createTime; - private final Set<Attachment> attachments; - - public Volume(String region, String id, int size, String snapshotId, String availabilityZone, Volume.Status status, - Date createTime, Iterable<Attachment> attachments) { - this.region = checkNotNull(region, "region"); - this.id = id; - this.size = size; - this.snapshotId = snapshotId; - this.availabilityZone = availabilityZone; - this.status = status; - this.createTime = createTime; - this.attachments = ImmutableSet.copyOf(attachments); - } - - /** - * To be removed in jclouds 1.6 <h4>Warning</h4> - * - * Especially on EC2 clones that may not support regions, this value is fragile. Consider - * alternate means to determine context. - */ - @Deprecated - public String getRegion() { - return region; - } - - public String getId() { - return id; - } - - public int getSize() { - return size; - } - - public String getSnapshotId() { - return snapshotId; - } - - public String getAvailabilityZone() { - return availabilityZone; - } - - public Status getStatus() { - return status; - } - - public Date getCreateTime() { - return createTime; - } - - public Set<Attachment> getAttachments() { - return attachments; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((attachments == null) ? 0 : attachments.hashCode()); - result = prime * result + ((availabilityZone == null) ? 0 : availabilityZone.hashCode()); - result = prime * result + ((createTime == null) ? 0 : createTime.hashCode()); - result = prime * result + ((id == null) ? 0 : id.hashCode()); - result = prime * result + ((region == null) ? 0 : region.hashCode()); - result = prime * result + size; - result = prime * result + ((snapshotId == null) ? 0 : snapshotId.hashCode()); - result = prime * result + ((status == null) ? 0 : status.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Volume other = (Volume) obj; - if (attachments == null) { - if (other.attachments != null) - return false; - } else if (!attachments.equals(other.attachments)) - return false; - if (availabilityZone == null) { - if (other.availabilityZone != null) - return false; - } else if (!availabilityZone.equals(other.availabilityZone)) - return false; - if (createTime == null) { - if (other.createTime != null) - return false; - } else if (!createTime.equals(other.createTime)) - return false; - if (id == null) { - if (other.id != null) - return false; - } else if (!id.equals(other.id)) - return false; - if (region == null) { - if (other.region != null) - return false; - } else if (!region.equals(other.region)) - return false; - if (size != other.size) - return false; - if (snapshotId == null) { - if (other.snapshotId != null) - return false; - } else if (!snapshotId.equals(other.snapshotId)) - return false; - if (status == null) { - if (other.status != null) - return false; - } else if (!status.equals(other.status)) - return false; - return true; - } - - @Override - public int compareTo(Volume that) { - return id.compareTo(that.id); - } - - @Override - public String toString() { - return "Volume [attachments=" + attachments + ", availabilityZone=" + availabilityZone + ", createTime=" - + createTime + ", id=" + id + ", region=" + region + ", size=" + size + ", snapshotId=" + snapshotId - + ", status=" + status + "]"; - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/features/AMIApi.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/features/AMIApi.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/features/AMIApi.java deleted file mode 100644 index bdc7756..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/features/AMIApi.java +++ /dev/null @@ -1,366 +0,0 @@ -/* - * 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.ec2.features; - -import static org.jclouds.aws.reference.FormParameters.ACTION; - -import java.util.Map; -import java.util.Set; - -import javax.inject.Named; -import javax.ws.rs.FormParam; -import javax.ws.rs.POST; -import javax.ws.rs.Path; - -import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404; -import org.jclouds.aws.filters.FormSigner; -import org.jclouds.ec2.binders.BindFiltersToIndexedFormParams; -import org.jclouds.ec2.binders.BindUserGroupsToIndexedFormParams; -import org.jclouds.ec2.binders.BindUserIdsToIndexedFormParams; -import org.jclouds.ec2.domain.Image; -import org.jclouds.ec2.domain.Image.EbsBlockDevice; -import org.jclouds.ec2.domain.Permission; -import org.jclouds.ec2.options.CreateImageOptions; -import org.jclouds.ec2.options.DescribeImagesOptions; -import org.jclouds.ec2.options.RegisterImageBackedByEbsOptions; -import org.jclouds.ec2.options.RegisterImageOptions; -import org.jclouds.ec2.xml.BlockDeviceMappingHandler; -import org.jclouds.ec2.xml.DescribeImagesResponseHandler; -import org.jclouds.ec2.xml.ImageIdHandler; -import org.jclouds.ec2.xml.PermissionHandler; -import org.jclouds.javax.annotation.Nullable; -import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull; -import org.jclouds.rest.annotations.BinderParam; -import org.jclouds.rest.annotations.EndpointParam; -import org.jclouds.rest.annotations.Fallback; -import org.jclouds.rest.annotations.FormParams; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.VirtualHost; -import org.jclouds.rest.annotations.XMLResponseParser; - -import com.google.common.collect.Multimap; - -/** - * Provides access to AMI Services. - * <p/> - * - * @author Adrian Cole - */ -@RequestFilters(FormSigner.class) -@VirtualHost -public interface AMIApi { - - /** - * Returns information about AMIs, AKIs, and ARIs. This includes image type, product codes, - * architecture, and kernel and RAM disk IDs. Images available to you include public images, - * private images that you own, and private images owned by other users for which you have - * explicit launch permissions. - * - * @param region - * AMIs are tied to the Region where its files are located within Amazon S3. - * @see InstanceApi#describeInstances - * @see #describeImageAttribute - * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeImages.html" - * /> - * @see DescribeImagesOptions - */ - @Named("DescribeImages") - @POST - @Path("/") - @FormParams(keys = ACTION, values = "DescribeImages") - @XMLResponseParser(DescribeImagesResponseHandler.class) - @Fallback(EmptySetOnNotFoundOr404.class) - Set<? extends Image> describeImagesInRegion( - @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, - DescribeImagesOptions... options); - - /** - * Returns information about AMIs, AKIs, and ARIs. This includes image type, product codes, - * architecture, and kernel and RAM disk IDs. Images available to you include public images, - * private images that you own, and private images owned by other users for which you have - * explicit launch permissions. - * - * @param region - * AMIs are tied to the Region where its files are located within Amazon S3. - * @param filter - * Multimap of filter key/values. - * @see InstanceApi#describeInstances - * @see #describeImageAttribute - * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeImages.html" - * /> - * @see DescribeImagesOptions - */ - @Named("DescribeImages") - @POST - @Path("/") - @FormParams(keys = ACTION, values = "DescribeImages") - @XMLResponseParser(DescribeImagesResponseHandler.class) - @Fallback(EmptySetOnNotFoundOr404.class) - Set<? extends Image> describeImagesInRegionWithFilter( - @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, - @BinderParam(BindFiltersToIndexedFormParams.class) Multimap<String, String> filter, - DescribeImagesOptions... options); - - /** - * Creates an AMI that uses an Amazon EBS root device from a "running" or "stopped" instance. - * - * @param region - * AMIs are tied to the Region where its files are located within Amazon S3. - * @param name - * The name of the AMI that was provided during image creation. 3-128 alphanumeric - * characters, parenthesis (()), commas (,), slashes (/), dashes (-), or underscores(_) - * @param instanceId - * The ID of the instance. - * @return imageId - * - * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeImages.html" - * /> - * @see CreateImageOptions - * @see InstanceApi#runInstances - * @see InstanceApi#describeInstances - * @see InstanceApi#terminateInstances - * @see <a href= - * "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CreateImage.html" - * /> - */ - @Named("CreateImage") - @POST - @Path("/") - @FormParams(keys = ACTION, values = "CreateImage") - @XMLResponseParser(ImageIdHandler.class) - String createImageInRegion( - @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, - @FormParam("Name") String name, @FormParam("InstanceId") String instanceId, CreateImageOptions... options); - - /** - * - * Deregisters the specified AMI. Once deregistered, the AMI cannot be used to launch new - * instances. - * - * @param region - * AMIs are tied to the Region where its files are located within Amazon S3. - * @param imageId - * Unique ID of the AMI which was assigned during registration. To register an AMI, use - * RegisterImage. To view the AMI IDs of AMIs that belong to your identity. use - * DescribeImages. - * - * @see #describeImages - * @see #registerImage - * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DeregisterImage.html" - * /> - */ - @Named("DeregisterImage") - @POST - @Path("/") - @FormParams(keys = ACTION, values = "DeregisterImage") - void deregisterImageInRegion( - @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, - @FormParam("ImageId") String imageId); - - /** - * Registers an AMI with Amazon EC2. Images must be registered before they can be launched. To - * launch instances, use the {@link InstanceApi#runInstances} operation. - * <p/> - * Each AMI is associated with an unique ID which is provided by the Amazon EC2 service through - * this operation. If needed, you can deregister an AMI at any time. - * <p/> - * <h3>Note</h3> Any modifications to an AMI backed by Amazon S3 invalidates this registration. - * If you make changes to an image, deregister the previous image and register the new image. - * - * @param region - * AMIs are tied to the Region where its files are located within Amazon S3. - * @param name - * The name of the AMI that was provided during image creation. 3-128 alphanumeric - * characters, parenthesis (()), commas (,), slashes (/), dashes (-), or underscores(_) - * @param pathToManifest - * Full path to your AMI manifest in Amazon S3 storage. - * @param options - * Options to specify metadata such as architecture or secondary volumes to be - * associated with this image. - * @return imageId - * - * @see #describeImages - * @see #deregisterImage - * @see <a href= - * "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-RegisterImage.html" - * /> - */ - @Named("RegisterImage") - @POST - @Path("/") - @FormParams(keys = ACTION, values = "RegisterImage") - @XMLResponseParser(ImageIdHandler.class) - String registerImageFromManifestInRegion( - @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, - @FormParam("Name") String imageName, @FormParam("ImageLocation") String pathToManifest, - RegisterImageOptions... options); - - /** - * Registers an AMI with Amazon EC2. Images must be registered before they can be launched. To - * launch instances, use the {@link InstanceApi#runInstances} operation. The root device name - * is /dev/sda1 - * <p/> - * Each AMI is associated with an unique ID which is provided by the Amazon EC2 service through - * this operation. If needed, you can deregister an AMI at any time. - * <p/> - * <h3>Note</h3> AMIs backed by Amazon EBS are automatically registered when you create the - * image. However, you can use this to register a snapshot of an instance backed by Amazon EBS. - * <p/> - * Amazon EBS snapshots are not guaranteed to be bootable. - * - * @param region - * AMIs are tied to the Region where its files are located within Amazon S3. - * @param name - * The name of the AMI that was provided during image creation. 3-128 alphanumeric - * characters, parenthesis (()), commas (,), slashes (/), dashes (-), or underscores(_) - * - * @param ebsSnapshotId - * The id of the root snapshot (e.g., snap-6eba6e06). - * @param options - * Options to specify metadata such as architecture or secondary volumes to be - * associated with this image. - * @return imageId - * - * @see #describeImages - * @see #deregisterImage - * @see <a href= - * "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-RegisterImage.html" - * /> - */ - @Named("RegisterImage") - @POST - @Path("/") - @FormParams(keys = { ACTION, "RootDeviceName", "BlockDeviceMapping.0.DeviceName" }, values = { "RegisterImage", - "/dev/sda1", "/dev/sda1" }) - @XMLResponseParser(ImageIdHandler.class) - String registerUnixImageBackedByEbsInRegion( - @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, - @FormParam("Name") String imageName, - @FormParam("BlockDeviceMapping.0.Ebs.SnapshotId") String ebsSnapshotId, - RegisterImageBackedByEbsOptions... options); - - /** - * Resets the {@code launchPermission}s on an AMI. - * - * @param region - * AMIs are tied to the Region where its files are located within Amazon S3. - * @param imageId - * ID of the AMI on which the attribute will be reset. - * - * @see #addLaunchPermissionsToImage - * @see #describeImageAttribute - * @see #removeProductCodesFromImage - * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ResetImageAttribute.html" - * /> - */ - @Named("ResetImageAttribute") - @POST - @Path("/") - @FormParams(keys = { ACTION, "Attribute" }, values = { "ResetImageAttribute", "launchPermission" }) - void resetLaunchPermissionsOnImageInRegion( - @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, - @FormParam("ImageId") String imageId); - - /** - * Adds {@code launchPermission}s to an AMI. - * - * @param region - * AMIs are tied to the Region where its files are located within Amazon S3. - * @param userIds - * AWS Access Key ID. - * @param userGroups - * Name of the groups. Currently supports \"all.\"" - * @param imageId - * The AMI ID. - * - * @see #removeLaunchPermissionsFromImage - * @see #describeImageAttribute - * @see #resetImageAttribute - * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyImageAttribute.html" - * /> - */ - @Named("ModifyImageAttribute") - @POST - @Path("/") - @FormParams(keys = { ACTION, "OperationType", "Attribute" }, values = { "ModifyImageAttribute", "add", - "launchPermission" }) - void addLaunchPermissionsToImageInRegion( - @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, - @BinderParam(BindUserIdsToIndexedFormParams.class) Iterable<String> userIds, - @BinderParam(BindUserGroupsToIndexedFormParams.class) Iterable<String> userGroups, - @FormParam("ImageId") String imageId); - - /** - * @see AMIApi#removeLaunchPermissionsToImageInRegion - */ - @Named("ModifyImageAttribute") - @POST - @Path("/") - @FormParams(keys = { ACTION, "OperationType", "Attribute" }, values = { "ModifyImageAttribute", "remove", - "launchPermission" }) - void removeLaunchPermissionsFromImageInRegion( - @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, - @BinderParam(BindUserIdsToIndexedFormParams.class) Iterable<String> userIds, - @BinderParam(BindUserGroupsToIndexedFormParams.class) Iterable<String> userGroups, - @FormParam("ImageId") String imageId); - - /** - * Returns the {@link Permission}s of an image. - * - * @param region - * AMIs are tied to the Region where its files are located within Amazon S3. - * @param imageId - * The ID of the AMI for which an attribute will be described - * @see #describeImages - * @see #modifyImageAttribute - * @see #resetImageAttribute - * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeImageAttribute.html" - * /> - * @see DescribeImagesOptions - */ - @Named("DescribeImageAttribute") - @POST - @Path("/") - @FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeImageAttribute", "launchPermission" }) - @XMLResponseParser(PermissionHandler.class) - Permission getLaunchPermissionForImageInRegion( - @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, - @FormParam("ImageId") String imageId); - - /** - * Returns a map of device name to block device for the image. - * - * @param region - * AMIs are tied to the Region where its files are located within Amazon S3. - * @param imageId - * The ID of the AMI for which an attribute will be described - * @see #describeImages - * @see #modifyImageAttribute - * @see #resetImageAttribute - * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeImageAttribute.html" - * /> - * @see DescribeImagesOptions - */ - @Named("DescribeImageAttribute") - @POST - @Path("/") - @FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeImageAttribute", "blockDeviceMapping" }) - @XMLResponseParser(BlockDeviceMappingHandler.class) - Map<String, EbsBlockDevice> getBlockDeviceMappingsForImageInRegion( - @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, - @FormParam("ImageId") String imageId); -} http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/features/AvailabilityZoneAndRegionApi.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/features/AvailabilityZoneAndRegionApi.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/features/AvailabilityZoneAndRegionApi.java deleted file mode 100644 index 7de7a48..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/features/AvailabilityZoneAndRegionApi.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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.ec2.features; - -import static org.jclouds.aws.reference.FormParameters.ACTION; - -import java.net.URI; -import java.util.Map; -import java.util.Set; - -import javax.inject.Named; -import javax.ws.rs.POST; -import javax.ws.rs.Path; - -import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404; -import org.jclouds.aws.filters.FormSigner; -import org.jclouds.ec2.domain.AvailabilityZoneInfo; -import org.jclouds.ec2.options.DescribeAvailabilityZonesOptions; -import org.jclouds.ec2.options.DescribeRegionsOptions; -import org.jclouds.ec2.xml.DescribeAvailabilityZonesResponseHandler; -import org.jclouds.ec2.xml.DescribeRegionsResponseHandler; -import org.jclouds.javax.annotation.Nullable; -import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull; -import org.jclouds.rest.annotations.EndpointParam; -import org.jclouds.rest.annotations.Fallback; -import org.jclouds.rest.annotations.FormParams; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.VirtualHost; -import org.jclouds.rest.annotations.XMLResponseParser; - -/** - * Provides access to EC2 Availability Zones and Regions via their REST API. - * <p/> - * - * @author Adrian Cole - */ -@RequestFilters(FormSigner.class) -@VirtualHost -public interface AvailabilityZoneAndRegionApi { - - /** - * Displays Availability Zones that are currently available to the identity and their states. - * - * @see InstanceApi#runInstances - * @see #describeRegions - * - * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeAvailabilityZones.html" - * /> - */ - @Named("DescribeAvailabilityZones") - @POST - @Path("/") - @FormParams(keys = ACTION, values = "DescribeAvailabilityZones") - @XMLResponseParser(DescribeAvailabilityZonesResponseHandler.class) - @Fallback(EmptySetOnNotFoundOr404.class) - Set<AvailabilityZoneInfo> describeAvailabilityZonesInRegion( - @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, - DescribeAvailabilityZonesOptions... options); - - /** - * Describes Regions that are currently available to the identity. - * - * @see InstanceApi#runInstances - * @see #describeAvailabilityZones - * - * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeRegions.html" - * /> - */ - @Named("DescribeRegions") - @POST - @Path("/") - @FormParams(keys = ACTION, values = "DescribeRegions") - @XMLResponseParser(DescribeRegionsResponseHandler.class) - Map<String, URI> describeRegions(DescribeRegionsOptions... options); - -}
