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/SecurityGroupApi.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/features/SecurityGroupApi.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/features/SecurityGroupApi.java deleted file mode 100644 index c082bd0..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/features/SecurityGroupApi.java +++ /dev/null @@ -1,324 +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.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.Fallbacks.VoidOnNotFoundOr404; -import org.jclouds.aws.filters.FormSigner; -import org.jclouds.ec2.binders.BindFiltersToIndexedFormParams; -import org.jclouds.ec2.binders.BindGroupNamesToIndexedFormParams; -import org.jclouds.ec2.binders.BindUserIdGroupPairToSourceSecurityGroupFormParams; -import org.jclouds.ec2.domain.SecurityGroup; -import org.jclouds.ec2.domain.UserIdGroupPair; -import org.jclouds.ec2.xml.DescribeSecurityGroupsResponseHandler; -import org.jclouds.javax.annotation.Nullable; -import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull; -import org.jclouds.net.domain.IpProtocol; -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 EC2 via their REST API. - * <p/> - * - * @author Adrian Cole - */ -@RequestFilters(FormSigner.class) -@VirtualHost -public interface SecurityGroupApi { - - /** - * Creates a new security group. Group names must be unique per identity. - * - * @param region - * Security groups are not copied across Regions. Instances within the Region cannot - * communicate with instances outside the Region using group-based firewall rules. - * Traffic from instances in another Region is seen as WAN bandwidth. - * @param name - * Name of the security group. Accepts alphanumeric characters, spaces, dashes, and - * underscores. - * @param description - * Description of the group. This is informational only. If the description contains - * spaces, you must enc lose it in single quotes (') or URL-encode it. Accepts - * alphanumeric characters, spaces, dashes, and underscores. - * @see #runInstances - * @see #describeSecurityGroups - * @see #authorizeSecurityGroupIngress - * @see #revokeSecurityGroupIngress - * @see #deleteSecurityGroup - * - * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CreateSecurityGroup.html" - * /> - */ - @Named("CreateSecurityGroup") - @POST - @Path("/") - @FormParams(keys = ACTION, values = "CreateSecurityGroup") - void createSecurityGroupInRegion( - @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, - @FormParam("GroupName") String name, @FormParam("GroupDescription") String description); - - /** - * Deletes a security group that you own. - * - * @param region - * Security groups are not copied across Regions. Instances within the Region cannot - * communicate with instances outside the Region using group-based firewall rules. - * Traffic from instances in another Region is seen as WAN bandwidth. - * @param name - * Name of the security group to delete. - * - * @see #describeSecurityGroups - * @see #authorizeSecurityGroupIngress - * @see #revokeSecurityGroupIngress - * @see #createSecurityGroup - * - * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DeleteSecurityGroup.html" - * /> - */ - @Named("DeleteSecurityGroup") - @POST - @Path("/") - @FormParams(keys = ACTION, values = "DeleteSecurityGroup") - @Fallback(VoidOnNotFoundOr404.class) - void deleteSecurityGroupInRegion( - @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, @FormParam("GroupName") String name); - - /** - * Returns information about security groups that you own. - * - * @param region - * Security groups are not copied across Regions. Instances within the Region cannot - * communicate with instances outside the Region using group-based firewall rules. - * Traffic from instances in another Region is seen as WAN bandwidth. - * @param securityGroupNames - * Name of the security groups - * - * @see #createSecurityGroup - * @see #authorizeSecurityGroupIngress - * @see #revokeSecurityGroupIngress - * @see #deleteSecurityGroup - * - * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSecurityGroups.html" - * /> - */ - @Named("DescribeSecurityGroups") - @POST - @Path("/") - @FormParams(keys = ACTION, values = "DescribeSecurityGroups") - @XMLResponseParser(DescribeSecurityGroupsResponseHandler.class) - @Fallback(EmptySetOnNotFoundOr404.class) - Set<SecurityGroup> describeSecurityGroupsInRegion( - @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, - @BinderParam(BindGroupNamesToIndexedFormParams.class) String... securityGroupNames); - - /** - * Returns information about security groups that you own. - * - * @param region - * Security groups are not copied across Regions. Instances within the Region cannot - * communicate with instances outside the Region using group-based firewall rules. - * Traffic from instances in another Region is seen as WAN bandwidth. - * @param filter - * Multimap of filter key/values. - * - * @see #createSecurityGroup - * @see #authorizeSecurityGroupIngress - * @see #revokeSecurityGroupIngress - * @see #deleteSecurityGroup - * - * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSecurityGroups.html" - * /> - */ - @Named("DescribeSecurityGroups") - @POST - @Path("/") - @FormParams(keys = ACTION, values = "DescribeSecurityGroups") - @XMLResponseParser(DescribeSecurityGroupsResponseHandler.class) - @Fallback(EmptySetOnNotFoundOr404.class) - Set<SecurityGroup> describeSecurityGroupsInRegionWithFilter( - @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, - @BinderParam(BindFiltersToIndexedFormParams.class) Multimap<String, String> filter); - - /** - * - * Adds permissions to a security group based on another group. - * - * @param region - * Security groups are not copied across Regions. Instances within the Region cannot - * communicate with instances outside the Region using group-based firewall rules. - * Traffic from instances in another Region is seen as WAN bandwidth. - * @param groupName - * Name of the group to modify. The name must be valid and belong to the identity - * @param sourceSecurityGroup - * group to associate with this group. - * - * @see #createSecurityGroup - * @see #describeSecurityGroups - * @see #revokeSecurityGroupIngress - * @see #deleteSecurityGroup - * - * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-AuthorizeSecurityGroupIngress.html" - * - */ - @Named("AuthorizeSecurityGroupIngress") - @POST - @Path("/") - @FormParams(keys = ACTION, values = "AuthorizeSecurityGroupIngress") - void authorizeSecurityGroupIngressInRegion( - @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, - @FormParam("GroupName") String groupName, - @BinderParam(BindUserIdGroupPairToSourceSecurityGroupFormParams.class) UserIdGroupPair sourceSecurityGroup); - - /** - * - * Adds permissions to a security group. - * <p/> - * Permissions are specified by the IP protocol (TCP, UDP or ICMP), the source of the request (by - * IP range or an Amazon EC2 user-group pair), the source and destination port ranges (for TCP - * and UDP), and the ICMP codes and types (for ICMP). When authorizing ICMP, -1 can be used as a - * wildcard in the type and code fields. Permission changes are propagated to instances within - * the security group as quickly as possible. However, depending on the number of instances, a - * small delay might occur. - * - * @param region - * Security groups are not copied across Regions. Instances within the Region cannot - * communicate with instances outside the Region using group-based firewall rules. - * Traffic from instances in another Region is seen as WAN bandwidth. - * @param groupName - * Name of the group to modify. The name must be valid and belong to the identity - * @param ipProtocol - * IP protocol. - * @param fromPort - * Start of port range for the TCP and UDP protocols, or an ICMP type number. An ICMP - * type number of -1 indicates a wildcard (i.e., any ICMP type number). - * @param toPort - * End of port range for the TCP and UDP protocols, or an ICMP code. An ICMP code of -1 - * indicates a wildcard (i.e., any ICMP code). - * @param cidrIp - * CIDR range. - * - * @see #createSecurityGroup - * @see #describeSecurityGroups - * @see #revokeSecurityGroupIngress - * @see #deleteSecurityGroup - * - * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-AuthorizeSecurityGroupIngress.html" - * - */ - @Named("AuthorizeSecurityGroupIngress") - @POST - @Path("/") - @FormParams(keys = ACTION, values = "AuthorizeSecurityGroupIngress") - void authorizeSecurityGroupIngressInRegion( - @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, - @FormParam("GroupName") String groupName, @FormParam("IpProtocol") IpProtocol ipProtocol, - @FormParam("FromPort") int fromPort, @FormParam("ToPort") int toPort, @FormParam("CidrIp") String cidrIp); - - /** - * - * Revokes permissions from a security group. The permissions used to revoke must be specified - * using the same values used to grant the permissions. - * - * @param region - * Security groups are not copied across Regions. Instances within the Region cannot - * communicate with instances outside the Region using group-based firewall rules. - * Traffic from instances in another Region is seen as WAN bandwidth. - * @param groupName - * Name of the group to modify. The name must be valid and belong to the identity - * @param sourceSecurityGroup - * group to associate with this group. - * - * @see #createSecurityGroup - * @see #describeSecurityGroups - * @see #authorizeSecurityGroupIngress - * @see #deleteSecurityGroup - * - * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-RevokeSecurityGroupIngress.html" - * - */ - @Named("RevokeSecurityGroupIngress") - @POST - @Path("/") - @FormParams(keys = ACTION, values = "RevokeSecurityGroupIngress") - void revokeSecurityGroupIngressInRegion( - @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, - @FormParam("GroupName") String groupName, - @BinderParam(BindUserIdGroupPairToSourceSecurityGroupFormParams.class) UserIdGroupPair sourceSecurityGroup); - - /** - * - * Revokes permissions from a security group. The permissions used to revoke must be specified - * using the same values used to grant the permissions. - * <p/> - * Permissions are specified by IP protocol (TCP, UDP, or ICMP), the source of the request (by IP - * range or an Amazon EC2 user-group pair), the source and destination port ranges (for TCP and - * UDP), and the ICMP codes and types (for ICMP). - * - * Permission changes are quickly propagated to instances within the security group. However, - * depending on the number of instances in the group, a small delay is might occur. - * - * @param region - * Security groups are not copied across Regions. Instances within the Region cannot - * communicate with instances outside the Region using group-based firewall rules. - * Traffic from instances in another Region is seen as WAN bandwidth. - * @param groupName - * Name of the group to modify. The name must be valid and belong to the identity - * @param ipProtocol - * IP protocol. - * @param fromPort - * Start of port range for the TCP and UDP protocols, or an ICMP type number. An ICMP - * type number of -1 indicates a wildcard (i.e., any ICMP type number). - * @param toPort - * End of port range for the TCP and UDP protocols, or an ICMP code. An ICMP code of -1 - * indicates a wildcard (i.e., any ICMP code). - * @param cidrIp - * CIDR range. - * - * @see #createSecurityGroup - * @see #describeSecurityGroups - * @see #authorizeSecurityGroupIngress - * @see #deleteSecurityGroup - * - * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-RevokeSecurityGroupIngress.html" - * - */ - @Named("RevokeSecurityGroupIngress") - @POST - @Path("/") - @FormParams(keys = ACTION, values = "RevokeSecurityGroupIngress") - void revokeSecurityGroupIngressInRegion( - @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, - @FormParam("GroupName") String groupName, @FormParam("IpProtocol") IpProtocol ipProtocol, - @FormParam("FromPort") int fromPort, @FormParam("ToPort") int toPort, @FormParam("CidrIp") String cidrIp); -}
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/SubnetApi.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/features/SubnetApi.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/features/SubnetApi.java deleted file mode 100644 index c9aa1c4..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/features/SubnetApi.java +++ /dev/null @@ -1,94 +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 javax.inject.Named; -import javax.ws.rs.POST; -import javax.ws.rs.Path; - -import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404; -import org.jclouds.aws.filters.FormSigner; -import org.jclouds.ec2.binders.BindFiltersToIndexedFormParams; -import org.jclouds.ec2.domain.Subnet; -import org.jclouds.ec2.xml.DescribeSubnetsResponseHandler; -import org.jclouds.rest.annotations.BinderParam; -import org.jclouds.rest.annotations.Fallback; -import org.jclouds.rest.annotations.FormParams; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.SinceApiVersion; -import org.jclouds.rest.annotations.VirtualHost; -import org.jclouds.rest.annotations.XMLResponseParser; - -import com.google.common.collect.FluentIterable; -import com.google.common.collect.Multimap; -/** - * Provides access to Amazon EC2 via the Query API - * <p/> - * - * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSubnets.html" - * >doc</a> - * @author Adrian Cole - * @author Andrew Bayer - */ -@SinceApiVersion("2011-01-01") -@RequestFilters(FormSigner.class) -@VirtualHost -public interface SubnetApi { - /** - * Describes all of your subnets for your EC2 resources. - * - * @return subnets or empty if there are none - * @see <a href= - * "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSubnets.html" - * >docs</href> - */ - @Named("DescribeSubnets") - @POST - @Path("/") - @FormParams(keys = ACTION, values = "DescribeSubnets") - @XMLResponseParser(DescribeSubnetsResponseHandler.class) - @Fallback(EmptyFluentIterableOnNotFoundOr404.class) - FluentIterable<Subnet> list(); - - /** - * Describes subnets for your EC2 resources qualified by a filter - * - * <h4>example</h4> - * - * <pre> - * subnets = subnetApi.filter(new SubnetFilterBuilder().vpcId("vpc-1a2b3c4d").build()); - * </pre> - * - * @param filter - * which is typically built by {@link SubnetFilterBuilder} - * @return tags or empty if there are none that match the filter - * @see <a href= - * "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSubnets.html" - * >docs</href> - */ - @Named("DescribeSubnets") - @POST - @Path("/") - @FormParams(keys = ACTION, values = "DescribeSubnets") - @XMLResponseParser(DescribeSubnetsResponseHandler.class) - @Fallback(EmptyFluentIterableOnNotFoundOr404.class) - FluentIterable<Subnet> filter( - @BinderParam(BindFiltersToIndexedFormParams.class) Multimap<String, String> filter); - -} 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/TagApi.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/features/TagApi.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/features/TagApi.java deleted file mode 100644 index cdc6623..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/features/TagApi.java +++ /dev/null @@ -1,201 +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 javax.inject.Named; -import javax.ws.rs.POST; -import javax.ws.rs.Path; - -import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404; -import org.jclouds.aws.filters.FormSigner; -import org.jclouds.ec2.binders.BindFiltersToIndexedFormParams; -import org.jclouds.ec2.binders.BindResourceIdsToIndexedFormParams; -import org.jclouds.ec2.binders.BindTagKeysToIndexedFormParams; -import org.jclouds.ec2.binders.BindTagsToIndexedFormParams; -import org.jclouds.ec2.domain.Tag; -import org.jclouds.ec2.xml.DescribeTagsResponseHandler; -import org.jclouds.rest.annotations.BinderParam; -import org.jclouds.rest.annotations.Fallback; -import org.jclouds.rest.annotations.FormParams; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.SinceApiVersion; -import org.jclouds.rest.annotations.VirtualHost; -import org.jclouds.rest.annotations.XMLResponseParser; - -import com.google.common.collect.FluentIterable; -import com.google.common.collect.Multimap; -/** - * Provides access to Amazon EC2 via the Query API - * <p/> - * - * @see <a - * href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeTags.html" - * >doc</a> - * @author Adrian Cole - */ -@SinceApiVersion("2010-08-31") -@RequestFilters(FormSigner.class) -@VirtualHost -public interface TagApi { - /** - * Adds or overwrites one or more tags for the specified resource or - * resources. Each resource can have a maximum of 10 tags. Each tag consists - * of a key and optional value. Tag keys must be unique per resource. - * - * <h4>example</h4> - * - * <pre> - * tagApi.applyToResources(ImmutableMap.of("group", "backend"), ImmutableSet.of("i-1a2b3c4d")); - * </pre> - * - * @param tags - * key to an optional value. - * @param resourceIds - * The ID of a resource to tag. For example, {@code ami-1a2b3c4d} - * - * @see <a href= - * "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CreateTags.html" - * >docs</href> - */ - @Named("CreateTags") - @POST - @Path("/") - @FormParams(keys = ACTION, values = "CreateTags") - void applyToResources(@BinderParam(BindTagsToIndexedFormParams.class) Iterable<String> tags, - @BinderParam(BindResourceIdsToIndexedFormParams.class) Iterable<String> resourceIds); - - /** - * like {@link #applyToResources(Map, Iterable)} except that the tags have no - * values. - * - * <h4>example</h4> - * - * <pre> - * tagApi.applyToResources(ImmutableSet.of("production", "pci-compliant"), ImmutableSet.of("i-1a2b3c4d")); - * </pre> - * - * @see #applyToResources(Map, Iterable) - */ - @Named("CreateTags") - @POST - @Path("/") - @FormParams(keys = ACTION, values = "CreateTags") - void applyToResources(@BinderParam(BindTagsToIndexedFormParams.class) Map<String, String> tags, - @BinderParam(BindResourceIdsToIndexedFormParams.class) Iterable<String> resourceIds); - - /** - * Describes all of your tags for your EC2 resources. - * - * @return tags or empty if there are none - * @see <a href= - * "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeTags.html" - * >docs</href> - */ - @Named("DescribeTags") - @POST - @Path("/") - @FormParams(keys = ACTION, values = "DescribeTags") - @XMLResponseParser(DescribeTagsResponseHandler.class) - @Fallback(EmptyFluentIterableOnNotFoundOr404.class) - FluentIterable<Tag> list(); - - /** - * Describes tags for your EC2 resources qualified by a filter - * - * <h4>example</h4> - * - * <pre> - * tags = tagApi.filter(new TagFilterBuilder().image().put("version", "1.0").build()); - * </pre> - * - * @param filter - * which is typically built by {@link TagFilterBuilder} - * @return tags or empty if there are none that match the filter - * @see <a href= - * "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeTags.html" - * >docs</href> - */ - @Named("DescribeTags") - @POST - @Path("/") - @FormParams(keys = ACTION, values = "DescribeTags") - @XMLResponseParser(DescribeTagsResponseHandler.class) - @Fallback(EmptyFluentIterableOnNotFoundOr404.class) - FluentIterable<Tag> filter( - @BinderParam(BindFiltersToIndexedFormParams.class) Multimap<String, String> filter); - - /** - * Deletes a specific set of tags from a specific set of resources. This call - * is designed to follow a {@link #list() list} or {@link #filter(Multimap) - * filter} call. You first determine what tags a resource has, and then you - * call {@link TagApi#deleteFromResources(Iterable, Iterable) delete} with - * the resource ID and the specific tags you want to delete. - * - * <h4>example</h4> - * - * <pre> - * tagApi.deleteFromResources(ImmutableSet.of("Purpose"), ImmutableSet.of("ami-1a2b3c4d")); - * </pre> - * - * @param tags - * the tag keys - * @param resourceIds - * The ID of a resource with the tag. For example, - * {@code ami-1a2b3c4d} - * @see <a href= - * "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DeleteTags.html" - * >docs</href> - */ - @Named("DeleteTags") - @POST - @Path("/") - @FormParams(keys = ACTION, values = "DeleteTags") - void deleteFromResources( - @BinderParam(BindTagKeysToIndexedFormParams.class) Iterable<String> tags, - @BinderParam(BindResourceIdsToIndexedFormParams.class) Iterable<String> resourceIds); - - /** - * like {@link #deleteFromResources(Iterable, Iterable)}, except that the - * tags are only deleted if they match the value. - * - * <h4>example</h4> - * - * <pre> - * tagApi.conditionallyDeleteFromResources(ImmutableMap.of("Purpose", "production"), ImmutableSet.of("ami-1a2b3c4d")); - * </pre> - * - * @param conditionalTagValues - * tag id to value it must match before deleting. For a tag without - * a value, supply empty string. - * @param resourceIds - * The ID of a resource with the tag. For example, - * {@code ami-1a2b3c4d} - * @see #deleteFromResources(Iterable, Iterable) - */ - @Named("DeleteTags") - @POST - @Path("/") - @FormParams(keys = ACTION, values = "DeleteTags") - void conditionallyDeleteFromResources( - @BinderParam(BindTagsToIndexedFormParams.class) Map<String, String> conditionalTagValues, - @BinderParam(BindResourceIdsToIndexedFormParams.class) Iterable<String> resourceIds); - -} 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/WindowsApi.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/features/WindowsApi.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/features/WindowsApi.java deleted file mode 100644 index 5461b23..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/features/WindowsApi.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.features; - -import static org.jclouds.aws.reference.FormParameters.ACTION; - -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.Fallbacks.NullOnNotFoundOr404; -import org.jclouds.aws.filters.FormSigner; -import org.jclouds.ec2.binders.BindBundleIdsToIndexedFormParams; -import org.jclouds.ec2.binders.BindFiltersToIndexedFormParams; -import org.jclouds.ec2.binders.BindS3UploadPolicyAndSignature; -import org.jclouds.ec2.domain.BundleTask; -import org.jclouds.ec2.domain.PasswordData; -import org.jclouds.ec2.options.BundleInstanceS3StorageOptions; -import org.jclouds.ec2.xml.BundleTaskHandler; -import org.jclouds.ec2.xml.DescribeBundleTasksResponseHandler; -import org.jclouds.ec2.xml.GetPasswordDataResponseHandler; -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.SinceApiVersion; -import org.jclouds.rest.annotations.VirtualHost; -import org.jclouds.rest.annotations.XMLResponseParser; - -import com.google.common.collect.Multimap; - -/** - * Provides access to EC2 Windows Features via the Query API - * <p/> - * - * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference" >doc</a> - * @author Adrian Cole - */ -@RequestFilters(FormSigner.class) -@VirtualHost -@SinceApiVersion("2008-08-08") -public interface WindowsApi { - - /** - * Bundles the Windows instance. This procedure is not applicable for Linux - * and UNIX instances. For more information, go to the Amazon Elastic Compute - * Cloud Developer Guide or Amazon Elastic Compute Cloud Getting Started - * Guide. - * - * @param region - * Bundles are tied to the Region where its files are located - * within Amazon S3. - * - * @param instanceId - * The ID of the instance to bundle. - * @param prefix - * Specifies the beginning of the file name of the AMI. - * @param bucket - * 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 - * else, Amazon EC2 returns an error. - * @param uploadPolicy - * An Amazon S3 upload policy that gives Amazon EC2 permission to - * upload items into Amazon S3 on the user's behalf. - * <p/> - * ex. - * - * <pre> - * {"expiration": "2008-08-30T08:49:09Z","conditions": ["bucket": "my-bucket"},["starts-with", "$key", "my-new-image"]]} - * </pre> - * - * @param options - * if the bucket isn't owned by you, use this to set the bucket's - * accesskeyid - * @return status of the work - * - * @see #cancelBundleTaskInRegion - * @see #describeBundleTasksInRegion - * - * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-BundleInstance.html" - * /> - */ - @Named("BundleInstance") - @POST - @Path("/") - @FormParams(keys = ACTION, values = "BundleInstance") - @XMLResponseParser(BundleTaskHandler.class) - BundleTask bundleInstanceInRegion( - @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, - @FormParam("InstanceId") String instanceId, @FormParam("Storage.S3.Prefix") String prefix, - @FormParam("Storage.S3.Bucket") String bucket, - @BinderParam(BindS3UploadPolicyAndSignature.class) String uploadPolicy, - BundleInstanceS3StorageOptions... options); - - /** - * Cancels an Amazon EC2 bundling operation. - * - * @param region - * The bundleTask ID is tied to the Region. - * @param bundleId - * The ID of the bundle task to cancel. - * @return task for the cancel. - * - * @see #bundleInstanceInRegion - * @see #describeBundleTasksInRegion - * - * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CancelBundleTask.html" - * /> - */ - @Named("CancelBundleTask") - @POST - @Path("/") - @FormParams(keys = ACTION, values = "CancelBundleTask") - @XMLResponseParser(BundleTaskHandler.class) - BundleTask cancelBundleTaskInRegion( - @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, - @FormParam("BundleId") String bundleId); - - /** - * - * Describes current bundling tasks. - * - * @param region - * The bundleTask ID is tied to the Region. - * - * @see #cancelBundleTaskInRegion - * @see #bundleInstanceInRegion - * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeBundleTasks.html" - * /> - */ - @Named("DescribeBundleTasks") - @POST - @Path("/") - @FormParams(keys = ACTION, values = "DescribeBundleTasks") - @XMLResponseParser(DescribeBundleTasksResponseHandler.class) - @Fallback(EmptySetOnNotFoundOr404.class) - Set<BundleTask> describeBundleTasksInRegion( - @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, - @BinderParam(BindBundleIdsToIndexedFormParams.class) String... bundleTaskIds); - - /** - * - * Describes current bundling tasks. - * - * @param region - * The bundleTask ID is tied to the Region. - * @param filter - * Filter multimap - * - * @see #cancelBundleTaskInRegion - * @see #bundleInstanceInRegion - * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeBundleTasks.html" - * /> - */ - @Named("DescribeBundleTasks") - @POST - @Path("/") - @FormParams(keys = ACTION, values = "DescribeBundleTasks") - @XMLResponseParser(DescribeBundleTasksResponseHandler.class) - @Fallback(EmptySetOnNotFoundOr404.class) - Set<BundleTask> describeBundleTasksInRegionWithFilter( - @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, - @BinderParam(BindFiltersToIndexedFormParams.class) Multimap<String, String> filter); - - /** - * - * Retrieves the encrypted administrator password for the instances running Windows. - * - * @param region The region where the instance is based - * @param instanceId The ID of the instance to query - * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-GetPasswordData.html" /> - */ - @Named("GetPasswordData") - @POST - @Path("/") - @FormParams(keys = ACTION, values = "GetPasswordData") - @XMLResponseParser(GetPasswordDataResponseHandler.class) - PasswordData getPasswordDataInRegion( - @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, - @FormParam("InstanceId") String instanceId); - - - /** - * - * Retrieves the encrypted administrator password for the instances running Windows. <h4>Note</h4> - * - * The Windows password is only generated the first time an AMI is launched. It is not generated - * for rebundled AMIs or after the password is changed on an instance. - * - * The password is encrypted using the key pair that you provided. - * - * @param instanceId - * The ID of the instance to query - * @return password data or null if not available - * @see <a href= - * "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-GetPasswordData.html" - * /> - */ - @Named("GetPasswordData") - @POST - @Path("/") - @FormParams(keys = ACTION, values = "GetPasswordData") - @XMLResponseParser(GetPasswordDataResponseHandler.class) - @Fallback(NullOnNotFoundOr404.class) - PasswordData getPasswordDataForInstance(@FormParam("InstanceId") String instanceId); - -} 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/functions/ConvertUnencodedBytesToBase64EncodedString.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/functions/ConvertUnencodedBytesToBase64EncodedString.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/functions/ConvertUnencodedBytesToBase64EncodedString.java deleted file mode 100644 index d44dc29..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/functions/ConvertUnencodedBytesToBase64EncodedString.java +++ /dev/null @@ -1,43 +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.functions; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.io.BaseEncoding.base64; - -import javax.inject.Singleton; - -import com.google.common.base.Function; - -/** - * Binds base64 encodes the byte [] input - * - * @author Adrian Cole - */ -@Singleton -public class ConvertUnencodedBytesToBase64EncodedString implements Function<Object, String> { - - @Override - public String apply(Object from) { - checkArgument(checkNotNull(from, "input") instanceof byte[], "this binder is only valid for byte []!"); - byte[] unencodedData = (byte[]) from; - checkArgument(checkNotNull(unencodedData, "unencodedData").length <= 16 * 1024, - "userData cannot be larger than 16kb"); - return base64().encode(unencodedData); - } -} 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/functions/EncodedRSAPublicKeyToBase64.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/functions/EncodedRSAPublicKeyToBase64.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/functions/EncodedRSAPublicKeyToBase64.java deleted file mode 100644 index 9099a41..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/functions/EncodedRSAPublicKeyToBase64.java +++ /dev/null @@ -1,51 +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.functions; - -import static com.google.common.base.Charsets.UTF_8; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.io.BaseEncoding.base64; - -import javax.inject.Singleton; - -import org.jclouds.util.Predicates2; - -import com.google.common.base.Function; -import com.google.common.base.Predicate; -import com.google.common.base.Predicates; - -/** - * @see <a href= - * "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ImportKeyPair.html" - * /> - * @author Adrian Cole - */ -@Singleton -public class EncodedRSAPublicKeyToBase64 implements Function<Object, String> { - private static final Predicate<String> ALLOWED_MARKERS = Predicates.or( - Predicates2.startsWith("ssh-rsa"), - Predicates2.startsWith("-----BEGIN CERTIFICATE-----"), - Predicates2.startsWith("---- BEGIN SSH2 PUBLIC KEY ----")); - - @Override - public String apply(Object from) { - String fromString = checkNotNull(from, "input").toString(); - checkArgument(ALLOWED_MARKERS.apply(fromString), "must be a ssh public key, conforming to %s ", ALLOWED_MARKERS); - return base64().encode(fromString.getBytes(UTF_8)); - } -} 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/options/BundleInstanceS3StorageOptions.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/options/BundleInstanceS3StorageOptions.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/options/BundleInstanceS3StorageOptions.java deleted file mode 100644 index ec655ae..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/options/BundleInstanceS3StorageOptions.java +++ /dev/null @@ -1,95 +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.options; - -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Preconditions.checkState; - -import org.jclouds.domain.Credentials; -import org.jclouds.ec2.options.internal.BaseEC2RequestOptions; -import org.jclouds.location.Provider; - -import com.google.common.annotations.VisibleForTesting; -import com.google.common.base.Supplier; -import com.google.common.collect.Multimap; -import com.google.inject.Inject; - -/** - * Contains options supported in the Form API for the RegisterImage operation. - * <h2> - * Usage</h2> The recommended way to instantiate a - * BundleInstanceS3StorageOptions object is to statically import - * BundleInstanceS3StorageOptions.Builder.* and invoke a static creation method - * followed by an instance mutator (if needed): - * <p/> - * <code> - * import static org.jclouds.ec2.options.BundleInstanceS3StorageOptions.Builder.* - * <p/> - * EC2Api connection = // get connection - * String imageId = connection.getWindowsServices().bundleInstanceInRegion(...bucketOwnedBy(anotherAccessKey)); - * <code> - * - * @author Adrian Cole - * @see <a - * href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-BundleInstance.html" - * /> - */ -public class BundleInstanceS3StorageOptions extends BaseEC2RequestOptions { - - @Inject - @VisibleForTesting - @Provider - Supplier<Credentials> creds; - - @Override - public Multimap<String, String> buildFormParameters() { - if (getAwsAccessKeyId() == null) { - checkState(creds != null, "creds should have been injected"); - bucketOwnedBy(creds.get().identity); - } - return super.buildFormParameters(); - } - - /** - * - * @param ccessKeyId - * The Access Key ID of the owner of the Amazon S3 bucket. - */ - public BundleInstanceS3StorageOptions bucketOwnedBy(String ccessKeyId) { - formParameters.put("Storage.S3.AWSAccessKeyId", checkNotNull(ccessKeyId, "ccessKeyId")); - return this; - } - - /** - * - * @return The Access Key ID of the owner of the Amazon S3 bucket. - */ - public String getAwsAccessKeyId() { - return getFirstFormOrNull("Storage.S3.AWSAccessKeyId"); - } - - public static class Builder { - /** - * @see BundleInstanceS3StorageOptions#bucketOwnedBy(accessKeyId) - */ - public static BundleInstanceS3StorageOptions bucketOwnedBy(String accessKeyId) { - BundleInstanceS3StorageOptions options = new BundleInstanceS3StorageOptions(); - return options.bucketOwnedBy(accessKeyId); - } - - } -} 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/options/CreateImageOptions.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/options/CreateImageOptions.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/options/CreateImageOptions.java deleted file mode 100644 index 8c604d5..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/options/CreateImageOptions.java +++ /dev/null @@ -1,94 +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.options; - -import static com.google.common.base.Preconditions.checkNotNull; - -import org.jclouds.ec2.options.internal.BaseEC2RequestOptions; - -/** - * Contains options supported in the Form API for the CreateImage operation. <h2> - * Usage</h2> The recommended way to instantiate a CreateImageOptions object is to statically import - * CreateImageOptions.Builder.* and invoke a static creation method followed by an instance mutator - * (if needed): - * <p/> - * <code> - * import static org.jclouds.ec2.options.CreateImageOptions.Builder.* - * <p/> - * EC2Api connection = // get connection - * Future<Set<ImageMetadata>> images = connection.getAMIApi().get().createImage(withDescription("123125").noReboot()); - * <code> - * - * @author Adrian Cole - * @see <a - * href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/index.html?ApiReference-form-CreateImage.html" - * /> - */ -public class CreateImageOptions extends BaseEC2RequestOptions { - public static final CreateImageOptions NONE = new CreateImageOptions(); - - /** - * The description of the AMI that was provided during image creation. - * <p/> - * - * Up to 255 characters - */ - public CreateImageOptions withDescription(String description) { - formParameters.put("Description", checkNotNull(description, "description")); - return this; - } - - public String getDescription() { - return getFirstFormOrNull("Description"); - - } - - /** - * By default this property is set to false, which means Amazon EC2 attempts to cleanly shut down - * the instance before image creation and reboots the instance afterwards. When set to true, - * Amazon EC2 does not shut down the instance before creating the image. When this option is - * used, file system integrity on the created image cannot be guaranteed. - */ - public CreateImageOptions noReboot() { - formParameters.put("NoReboot", "true"); - return this; - } - - public boolean getNoReboot() { - return getFirstFormOrNull("NoReboot") != null; - } - - public static class Builder { - - /** - * @see CreateImageOptions#withDescription(String ) - */ - public static CreateImageOptions withDescription(String description) { - CreateImageOptions options = new CreateImageOptions(); - return options.withDescription(description); - } - - /** - * @see CreateImageOptions#noReboot() - */ - public static CreateImageOptions noReboot() { - CreateImageOptions options = new CreateImageOptions(); - return options.noReboot(); - } - - } -} 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/options/CreateSnapshotOptions.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/options/CreateSnapshotOptions.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/options/CreateSnapshotOptions.java deleted file mode 100644 index 2c05a27..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/options/CreateSnapshotOptions.java +++ /dev/null @@ -1,70 +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.options; - -import static com.google.common.base.Preconditions.checkNotNull; - -import org.jclouds.ec2.options.internal.BaseEC2RequestOptions; - -/** - * Contains options supported in the Form API for the CreateSnapshot operation. <h2> - * Usage</h2> The recommended way to instantiate a CreateSnapshotOptions object is to statically - * import CreateSnapshotOptions.Builder.* and invoke a static creation method followed by an - * instance mutator (if needed): - * <p/> - * <code> - * import static org.jclouds.ec2.options.CreateSnapshotOptions.Builder.* - * <p/> - * EC2Api connection = // get connection - * Snapshot snapshot = connection.getElasticBlockStoreApi().get().createSnapshotInRegion(volumeId, withDescription("123125")); - * <code> - * - * @author Adrian Cole - * @see <a - * href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/index.html?ApiReference-form-CreateSnapshot.html" - * /> - */ -public class CreateSnapshotOptions extends BaseEC2RequestOptions { - - /** - * Description of the Amazon EBS snapshot. - * <p/> - * - * Up to 255 characters - */ - public CreateSnapshotOptions withDescription(String description) { - formParameters.put("Description", checkNotNull(description, "description")); - return this; - } - - public String getDescription() { - return getFirstFormOrNull("Description"); - - } - - public static class Builder { - - /** - * @see CreateSnapshotOptions#withDescription(String ) - */ - public static CreateSnapshotOptions withDescription(String identityId) { - CreateSnapshotOptions options = new CreateSnapshotOptions(); - return options.withDescription(identityId); - } - - } -} 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/options/DescribeAvailabilityZonesOptions.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/options/DescribeAvailabilityZonesOptions.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/options/DescribeAvailabilityZonesOptions.java deleted file mode 100644 index 5b3f693..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/options/DescribeAvailabilityZonesOptions.java +++ /dev/null @@ -1,68 +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.options; - -import java.util.Arrays; -import java.util.Set; - -import org.jclouds.ec2.options.internal.BaseEC2RequestOptions; - -/** - * Contains options supported in the Form API for the DescribeAvailabilityZones operation. <h2> - * Usage</h2> The recommended way to instantiate a DescribeAvailabilityZonesOptions object is to - * statically import DescribeAvailabilityZonesOptions.Builder.* and invoke a static creation method - * followed by an instance mutator (if needed): - * <p/> - * <code> - * import static org.jclouds.ec2.options.DescribeAvailabilityZonesOptions.Builder.* - * <p/> - * EC2Api connection = // get connection - * Future<Set<ImageMetadata>> images = connection.getAvailabilityZoneAndRegionApi().get().describeAvailabilityZones(zones("us-east-1a", "us-east-1b")); - * <code> - * - * @author Adrian Cole - * @see <a - * href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/index.html?ApiReference-form-DescribeAvailabilityZones.html" - * /> - */ -public class DescribeAvailabilityZonesOptions extends BaseEC2RequestOptions { - - /** - * Availability Zone name. - */ - public DescribeAvailabilityZonesOptions zones(String... zones) { - String[] zoneStrings = Arrays.copyOf(zones, zones.length, String[].class); - indexFormValuesWithPrefix("ZoneName", zoneStrings); - return this; - } - - public Set<String> getZones() { - return getFormValuesWithKeysPrefixedBy("ZoneName."); - } - - public static class Builder { - - /** - * @see DescribeAvailabilityZonesOptions#zones(String...) - */ - public static DescribeAvailabilityZonesOptions availabilityZones(String... zones) { - DescribeAvailabilityZonesOptions options = new DescribeAvailabilityZonesOptions(); - return options.zones(zones); - } - - } -} 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/options/DescribeImagesOptions.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/options/DescribeImagesOptions.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/options/DescribeImagesOptions.java deleted file mode 100644 index d81ba88..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/options/DescribeImagesOptions.java +++ /dev/null @@ -1,115 +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.options; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Set; - -import org.jclouds.ec2.options.internal.BaseEC2RequestOptions; - -/** - * Contains options supported in the Form API for the DescribeImages operation. <h2> - * Usage</h2> The recommended way to instantiate a DescribeImagesOptions object is to statically - * import DescribeImagesOptions.Builder.* and invoke a static creation method followed by an - * instance mutator (if needed): - * <p/> - * <code> - * import static org.jclouds.ec2.options.DescribeImagesOptions.Builder.* - * <p/> - * EC2Api connection = // get connection - * Future<Set<ImageMetadata>> images = connection.getAMIApi().get().describeImages(executableBy("123125").imageIds(1000, 1004)); - * <code> - * - * @author Adrian Cole - * @see <a - * href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/index.html?ApiReference-form-DescribeImages.html" - * /> - */ -public class DescribeImagesOptions extends BaseEC2RequestOptions { - public static final DescribeImagesOptions NONE = new DescribeImagesOptions(); - - /** - * AMIs for which the specified user has explicit launch permissions. - * - */ - public DescribeImagesOptions executableBy(String identityId) { - formParameters.put("ExecutableBy", checkNotNull(identityId, "identityId")); - return this; - } - - public String getExecutableBy() { - return getFirstFormOrNull("ExecutableBy"); - } - - /** - * AMI IDs to describe. - */ - public DescribeImagesOptions imageIds(String... imageIds) { - indexFormValuesWithPrefix("ImageId", imageIds); - return this; - } - - public DescribeImagesOptions imageIds(Iterable<String> imageIds) { - indexFormValuesWithPrefix("ImageId", imageIds); - return this; - } - - public Set<String> getImageIds() { - return getFormValuesWithKeysPrefixedBy("ImageId."); - } - - /** - * Returns AMIs owned by the specified owner. Multiple owners can be specified. - */ - public DescribeImagesOptions ownedBy(String... owners) { - indexFormValuesWithPrefix("Owner", owners); - return this; - } - - public Set<String> getOwners() { - return getFormValuesWithKeysPrefixedBy("Owner."); - } - - public static class Builder { - - /** - * @see DescribeImagesOptions#executableBy(String ) - */ - public static DescribeImagesOptions executableBy(String identityId) { - DescribeImagesOptions options = new DescribeImagesOptions(); - return options.executableBy(identityId); - } - - /** - * @see DescribeImagesOptions#imageIds(String[] ) - */ - public static DescribeImagesOptions imageIds(String... imageIds) { - DescribeImagesOptions options = new DescribeImagesOptions(); - return options.imageIds(imageIds); - } - - /** - * @see DescribeImagesOptions#ownedBy(String[] ) - */ - public static DescribeImagesOptions ownedBy(String... owners) { - DescribeImagesOptions options = new DescribeImagesOptions(); - return options.ownedBy(owners); - } - - } -} 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/options/DescribeRegionsOptions.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/options/DescribeRegionsOptions.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/options/DescribeRegionsOptions.java deleted file mode 100644 index 594194d..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/options/DescribeRegionsOptions.java +++ /dev/null @@ -1,68 +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.options; - -import java.util.Arrays; -import java.util.Set; - -import org.jclouds.ec2.options.internal.BaseEC2RequestOptions; - -/** - * Contains options supported in the Form API for the DescribeRegions operation. <h2> - * Usage</h2> The recommended way to instantiate a DescribeRegionsOptions object is to statically - * import DescribeRegionsOptions.Builder.* and invoke a static creation method followed by an - * instance mutator (if needed): - * <p/> - * <code> - * import static org.jclouds.ec2.options.DescribeRegionsOptions.Builder.* - * <p/> - * EC2Api connection = // get connection - * Future<Set<ImageMetadata>> images = connection.getRegionsAndRegionsServices().describeRegions(regions("us-east-1a", "us-east-1b")); - * <code> - * - * @author Adrian Cole - * @see <a - * href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/index.html?ApiReference-form-DescribeRegions.html" - * /> - */ -public class DescribeRegionsOptions extends BaseEC2RequestOptions { - - /** - * Name of a Region. - */ - public DescribeRegionsOptions regions(String... regions) { - String[] regionStrings = Arrays.copyOf(regions, regions.length, String[].class); - indexFormValuesWithPrefix("RegionName", regionStrings); - return this; - } - - public Set<String> getZones() { - return getFormValuesWithKeysPrefixedBy("RegionName."); - } - - public static class Builder { - - /** - * @see DescribeRegionsOptions#regions(String[] ) - */ - public static DescribeRegionsOptions regions(String... regions) { - DescribeRegionsOptions options = new DescribeRegionsOptions(); - return options.regions(regions); - } - - } -} 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/options/DescribeSnapshotsOptions.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/options/DescribeSnapshotsOptions.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/options/DescribeSnapshotsOptions.java deleted file mode 100644 index 8dfe3cb..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/options/DescribeSnapshotsOptions.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.options; - -import java.util.Set; - -import org.jclouds.ec2.options.internal.BaseEC2RequestOptions; - -/** - * Contains options supported in the Form API for the DescribeSnapshots operation. <h2> - * Usage</h2> The recommended way to instantiate a DescribeSnapshotsOptions object is to statically - * import DescribeSnapshotsOptions.Builder.* and invoke a static creation method followed by an - * instance mutator (if needed): - * <p/> - * <code> - * import static org.jclouds.ec2.options.DescribeSnapshotsOptions.Builder.* - * <p/> - * EC2Api connection = // get connection - * Set<Snapshot> snapshots = connection.getElasticBlockStoreApi().get().describeSnapshots(restorableBy("123125").snapshotIds(1000, 1004)); - * <code> - * - * @author Adrian Cole - * @see <a - * href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/index.html?ApiReference-form-DescribeSnapshots.html" - * /> - */ -public class DescribeSnapshotsOptions extends BaseEC2RequestOptions { - - /** - * Account ID of a user that can create volumes from the snapshot. - * - */ - public DescribeSnapshotsOptions restorableBy(String... accountIds) { - indexFormValuesWithPrefix("RestorableBy", accountIds); - return this; - } - - public String getRestorableBy() { - return getFirstFormOrNull("RestorableBy"); - } - - /** - * The ID of the Amazon EBS snapshot. - */ - public DescribeSnapshotsOptions snapshotIds(String... snapshotIds) { - indexFormValuesWithPrefix("SnapshotId", snapshotIds); - return this; - } - - public Set<String> getSnapshotIds() { - return getFormValuesWithKeysPrefixedBy("SnapshotId."); - } - - /** - * Returns snapshots owned by the specified owner. Multiple owners can be specified. - * <p/> - * Valid Values: self | amazon | AWS Account ID - */ - public DescribeSnapshotsOptions ownedBy(String... owners) { - indexFormValuesWithPrefix("Owner", owners); - return this; - } - - public Set<String> getOwners() { - return getFormValuesWithKeysPrefixedBy("Owner."); - } - - public static class Builder { - - /** - * @see DescribeSnapshotsOptions#restorableBy(String[] ) - */ - public static DescribeSnapshotsOptions restorableBy(String... accountIds) { - DescribeSnapshotsOptions options = new DescribeSnapshotsOptions(); - return options.restorableBy(accountIds); - } - - /** - * @see DescribeSnapshotsOptions#snapshotIds(String[] ) - */ - public static DescribeSnapshotsOptions snapshotIds(String... snapshotIds) { - DescribeSnapshotsOptions options = new DescribeSnapshotsOptions(); - return options.snapshotIds(snapshotIds); - } - - /** - * @see DescribeSnapshotsOptions#ownedBy(String[] ) - */ - public static DescribeSnapshotsOptions ownedBy(String... owners) { - DescribeSnapshotsOptions options = new DescribeSnapshotsOptions(); - return options.ownedBy(owners); - } - - } -} 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/options/DetachVolumeOptions.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/options/DetachVolumeOptions.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/options/DetachVolumeOptions.java deleted file mode 100644 index 0b9fc89..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/options/DetachVolumeOptions.java +++ /dev/null @@ -1,86 +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.options; - -import static com.google.common.base.Preconditions.checkNotNull; - -import org.jclouds.ec2.options.internal.BaseEC2RequestOptions; - -/** - * Contains options supported in the Form API for the DetachVolume operation. <h2> - * Usage</h2> The recommended way to instantiate a DetachVolumeOptions object is to statically - * import DetachVolumeOptions.Builder.* and invoke a static creation method followed by an instance - * mutator (if needed): - * <p/> - * <code> - * import static org.jclouds.ec2.options.DetachVolumeOptions.Builder.* - * <p/> - * EC2Api client = // get connection - * client.getElasticBlockStoreApi().get().detachVolumeInRegion(null, id, fromDevice("123125").force()); - * <code> - * - * @author Adrian Cole - * @see <a - * href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/index.html?ApiReference-form-DetachVolume.html" - * /> - */ -public class DetachVolumeOptions extends BaseEC2RequestOptions { - /** - * The ID of the instance. - */ - public DetachVolumeOptions fromInstance(String instanceId) { - formParameters.put("InstanceId", checkNotNull(instanceId, "instanceId")); - return this; - } - - public String getInstance() { - return getFirstFormOrNull("InstanceId"); - - } - - /** - * The device name. - */ - public DetachVolumeOptions fromDevice(String device) { - formParameters.put("Device", checkNotNull(device, "device")); - return this; - } - - public String getDevice() { - return getFirstFormOrNull("Device"); - - } - - public static class Builder { - /** - * @see DetachVolumeOptions#fromInstance(String ) - */ - public static DetachVolumeOptions fromInstance(String instance) { - DetachVolumeOptions options = new DetachVolumeOptions(); - return options.fromInstance(instance); - } - - /** - * @see DetachVolumeOptions#fromDevice(String ) - */ - public static DetachVolumeOptions fromDevice(String device) { - DetachVolumeOptions options = new DetachVolumeOptions(); - return options.fromDevice(device); - } - - } -} 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/options/RegisterImageBackedByEbsOptions.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/options/RegisterImageBackedByEbsOptions.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/options/RegisterImageBackedByEbsOptions.java deleted file mode 100644 index 1da21c0..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/options/RegisterImageBackedByEbsOptions.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.options; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; - -import org.jclouds.ec2.domain.Image.Architecture; -import org.jclouds.javax.annotation.Nullable; - -/** - * Contains options supported in the Form API for the RegisterImage operation. <h2> - * Usage</h2> The recommended way to instantiate a RegisterImageBackedByEbsOptions object is to statically - * import RegisterImageBackedByEbsOptions.Builder.* and invoke a static creation method followed by an instance - * mutator (if needed): - * <p/> - * <code> - * import static org.jclouds.ec2.options.RegisterImageBackedByEbsOptions.Builder.* - * <p/> - * EC2Api connection = // get connection - * String imageId = connection.getImageServices().registerImageBackedByEbs(...addEphemeralBlockDeviceFromSnapshot("/dev/sda2","virtual-1","snapshot-id")); - * <code> - * - * @author Adrian Cole - * @see <a - * href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/index.html?ApiReference-form-RegisterImage.html" - * /> - */ -public class RegisterImageBackedByEbsOptions extends RegisterImageOptions { - - private int deviceIndex = 1; - - /** - * - * adds a block device to the image from an ebs snapshot. This device is deleted on instance - * termination. - * - * @param name - * The device name (e.g., /dev/sdh). - * @param virtualName - * The virtual device name. (nullable) - * @param snapshotId - * The ID of the snapshot. - */ - public RegisterImageBackedByEbsOptions addEphemeralBlockDeviceFromSnapshot(String deviceName, - @Nullable String virtualName, String snapshotId) { - formParameters.put("BlockDeviceMapping." + deviceIndex + ".DeviceName", checkNotNull( - deviceName, "deviceName")); - if (virtualName != null) - formParameters.put("BlockDeviceMapping." + deviceIndex + ".VirtualName", checkNotNull( - virtualName, "virtualName")); - formParameters.put("BlockDeviceMapping." + deviceIndex + ".Ebs.SnapshotId", checkNotNull( - snapshotId, "snapshotId")); - deviceIndex++; - return this; - } - - /** - * - * adds a new block device to the image. This device is deleted on instance termination. - * - * @param name - * The device name (e.g., /dev/sdh). - * @param virtualName - * The virtual device name. - * @param volumeSize - * The size of the volume, in GiBs. - */ - public RegisterImageBackedByEbsOptions addNewEphemeralBlockDevice(String deviceName, - @Nullable String virtualName, int volumeSize) { - checkArgument(volumeSize > 0 && volumeSize < 1025, "volumeSize must be between 1 and 1024 gb"); - formParameters.put("BlockDeviceMapping." + deviceIndex + ".DeviceName", checkNotNull( - deviceName, "deviceName")); - if (virtualName != null) - formParameters.put("BlockDeviceMapping." + deviceIndex + ".VirtualName", checkNotNull( - virtualName, "virtualName")); - formParameters.put("BlockDeviceMapping." + deviceIndex + ".Ebs.VolumeSize", volumeSize + ""); - deviceIndex++; - return this; - } - - /** - * - * adds a block device to the image from an ebs snapshot. This device is retained on instance - * termination. - * - * @param name - * The device name (e.g., /dev/sdh). - * @param virtualName - * The virtual device name. (nullable) - * @param snapshotId - * The ID of the snapshot. - */ - public RegisterImageBackedByEbsOptions addBlockDeviceFromSnapshot(String deviceName, - @Nullable String virtualName, String snapshotId) { - formParameters.put("BlockDeviceMapping." + deviceIndex + ".Ebs.DeleteOnTermination", "false"); - addEphemeralBlockDeviceFromSnapshot(deviceName, virtualName, snapshotId); - return this; - } - - /** - * - * adds a new block device to the image. This device is retained on instance termination. - * - * @param name - * The device name (e.g., /dev/sdh). - * @param virtualName - * The virtual device name. - * @param volumeSize - * The size of the volume, in GiBs.. - */ - public RegisterImageBackedByEbsOptions addNewBlockDevice(String deviceName, - @Nullable String virtualName, int volumeSize) { - formParameters.put("BlockDeviceMapping." + deviceIndex + ".Ebs.DeleteOnTermination", "false"); - addNewEphemeralBlockDevice(deviceName, virtualName, volumeSize); - return this; - } - - public static class Builder { - /** - * @see RegisterImageBackedByEbsOptions#asArchitecture(Architecture) - */ - public static RegisterImageBackedByEbsOptions asArchitecture(Architecture architecture) { - RegisterImageBackedByEbsOptions options = new RegisterImageBackedByEbsOptions(); - return options.asArchitecture(architecture); - } - - /** - * @see RegisterImageBackedByEbsOptions#withDescription(String) - */ - public static RegisterImageBackedByEbsOptions withDescription(String additionalInfo) { - RegisterImageBackedByEbsOptions options = new RegisterImageBackedByEbsOptions(); - return options.withDescription(additionalInfo); - } - - /** - * @see RegisterImageBackedByEbsOptions#withKernelId(String) - */ - public static RegisterImageBackedByEbsOptions withKernelId(String kernelId) { - RegisterImageBackedByEbsOptions options = new RegisterImageBackedByEbsOptions(); - return options.withKernelId(kernelId); - } - - /** - * @see RegisterImageBackedByEbsOptions#withRamdisk(String) - */ - public static RegisterImageBackedByEbsOptions withRamdisk(String ramdiskId) { - RegisterImageBackedByEbsOptions options = new RegisterImageBackedByEbsOptions(); - return options.withRamdisk(ramdiskId); - } - - /** - * @see RegisterImageBackedByEbsOptions#addBlockDeviceFromSnapshot(String, String, String) - */ - public static RegisterImageBackedByEbsOptions addBlockDeviceFromSnapshot(String deviceName, - @Nullable String virtualName, String snapshotId) { - RegisterImageBackedByEbsOptions options = new RegisterImageBackedByEbsOptions(); - return options.addBlockDeviceFromSnapshot(deviceName, virtualName, snapshotId); - } - - /** - * @see RegisterImageBackedByEbsOptions#addEphemeralBlockDeviceFromSnapshot(String, String, - * String) - */ - public static RegisterImageBackedByEbsOptions addEphemeralBlockDeviceFromSnapshot( - String deviceName, @Nullable String virtualName, String snapshotId) { - RegisterImageBackedByEbsOptions options = new RegisterImageBackedByEbsOptions(); - return options.addEphemeralBlockDeviceFromSnapshot(deviceName, virtualName, snapshotId); - } - - /** - * @see RegisterImageBackedByEbsOptions#addNewBlockDevice(String, String, int) - */ - public static RegisterImageBackedByEbsOptions addNewBlockDevice(String deviceName, - @Nullable String virtualName, int volumeSize) { - RegisterImageBackedByEbsOptions options = new RegisterImageBackedByEbsOptions(); - return options.addNewBlockDevice(deviceName, virtualName, volumeSize); - } - - /** - * @see RegisterImageBackedByEbsOptions#addNewEphemeralBlockDevice(String, String, int) - */ - public static RegisterImageBackedByEbsOptions addNewEphemeralBlockDevice(String deviceName, - @Nullable String virtualName, int volumeSize) { - RegisterImageBackedByEbsOptions options = new RegisterImageBackedByEbsOptions(); - return options.addNewEphemeralBlockDevice(deviceName, virtualName, volumeSize); - } - } - - /** - * {@inheritDoc} - */ - @Override - public RegisterImageBackedByEbsOptions asArchitecture(Architecture architecture) { - return (RegisterImageBackedByEbsOptions) super.asArchitecture(architecture); - } - - /** - * {@inheritDoc} - */ - @Override - public RegisterImageBackedByEbsOptions withDescription(String info) { - return (RegisterImageBackedByEbsOptions) super.withDescription(info); - } - - /** - * {@inheritDoc} - */ - @Override - public RegisterImageBackedByEbsOptions withKernelId(String kernelId) { - return (RegisterImageBackedByEbsOptions) super.withKernelId(kernelId); - } - - /** - * {@inheritDoc} - */ - @Override - public RegisterImageBackedByEbsOptions withRamdisk(String ramDiskId) { - return (RegisterImageBackedByEbsOptions) super.withRamdisk(ramDiskId); - } -}
