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/compute/strategy/EC2PopulateDefaultLoginCredentialsForImageStrategy.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/compute/strategy/EC2PopulateDefaultLoginCredentialsForImageStrategy.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/compute/strategy/EC2PopulateDefaultLoginCredentialsForImageStrategy.java deleted file mode 100644 index c954661..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/compute/strategy/EC2PopulateDefaultLoginCredentialsForImageStrategy.java +++ /dev/null @@ -1,75 +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.compute.strategy; - -import static com.google.common.base.Preconditions.checkArgument; - -import java.util.Map; - -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import org.jclouds.compute.domain.OsFamily; -import org.jclouds.compute.strategy.impl.ReturnCredentialsBoundToImage; -import org.jclouds.domain.Credentials; -import org.jclouds.domain.LoginCredentials; -import org.jclouds.domain.LoginCredentials.Builder; -import org.jclouds.ec2.domain.Image; -import org.jclouds.javax.annotation.Nullable; - -import com.google.common.collect.ImmutableMap; - -/** - * @author Oleksiy Yarmula - */ -@Singleton -public class EC2PopulateDefaultLoginCredentialsForImageStrategy extends ReturnCredentialsBoundToImage { - public EC2PopulateDefaultLoginCredentialsForImageStrategy() { - this(null, ImmutableMap.<String, Credentials> of(), ImmutableMap.<OsFamily, LoginCredentials>of()); - } - - @Inject - public EC2PopulateDefaultLoginCredentialsForImageStrategy(@Nullable @Named("image") LoginCredentials creds, - Map<String, Credentials> credentialStore, Map<OsFamily, LoginCredentials> osFamilyToCredentials) { - super(creds, credentialStore, osFamilyToCredentials); - } - - @Override - public LoginCredentials apply(Object resourceToAuthenticate) { - if (creds != null) - return creds; - Builder credentials = LoginCredentials.builder().user("root"); - if (resourceToAuthenticate != null) { - String owner = null; - if (resourceToAuthenticate instanceof Image) { - owner = Image.class.cast(resourceToAuthenticate).getImageOwnerId(); - } else if (resourceToAuthenticate instanceof org.jclouds.compute.domain.Image) { - owner = org.jclouds.compute.domain.Image.class.cast(resourceToAuthenticate).getUserMetadata().get("owner"); - } - checkArgument(owner != null, "Resource must be an image (for EC2)"); - // canonical/alestic images use the ubuntu user to login - if (owner.matches("063491364108|099720109477")) { - credentials.user("ubuntu"); - // http://typepad.com/2010/09/introducing-amazon-linux-ami.html - } else if (owner.equals("137112412989")) { - credentials.user("ec2-user"); - } - } - return credentials.build(); - } -}
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/compute/strategy/EC2RebootNodeStrategy.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/compute/strategy/EC2RebootNodeStrategy.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/compute/strategy/EC2RebootNodeStrategy.java deleted file mode 100644 index c8cafc0..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/compute/strategy/EC2RebootNodeStrategy.java +++ /dev/null @@ -1,53 +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.compute.strategy; - -import javax.inject.Inject; -import javax.inject.Singleton; - -import org.jclouds.aws.util.AWSUtils; -import org.jclouds.compute.domain.NodeMetadata; -import org.jclouds.compute.strategy.GetNodeMetadataStrategy; -import org.jclouds.compute.strategy.RebootNodeStrategy; -import org.jclouds.ec2.EC2Api; -import org.jclouds.ec2.features.InstanceApi; - -/** - * - * @author Adrian Cole - */ -@Singleton -public class EC2RebootNodeStrategy implements RebootNodeStrategy { - private final InstanceApi client; - private final GetNodeMetadataStrategy getNode; - - @Inject - protected EC2RebootNodeStrategy(EC2Api client, GetNodeMetadataStrategy getNode) { - this.client = client.getInstanceApi().get(); - this.getNode = getNode; - } - - @Override - public NodeMetadata rebootNode(String id) { - String[] parts = AWSUtils.parseHandle(id); - String region = parts[0]; - String instanceId = parts[1]; - client.rebootInstancesInRegion(region, instanceId); - return getNode.getNode(id); - } - -} 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/compute/strategy/EC2ResumeNodeStrategy.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/compute/strategy/EC2ResumeNodeStrategy.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/compute/strategy/EC2ResumeNodeStrategy.java deleted file mode 100644 index 5ecccfc..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/compute/strategy/EC2ResumeNodeStrategy.java +++ /dev/null @@ -1,53 +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.compute.strategy; - -import javax.inject.Inject; -import javax.inject.Singleton; - -import org.jclouds.aws.util.AWSUtils; -import org.jclouds.compute.domain.NodeMetadata; -import org.jclouds.compute.strategy.GetNodeMetadataStrategy; -import org.jclouds.compute.strategy.ResumeNodeStrategy; -import org.jclouds.ec2.EC2Api; -import org.jclouds.ec2.features.InstanceApi; - -/** - * - * @author Adrian Cole - */ -@Singleton -public class EC2ResumeNodeStrategy implements ResumeNodeStrategy { - private final InstanceApi client; - private final GetNodeMetadataStrategy getNode; - - @Inject - protected EC2ResumeNodeStrategy(EC2Api client, GetNodeMetadataStrategy getNode) { - this.client = client.getInstanceApi().get(); - this.getNode = getNode; - } - - @Override - public NodeMetadata resumeNode(String id) { - String[] parts = AWSUtils.parseHandle(id); - String region = parts[0]; - String instanceId = parts[1]; - client.startInstancesInRegion(region, instanceId); - return getNode.getNode(id); - } - -} 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/compute/strategy/EC2SuspendNodeStrategy.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/compute/strategy/EC2SuspendNodeStrategy.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/compute/strategy/EC2SuspendNodeStrategy.java deleted file mode 100644 index cf9edd9..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/compute/strategy/EC2SuspendNodeStrategy.java +++ /dev/null @@ -1,53 +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.compute.strategy; - -import javax.inject.Inject; -import javax.inject.Singleton; - -import org.jclouds.aws.util.AWSUtils; -import org.jclouds.compute.domain.NodeMetadata; -import org.jclouds.compute.strategy.GetNodeMetadataStrategy; -import org.jclouds.compute.strategy.SuspendNodeStrategy; -import org.jclouds.ec2.EC2Api; -import org.jclouds.ec2.features.InstanceApi; - -/** - * - * @author Adrian Cole - */ -@Singleton -public class EC2SuspendNodeStrategy implements SuspendNodeStrategy { - private final InstanceApi client; - private final GetNodeMetadataStrategy getNode; - - @Inject - protected EC2SuspendNodeStrategy(EC2Api client, GetNodeMetadataStrategy getNode) { - this.client = client.getInstanceApi().get(); - this.getNode = getNode; - } - - @Override - public NodeMetadata suspendNode(String id) { - String[] parts = AWSUtils.parseHandle(id); - String region = parts[0]; - String instanceId = parts[1]; - client.stopInstancesInRegion(region, true, instanceId); - return getNode.getNode(id); - } - -} 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/compute/strategy/ReviseParsedImage.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/compute/strategy/ReviseParsedImage.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/compute/strategy/ReviseParsedImage.java deleted file mode 100644 index 3df595b..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/compute/strategy/ReviseParsedImage.java +++ /dev/null @@ -1,44 +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.compute.strategy; - -import javax.inject.Singleton; - -import org.jclouds.compute.domain.ImageBuilder; -import org.jclouds.compute.domain.OperatingSystem; -import org.jclouds.compute.domain.OsFamily; - -import com.google.inject.ImplementedBy; - -/** - * - * @author Adrian Cole - */ -@ImplementedBy(ReviseParsedImage.NoopReviseParsedImage.class) -public interface ReviseParsedImage { - void reviseParsedImage(org.jclouds.ec2.domain.Image from, ImageBuilder builder, OsFamily family, - OperatingSystem.Builder osBuilder); - - @Singleton - public static class NoopReviseParsedImage implements ReviseParsedImage { - - @Override - public void reviseParsedImage(org.jclouds.ec2.domain.Image from, ImageBuilder builder, OsFamily family, - OperatingSystem.Builder osBuilder) { - } - } -} 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/compute/suppliers/EC2HardwareSupplier.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/compute/suppliers/EC2HardwareSupplier.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/compute/suppliers/EC2HardwareSupplier.java deleted file mode 100644 index 2a4daab..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/compute/suppliers/EC2HardwareSupplier.java +++ /dev/null @@ -1,46 +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.compute.suppliers; - -import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.c1_medium; -import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.c1_xlarge; -import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m1_large; -import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m1_small; -import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m1_xlarge; - -import java.util.Set; - -import javax.inject.Singleton; - -import org.jclouds.compute.domain.Hardware; - -import com.google.common.base.Supplier; -import com.google.common.collect.ImmutableSet; - -/** - * - * @author Adrian Cole - */ -@Singleton -public class EC2HardwareSupplier implements Supplier<Set<? extends Hardware>> { - - @Override - public Set<? extends Hardware> get() { - return ImmutableSet.<Hardware> of(m1_small().build(), c1_medium().build(), c1_xlarge() - .build(), m1_large().build(), m1_xlarge().build()); - } -} 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/compute/suppliers/EC2ImageSupplier.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/compute/suppliers/EC2ImageSupplier.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/compute/suppliers/EC2ImageSupplier.java deleted file mode 100644 index 810b602..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/compute/suppliers/EC2ImageSupplier.java +++ /dev/null @@ -1,120 +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.compute.suppliers; - -import static com.google.common.collect.Iterables.filter; -import static com.google.common.collect.Iterables.transform; -import static org.jclouds.ec2.options.DescribeImagesOptions.Builder.ownedBy; -import static org.jclouds.ec2.reference.EC2Constants.PROPERTY_EC2_AMI_OWNERS; - -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import javax.annotation.Resource; -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import org.jclouds.compute.domain.Image; -import org.jclouds.compute.reference.ComputeServiceConstants; -import org.jclouds.ec2.compute.domain.RegionAndName; -import org.jclouds.ec2.compute.functions.EC2ImageParser; -import org.jclouds.ec2.compute.functions.ImagesToRegionAndIdMap; -import org.jclouds.ec2.compute.strategy.DescribeImagesParallel; -import org.jclouds.ec2.options.DescribeImagesOptions; -import org.jclouds.location.Region; -import org.jclouds.logging.Logger; - -import com.google.common.base.Predicates; -import com.google.common.base.Supplier; -import com.google.common.cache.LoadingCache; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableMap.Builder; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Sets; - -/** - * - * @author Adrian Cole - */ -@Singleton -public class EC2ImageSupplier implements Supplier<Set<? extends Image>> { - @Resource - @Named(ComputeServiceConstants.COMPUTE_LOGGER) - protected Logger logger = Logger.NULL; - - private final Supplier<Set<String>> regions; - private final DescribeImagesParallel describer; - private final String[] amiOwners; - private final EC2ImageParser parser; - private final Supplier<LoadingCache<RegionAndName, ? extends Image>> cache; - - @Inject - protected EC2ImageSupplier(@Region Supplier<Set<String>> regions, DescribeImagesParallel describer, - @Named(PROPERTY_EC2_AMI_OWNERS) String[] amiOwners, Supplier<LoadingCache<RegionAndName, ? extends Image>> cache, - EC2ImageParser parser) { - this.regions = regions; - this.describer = describer; - this.amiOwners = amiOwners; - this.cache = cache; - this.parser = parser; - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public Set<? extends Image> get() { - if (amiOwners.length == 0) { - logger.debug(">> no owners specified, skipping image parsing"); - return ImmutableSet.of(); - - } else { - logger.debug(">> providing images"); - - Iterable<Entry<String, DescribeImagesOptions>> queries = getDescribeQueriesForOwnersInRegions(regions.get(), - amiOwners); - - Iterable<? extends Image> parsedImages = ImmutableSet.copyOf(filter(transform(describer.apply(queries), parser), Predicates - .notNull())); - - Map<RegionAndName, ? extends Image> imageMap = ImagesToRegionAndIdMap.imagesToMap(parsedImages); - cache.get().invalidateAll(); - cache.get().asMap().putAll((Map)imageMap); - logger.debug("<< images(%d)", imageMap.size()); - - return Sets.newLinkedHashSet(imageMap.values()); - } - } - - public Iterable<Entry<String, DescribeImagesOptions>> getDescribeQueriesForOwnersInRegions(Set<String> regions, - String[] amiOwners) { - DescribeImagesOptions options = getOptionsForOwners(amiOwners); - Builder<String, DescribeImagesOptions> builder = ImmutableMap.builder(); - for (String region : regions) - builder.put(region, options); - return builder.build().entrySet(); - } - - public DescribeImagesOptions getOptionsForOwners(String... amiOwners) { - DescribeImagesOptions options; - if (amiOwners.length == 1 && amiOwners[0].equals("*")) - options = new DescribeImagesOptions(); - else - options = ownedBy(amiOwners); - return options; - } -} 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/compute/suppliers/RegionAndNameToImageSupplier.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/compute/suppliers/RegionAndNameToImageSupplier.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/compute/suppliers/RegionAndNameToImageSupplier.java deleted file mode 100644 index 87dce20..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/compute/suppliers/RegionAndNameToImageSupplier.java +++ /dev/null @@ -1,53 +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.compute.suppliers; - -import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL; - -import java.util.concurrent.TimeUnit; - -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import org.jclouds.compute.domain.Image; -import org.jclouds.ec2.compute.domain.RegionAndName; - -import com.google.common.base.Supplier; -import com.google.common.cache.CacheBuilder; -import com.google.common.cache.CacheLoader; -import com.google.common.cache.LoadingCache; - -/** - * - * @author Adrian Cole - */ -@Singleton -public class RegionAndNameToImageSupplier implements Supplier<LoadingCache<RegionAndName, ? extends Image>> { - private final LoadingCache<RegionAndName, Image> cache; - - @Inject - protected RegionAndNameToImageSupplier(CacheLoader<RegionAndName, Image> regionAndIdToImage, - @Named(PROPERTY_SESSION_INTERVAL) long expirationSecs) { - cache = CacheBuilder.newBuilder().expireAfterWrite(expirationSecs, TimeUnit.SECONDS).build(regionAndIdToImage); - } - - @Override - public LoadingCache<RegionAndName, ? extends Image> get() { - return cache; - } -} 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/compute/util/EC2ComputeUtils.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/compute/util/EC2ComputeUtils.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/compute/util/EC2ComputeUtils.java deleted file mode 100644 index bb21e94..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/compute/util/EC2ComputeUtils.java +++ /dev/null @@ -1,35 +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.compute.util; - -import javax.inject.Singleton; - -import org.jclouds.domain.Location; -import org.jclouds.domain.LocationScope; - -/** - * - * @author Adrian Cole - */ -@Singleton -public class EC2ComputeUtils { - - public static String getZoneFromLocationOrNull(Location location) { - return location.getScope() == LocationScope.ZONE ? location.getId() : null; - } - -} 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/config/BaseEC2HttpApiModule.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/config/BaseEC2HttpApiModule.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/config/BaseEC2HttpApiModule.java deleted file mode 100644 index e52ca01..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/config/BaseEC2HttpApiModule.java +++ /dev/null @@ -1,61 +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.config; - - - - -import org.jclouds.aws.config.FormSigningHttpApiModule; -import org.jclouds.ec2.EC2Api; -import org.jclouds.ec2.suppliers.DescribeAvailabilityZonesInRegion; -import org.jclouds.ec2.suppliers.DescribeRegionsForRegionURIs; -import org.jclouds.location.config.LocationModule; -import org.jclouds.location.suppliers.RegionIdToURISupplier; -import org.jclouds.location.suppliers.RegionIdToZoneIdsSupplier; -import org.jclouds.location.suppliers.RegionIdsSupplier; -import org.jclouds.location.suppliers.ZoneIdToURISupplier; -import org.jclouds.location.suppliers.ZoneIdsSupplier; -import org.jclouds.location.suppliers.derived.RegionIdsFromRegionIdToURIKeySet; -import org.jclouds.location.suppliers.derived.ZoneIdToURIFromJoinOnRegionIdToURI; -import org.jclouds.location.suppliers.derived.ZoneIdsFromRegionIdToZoneIdsValues; -import org.jclouds.rest.ConfiguresHttpApi; - -import com.google.inject.Scopes; - -/** - * Configures the EC2 connection. - * - * @author Adrian Cole (EDIT: Nick Terry [email protected]) - */ -@ConfiguresHttpApi -public abstract class BaseEC2HttpApiModule<A extends EC2Api> extends - FormSigningHttpApiModule<A> { - - protected BaseEC2HttpApiModule(Class<A> api) { - super(api); - } - - @Override - protected void installLocations() { - install(new LocationModule()); - bind(RegionIdToZoneIdsSupplier.class).to(DescribeAvailabilityZonesInRegion.class).in(Scopes.SINGLETON); - bind(RegionIdToURISupplier.class).to(DescribeRegionsForRegionURIs.class).in(Scopes.SINGLETON); - bind(ZoneIdsSupplier.class).to(ZoneIdsFromRegionIdToZoneIdsValues.class).in(Scopes.SINGLETON); - bind(RegionIdsSupplier.class).to(RegionIdsFromRegionIdToURIKeySet.class).in(Scopes.SINGLETON); - bind(ZoneIdToURISupplier.class).to(ZoneIdToURIFromJoinOnRegionIdToURI.class).in(Scopes.SINGLETON); - } -} 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/config/EC2HttpApiModule.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/config/EC2HttpApiModule.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/config/EC2HttpApiModule.java deleted file mode 100644 index ca45843..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/config/EC2HttpApiModule.java +++ /dev/null @@ -1,37 +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.config; - - - - -import org.jclouds.ec2.EC2Api; -import org.jclouds.rest.ConfiguresHttpApi; - - -/** - * Configures the EC2 connection. - * - * @author Adrian Cole (EDIT: Nick Terry [email protected]) - */ -@ConfiguresHttpApi -public class EC2HttpApiModule extends BaseEC2HttpApiModule<EC2Api> { - - public EC2HttpApiModule() { - super(EC2Api.class); - } -} 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/Attachment.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/Attachment.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/Attachment.java deleted file mode 100644 index 0961623..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/Attachment.java +++ /dev/null @@ -1,226 +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; - -/** - * @author Adrian Cole - * @see <a href= - * "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CreateVolume.html" - * /> - */ -public class Attachment implements Comparable<Attachment> { - public static enum Status { - ATTACHING, ATTACHED, DETACHING, DETACHED, BUSY, 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; - } - } - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private String region; - private String volumeId; - private String instanceId; - private String device; - private Status status; - private Date attachTime; - - public Builder region(String region) { - this.region = region; - return this; - } - - public Builder volumeId(String volumeId) { - this.volumeId = volumeId; - return this; - } - - public Builder instanceId(String instanceId) { - this.instanceId = instanceId; - return this; - } - - public Builder device(String device) { - this.device = device; - return this; - } - - public Builder status(Status status) { - this.status = status; - return this; - } - - public Builder attachTime(Date attachTime) { - this.attachTime = attachTime; - return this; - } - - public Attachment build() { - return new Attachment(region, volumeId, instanceId, device, status, attachTime); - } - } - - private final String region; - private final String volumeId; - private final String instanceId; - private final String device; - private final Status status; - private final Date attachTime; - - public Attachment(String region, String volumeId, String instanceId, String device, Status status, Date attachTime) { - this.region = checkNotNull(region, "region"); - this.volumeId = volumeId; - this.instanceId = instanceId; - this.device = device; - this.status = status; - this.attachTime = attachTime; - } - - /** - * 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 volume. - */ - public String getVolumeId() { - return volumeId; - } - - /** - * The ID of the instance. - */ - public String getId() { - return instanceId; - } - - /** - * The device as it is exposed to the instance. - */ - public String getDevice() { - return device; - } - - /** - * Volume state. - */ - public Status getStatus() { - return status; - } - - /** - * Time stamp when the attachment initiated. - */ - public Date getAttachTime() { - return attachTime; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((attachTime == null) ? 0 : attachTime.hashCode()); - result = prime * result + ((device == null) ? 0 : device.hashCode()); - result = prime * result + ((instanceId == null) ? 0 : instanceId.hashCode()); - result = prime * result + ((region == null) ? 0 : region.hashCode()); - result = prime * result + ((status == null) ? 0 : status.hashCode()); - result = prime * result + ((volumeId == null) ? 0 : volumeId.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; - Attachment other = (Attachment) obj; - if (attachTime == null) { - if (other.attachTime != null) - return false; - } else if (!attachTime.equals(other.attachTime)) - return false; - if (device == null) { - if (other.device != null) - return false; - } else if (!device.equals(other.device)) - return false; - if (instanceId == null) { - if (other.instanceId != null) - return false; - } else if (!instanceId.equals(other.instanceId)) - return false; - if (region == null) { - if (other.region != null) - return false; - } else if (!region.equals(other.region)) - 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; - return true; - } - - @Override - public String toString() { - return "Attachment [region=" + region + ", volumeId=" + volumeId + ", instanceId=" + instanceId + ", device=" - + device + ", attachTime=" + attachTime + ", status=" + status + "]"; - } - - @Override - public int compareTo(Attachment o) { - return attachTime.compareTo(o.attachTime); - } - -} 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/AvailabilityZoneInfo.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/AvailabilityZoneInfo.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/AvailabilityZoneInfo.java deleted file mode 100644 index 63c993f..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/AvailabilityZoneInfo.java +++ /dev/null @@ -1,129 +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 com.google.common.collect.Iterables; -import com.google.common.collect.Sets; - -/** - * - * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-ItemType-AvailabilityZoneItemType.html" - * /> - * @author Adrian Cole - */ -public class AvailabilityZoneInfo implements Comparable<AvailabilityZoneInfo> { - - private final String zone; - private final String state; - private final String region; - private final Set<String> messages = Sets.newHashSet(); - - public AvailabilityZoneInfo(String zone, String zoneState, - String region, Iterable<String> messages) { - this.zone = checkNotNull(zone, "zone"); - this.state = checkNotNull(zoneState, "zoneState"); - this.region = checkNotNull(region, "region"); - Iterables.addAll(this.messages, checkNotNull(messages, "messages")); - } - - /** - * the Availability Zone. - */ - public String getZone() { - return zone; - } - - /** - * State of the Availability Zone. - */ - public String getState() { - return state; - } - - /** - * Name of the Region. - */ - public String getRegion() { - return region; - } - - /** - * Messages - */ - public Set<String> getMessages() { - return messages; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((messages == null) ? 0 : messages.hashCode()); - result = prime * result + ((region == null) ? 0 : region.hashCode()); - result = prime * result + ((state == null) ? 0 : state.hashCode()); - result = prime * result + ((zone == null) ? 0 : zone.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; - AvailabilityZoneInfo other = (AvailabilityZoneInfo) obj; - if (messages == null) { - if (other.messages != null) - return false; - } else if (!messages.equals(other.messages)) - return false; - if (region == null) { - if (other.region != null) - return false; - } else if (!region.equals(other.region)) - return false; - if (state == null) { - if (other.state != null) - return false; - } else if (!state.equals(other.state)) - return false; - if (zone == null) { - if (other.zone != null) - return false; - } else if (!zone.equals(other.zone)) - return false; - return true; - } - - @Override - public String toString() { - return "AvailabilityZoneInfo [messages=" + messages + ", region=" + region + ", state=" - + state + ", zone=" + zone + "]"; - } - - @Override - public int compareTo(AvailabilityZoneInfo that) { - return zone.compareTo(that.zone); - } - -} 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/BlockDevice.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/BlockDevice.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/BlockDevice.java deleted file mode 100644 index 7d341d1..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/BlockDevice.java +++ /dev/null @@ -1,109 +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 java.util.Date; - -import org.jclouds.ec2.domain.Attachment.Status; - -/** - * - * @see <a href= - * "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-ItemType-RunningInstancesItemType.html" - * /> - * @author Adrian Cole - */ -public class BlockDevice { - private final String volumeId; - private final Attachment.Status attachmentStatus; - private final Date attachTime; - private final boolean deleteOnTermination; - - public BlockDevice(String volumeId, Status attachmentStatus, Date attachTime, boolean deleteOnTermination) { - this.volumeId = volumeId; - this.attachmentStatus = attachmentStatus; - this.attachTime = attachTime; - this.deleteOnTermination = deleteOnTermination; - } - - public BlockDevice(String volumeId, boolean deleteOnTermination) { - this(volumeId, null, null, deleteOnTermination); - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((attachTime == null) ? 0 : attachTime.hashCode()); - result = prime * result + ((attachmentStatus == null) ? 0 : attachmentStatus.hashCode()); - result = prime * result + (deleteOnTermination ? 1231 : 1237); - result = prime * result + ((volumeId == null) ? 0 : volumeId.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; - BlockDevice other = (BlockDevice) obj; - if (attachTime == null) { - if (other.attachTime != null) - return false; - } else if (!attachTime.equals(other.attachTime)) - return false; - if (attachmentStatus == null) { - if (other.attachmentStatus != null) - return false; - } else if (!attachmentStatus.equals(other.attachmentStatus)) - return false; - if (deleteOnTermination != other.deleteOnTermination) - return false; - if (volumeId == null) { - if (other.volumeId != null) - return false; - } else if (!volumeId.equals(other.volumeId)) - return false; - return true; - } - - public String getVolumeId() { - return volumeId; - } - - public Attachment.Status getAttachmentStatus() { - return attachmentStatus; - } - - public Date getAttachTime() { - return attachTime; - } - - public boolean isDeleteOnTermination() { - return deleteOnTermination; - } - - @Override - public String toString() { - return "[volumeId=" + volumeId + ", attachmentStatus=" + attachmentStatus + ", attachTime=" - + attachTime + ", deleteOnTermination=" + deleteOnTermination + "]"; - } - -} 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/BlockDeviceMapping.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/BlockDeviceMapping.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/BlockDeviceMapping.java deleted file mode 100644 index 47bb456..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/BlockDeviceMapping.java +++ /dev/null @@ -1,234 +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.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Strings.emptyToNull; - -import org.jclouds.javax.annotation.Nullable; - -/** - * - * @author Lili Nadar - */ -public class BlockDeviceMapping implements Comparable<BlockDeviceMapping> { - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private String deviceName; - private String virtualName; - private String snapshotId; - private Integer sizeInGib; - private Boolean noDevice; - private Boolean deleteOnTermination; - - public Builder deviceName(String deviceName) { - this.deviceName = deviceName; - return this; - } - - public Builder virtualName(String virtualName) { - this.virtualName = virtualName; - return this; - } - - public Builder snapshotId(String snapshotId) { - this.snapshotId = snapshotId; - return this; - } - - public Builder sizeInGib(Integer sizeInGib) { - this.sizeInGib = sizeInGib; - return this; - } - - public Builder noDevice(Boolean noDevice) { - this.noDevice = noDevice; - return this; - } - - public Builder deleteOnTermination(Boolean deleteOnTermination) { - this.deleteOnTermination = deleteOnTermination; - return this; - } - - public BlockDeviceMapping build() { - return new BlockDeviceMapping(deviceName, virtualName, snapshotId, sizeInGib, noDevice, deleteOnTermination); - } - - public Builder clear() { - this.deviceName = null; - this.virtualName = null; - this.snapshotId = null; - this.sizeInGib = null; - this.noDevice = null; - this.deleteOnTermination = null; - return this; - } - } - - private final String deviceName; - private final String virtualName; - private final String snapshotId; - private final Integer sizeInGib; - private final Boolean noDevice; - private final Boolean deleteOnTermination; - - // values expressed in GB - private static final Integer VOLUME_SIZE_MIN_VALUE = 1; - private static final Integer VOLUME_SIZE_MAX_VALUE = 1000; - - BlockDeviceMapping(String deviceName, @Nullable String virtualName, @Nullable String snapshotId, - @Nullable Integer sizeInGib, @Nullable Boolean noDevice, @Nullable Boolean deleteOnTermination) { - - checkNotNull(deviceName, "deviceName cannot be null"); - checkNotNull(emptyToNull(deviceName), "deviceName must be defined"); - - if (sizeInGib != null) { - checkArgument(sizeInGib >= VOLUME_SIZE_MIN_VALUE && sizeInGib <= VOLUME_SIZE_MAX_VALUE, - String.format("Size in Gib must be between %s and %s GB", VOLUME_SIZE_MIN_VALUE, VOLUME_SIZE_MAX_VALUE)); - } - this.deviceName = deviceName; - this.virtualName = virtualName; - this.snapshotId = snapshotId; - this.sizeInGib = sizeInGib; - this.noDevice = noDevice; - this.deleteOnTermination = deleteOnTermination; - } - - public String getDeviceName() { - return deviceName; - } - - public String getVirtualName() { - return virtualName; - } - - public String getEbsSnapshotId() { - return snapshotId; - } - - public Integer getEbsVolumeSize() { - return sizeInGib; - } - - public Boolean getEbsNoDevice() { - return noDevice; - } - - public Boolean getEbsDeleteOnTermination() { - return deleteOnTermination; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((deleteOnTermination == null) ? 0 : deleteOnTermination.hashCode()); - result = prime * result + ((deviceName == null) ? 0 : deviceName.hashCode()); - result = prime * result + ((noDevice == null) ? 0 : noDevice.hashCode()); - result = prime * result + ((sizeInGib == null) ? 0 : sizeInGib.hashCode()); - result = prime * result + ((snapshotId == null) ? 0 : snapshotId.hashCode()); - result = prime * result + ((virtualName == null) ? 0 : virtualName.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; - BlockDeviceMapping other = (BlockDeviceMapping) obj; - if (deleteOnTermination == null) { - if (other.deleteOnTermination != null) - return false; - } else if (!deleteOnTermination.equals(other.deleteOnTermination)) - return false; - if (deviceName == null) { - if (other.deviceName != null) - return false; - } else if (!deviceName.equals(other.deviceName)) - return false; - if (noDevice == null) { - if (other.noDevice != null) - return false; - } else if (!noDevice.equals(other.noDevice)) - return false; - if (sizeInGib == null) { - if (other.sizeInGib != null) - return false; - } else if (!sizeInGib.equals(other.sizeInGib)) - return false; - if (snapshotId == null) { - if (other.snapshotId != null) - return false; - } else if (!snapshotId.equals(other.snapshotId)) - return false; - if (virtualName == null) { - if (other.virtualName != null) - return false; - } else if (!virtualName.equals(other.virtualName)) - return false; - return true; - } - - @Override - public String toString() { - return "[deviceName=" + deviceName + ", virtualName=" + virtualName + ", snapshotId=" + snapshotId - + ", sizeInGib=" + sizeInGib + ", noDevice=" + noDevice + ", deleteOnTermination=" + deleteOnTermination - + "]"; - } - - public static class MapEBSSnapshotToDevice extends BlockDeviceMapping { - public MapEBSSnapshotToDevice(String deviceName, String snapshotId, @Nullable Integer sizeInGib, - @Nullable Boolean deleteOnTermination) { - super(deviceName, null, snapshotId, sizeInGib, null, deleteOnTermination); - checkNotNull(emptyToNull(snapshotId), "snapshotId must be defined"); - } - } - - public static class MapNewVolumeToDevice extends BlockDeviceMapping { - public MapNewVolumeToDevice(String deviceName, Integer sizeInGib, @Nullable Boolean deleteOnTermination) { - super(deviceName, null, null, sizeInGib, null, deleteOnTermination); - checkNotNull(sizeInGib, "sizeInGib cannot be null"); - } - } - - public static class MapEphemeralDeviceToDevice extends BlockDeviceMapping { - public MapEphemeralDeviceToDevice(String deviceName, String virtualName) { - super(deviceName, virtualName, null, null, null, null); - checkNotNull(emptyToNull(virtualName), "virtualName must be defined"); - } - } - - public static class UnmapDeviceNamed extends BlockDeviceMapping { - public UnmapDeviceNamed(String deviceName) { - super(deviceName, null, null, null, true, null); - } - } - - @Override - public int compareTo(BlockDeviceMapping arg0) { - return deviceName.compareTo(arg0.deviceName); - } -} 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/BundleInstanceS3Storage.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/BundleInstanceS3Storage.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/BundleInstanceS3Storage.java deleted file mode 100644 index cabf88e..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/BundleInstanceS3Storage.java +++ /dev/null @@ -1,150 +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 org.jclouds.javax.annotation.Nullable; - -/** - * - * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-ItemType-BundleInstanceS3StorageType.html" - * /> - * @author Adrian Cole - */ -public class BundleInstanceS3Storage { - private final String ccessKeyId; - private final String bucket; - private final String prefix; - private final String secretAccessKey; - private final String uploadPolicy; - private final String uploadPolicySignature; - - public BundleInstanceS3Storage(@Nullable String ccessKeyId, String bucket, String prefix, - @Nullable String secretAccessKey, @Nullable String uploadPolicy, @Nullable String uploadPolicySignature) { - this.ccessKeyId = ccessKeyId; - this.bucket = checkNotNull(bucket, "bucket"); - this.prefix = checkNotNull(prefix, "prefix"); - this.secretAccessKey = secretAccessKey; - this.uploadPolicy = uploadPolicy; - this.uploadPolicySignature = uploadPolicySignature; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((ccessKeyId == null) ? 0 : ccessKeyId.hashCode()); - result = prime * result + ((bucket == null) ? 0 : bucket.hashCode()); - result = prime * result + ((prefix == null) ? 0 : prefix.hashCode()); - result = prime * result + ((secretAccessKey == null) ? 0 : secretAccessKey.hashCode()); - result = prime * result + ((uploadPolicy == null) ? 0 : uploadPolicy.hashCode()); - result = prime * result + ((uploadPolicySignature == null) ? 0 : uploadPolicySignature.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; - BundleInstanceS3Storage other = (BundleInstanceS3Storage) obj; - if (ccessKeyId == null) { - if (other.ccessKeyId != null) - return false; - } else if (!ccessKeyId.equals(other.ccessKeyId)) - return false; - if (bucket == null) { - if (other.bucket != null) - return false; - } else if (!bucket.equals(other.bucket)) - return false; - if (prefix == null) { - if (other.prefix != null) - return false; - } else if (!prefix.equals(other.prefix)) - return false; - if (secretAccessKey == null) { - if (other.secretAccessKey != null) - return false; - } else if (!secretAccessKey.equals(other.secretAccessKey)) - return false; - if (uploadPolicy == null) { - if (other.uploadPolicy != null) - return false; - } else if (!uploadPolicy.equals(other.uploadPolicy)) - return false; - if (uploadPolicySignature == null) { - if (other.uploadPolicySignature != null) - return false; - } else if (!uploadPolicySignature.equals(other.uploadPolicySignature)) - return false; - return true; - } - - @Override - public String toString() { - return "[ccessKeyId=" + ccessKeyId + ", bucket=" + bucket + ", prefix=" + prefix + ", secretAccessKey=" - + secretAccessKey + ", uploadPolicy=" + uploadPolicy + ", uploadPolicySignature=" + uploadPolicySignature - + "]"; - } - - - /** - * - * @returnThe bucket in which to store the AMI. You can specify a bucket that - * you already own or a new bucket that Amazon EC2 creates on your - * behalf. If you specify a bucket that belongs to someone else, - * Amazon EC2 returns an error. - */ - public String getBucket() { - return bucket; - } - - /** - * - * @return Specifies the beginning of the file name of the AMI. - */ - public String getPrefix() { - return prefix; - } - - - - /** - * - * @return An Amazon S3 upload policy that gives Amazon EC2 permission to - * upload items into Amazon S3 on the user's behalf. For more - * information on bundling in Windows, go to the Amazon Elastic - * Compute Cloud Developer Guide and Amazon Elastic Compute Cloud - * Getting Started - */ - public String getUploadPolicy() { - return uploadPolicy; - } - - /** - * - * @return The signature of the Base64 encoded JSON document. - */ - public String getUploadPolicySignature() { - return uploadPolicySignature; - } -} 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/BundleTask.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/BundleTask.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/BundleTask.java deleted file mode 100644 index 159cebb..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/BundleTask.java +++ /dev/null @@ -1,295 +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 org.jclouds.javax.annotation.Nullable; - -/** - * - * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-ItemType-BundleInstanceTaskType.html" - * /> - * @author Adrian Cole - */ -public class BundleTask implements Comparable<BundleTask> { - /** - * {@inheritDoc} - */ - public int compareTo(BundleTask o) { - return (this == o) ? 0 : getBundleId().compareTo(o.getBundleId()); - } - - /** - * If the task fails, a description of the error. - * - * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-ItemType-BundleInstanceTaskErrorType.html" - * /> - * @author Adrian Cole - */ - public static class Error { - private final String code; - private final String message; - - public Error(String code, String message) { - this.code = checkNotNull(code, "code"); - this.message = checkNotNull(message, "message"); - } - - public String getCode() { - return code; - } - - public String getMessage() { - return message; - } - - @Override - public String toString() { - return "[code=" + code + ", message=" + message + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((code == null) ? 0 : code.hashCode()); - result = prime * result + ((message == null) ? 0 : message.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; - Error other = (Error) obj; - if (code == null) { - if (other.code != null) - return false; - } else if (!code.equals(other.code)) - return false; - if (message == null) { - if (other.message != null) - return false; - } else if (!message.equals(other.message)) - return false; - return true; - } - - } - - private final String region; - private final String bundleId; - private final Error error; - private final String instanceId; - private final int progress; - private final Date startTime; - private final String state; - private final String bucket; - private final String prefix; - private final Date updateTime; - - public BundleTask(String region, String bundleId, @Nullable Error error, String instanceId, int progress, - Date startTime, String state, String bucket, String prefix, Date updateTime) { - this.region = checkNotNull(region, "region"); - this.bundleId = checkNotNull(bundleId, "bundleId"); - this.error = error; - this.instanceId = checkNotNull(instanceId, "instanceId"); - this.progress = checkNotNull(progress, "progress"); - this.startTime = checkNotNull(startTime, "startTime"); - this.state = checkNotNull(state, "state"); - this.bucket = checkNotNull(bucket, "bucket"); - this.prefix = checkNotNull(prefix, "prefix"); - this.updateTime = checkNotNull(updateTime, "updateTime"); - } - - @Override - public String toString() { - return "[bucket=" + bucket + ", bundleId=" + bundleId + ", error=" + error + ", instanceId=" + instanceId - + ", prefix=" + prefix + ", progress=" + progress + ", region=" + region + ", startTime=" + startTime - + ", state=" + state + ", updateTime=" + updateTime + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((bucket == null) ? 0 : bucket.hashCode()); - result = prime * result + ((bundleId == null) ? 0 : bundleId.hashCode()); - result = prime * result + ((error == null) ? 0 : error.hashCode()); - result = prime * result + ((instanceId == null) ? 0 : instanceId.hashCode()); - result = prime * result + ((prefix == null) ? 0 : prefix.hashCode()); - result = prime * result + progress; - result = prime * result + ((region == null) ? 0 : region.hashCode()); - result = prime * result + ((startTime == null) ? 0 : startTime.hashCode()); - result = prime * result + ((state == null) ? 0 : state.hashCode()); - result = prime * result + ((updateTime == null) ? 0 : updateTime.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; - BundleTask other = (BundleTask) obj; - if (bucket == null) { - if (other.bucket != null) - return false; - } else if (!bucket.equals(other.bucket)) - return false; - if (bundleId == null) { - if (other.bundleId != null) - return false; - } else if (!bundleId.equals(other.bundleId)) - return false; - if (error == null) { - if (other.error != null) - return false; - } else if (!error.equals(other.error)) - return false; - if (instanceId == null) { - if (other.instanceId != null) - return false; - } else if (!instanceId.equals(other.instanceId)) - return false; - if (prefix == null) { - if (other.prefix != null) - return false; - } else if (!prefix.equals(other.prefix)) - 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 (state == null) { - if (other.state != null) - return false; - } else if (!state.equals(other.state)) - return false; - if (updateTime == null) { - if (other.updateTime != null) - return false; - } else if (!updateTime.equals(other.updateTime)) - return false; - return true; - } - - /** - * 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; - } - - /** - * - * @return The bucket in which to store the AMI. You can specify a bucket - * that you already own or a new bucket that Amazon EC2 creates on - * your behalf. If you specify a bucket that belongs to someone e - * lse, Amazon EC2 returns an error. - */ - public String getBucket() { - return bucket; - } - - /** - * - * @return Specifies the beginning of the file name of the AMI. - */ - public String getPrefix() { - return prefix; - } - - /** - * - * @return Identifier for this task. - */ - public String getBundleId() { - return bundleId; - } - - /** - * - * @return If the task fails, a description of the error. - */ - public Error getError() { - return error; - } - - /** - * - * @return Instance associated with this bundle task - */ - public String getInstanceId() { - return instanceId; - } - - /** - * - * @return A percentage description of the progress of the task, such as 20. - */ - public int getProgress() { - return progress; - } - - /** - * - * @return The time this task started. - */ - public Date getStartTime() { - return startTime; - } - - /** - * - * @return The state of the task. - */ - public String getState() { - return state; - } - - /** - * - * @return The time of the most recent update for the task. - */ - public Date getUpdateTime() { - return updateTime; - } - -} 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/Hypervisor.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/Hypervisor.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/Hypervisor.java deleted file mode 100644 index 76ac80a..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/domain/Hypervisor.java +++ /dev/null @@ -1,49 +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; - -/** - * Hypervisor of the image. - * - * @author Adrian Cole - */ -public enum Hypervisor { - - XEN, - /** - * Oracle VM Server - */ - OVM, UNRECOGNIZED; - - public String value() { - return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name()); - } - - public String toString() { - return value(); - } - - public static Hypervisor fromValue(String v) { - try { - return valueOf(CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_UNDERSCORE, v)); - } catch (IllegalArgumentException e) { - return UNRECOGNIZED; - } - } -}
