http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/describe_subnets.xml ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/describe_subnets.xml b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/describe_subnets.xml deleted file mode 100644 index 7fe8697..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/describe_subnets.xml +++ /dev/null @@ -1,33 +0,0 @@ -<DescribeSubnetsResponse xmlns="http://ec2.amazonaws.com/doc/2012-12-01/"> - <requestId>7a62c49f-347e-4fc4-9331-6e8eEXAMPLE</requestId> - <subnetSet> - <item> - <subnetId>subnet-9d4a7b6c</subnetId> - <state>available</state> - <vpcId>vpc-1a2b3c4d</vpcId> - <cidrBlock>10.0.1.0/24</cidrBlock> - <availableIpAddressCount>250</availableIpAddressCount> - <availabilityZone>us-east-1a</availabilityZone> - <tagSet> - <item> - <key>Name</key> - <value>ec2-o</value> - </item> - <item> - <key>Empty</key> - <value /> - </item> - </tagSet> - </item> - <item> - <subnetId>subnet-6e7f829e</subnetId> - <state>available</state> - <vpcId>vpc-1a2b3c4d</vpcId> - <cidrBlock>10.0.0.0/24</cidrBlock> - <availableIpAddressCount>250</availableIpAddressCount> - <availabilityZone>us-east-1a</availabilityZone> - <tagSet/> - - </item> - </subnetSet> -</DescribeSubnetsResponse> \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/describe_tags.xml ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/describe_tags.xml b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/describe_tags.xml deleted file mode 100644 index be5efb7..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/describe_tags.xml +++ /dev/null @@ -1,29 +0,0 @@ -<DescribeTagsResponse xmlns="http://ec2.amazonaws.com/doc/2012-10-01/"> - <requestId>7a62c49f-347e-4fc4-9331-6e8eEXAMPLE</requestId> - <tagSet> - <item> - <resourceId>i-5f4e3d2a</resourceId> - <resourceType>instance</resourceType> - <key>webserver</key> - <value/> - </item> - <item> - <resourceId>i-5f4e3d2a</resourceId> - <resourceType>instance</resourceType> - <key>stack</key> - <value>Production</value> - </item> - <item> - <resourceId>i-12345678</resourceId> - <resourceType>instance</resourceType> - <key>database_server</key> - <value/> - </item> - <item> - <resourceId>i-12345678</resourceId> - <resourceType>instance</resourceType> - <key>stack</key> - <value>Test</value> - </item> - </tagSet> -</DescribeTagsResponse> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/describe_volumes.xml ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/describe_volumes.xml b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/describe_volumes.xml deleted file mode 100644 index 45b3efa..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/describe_volumes.xml +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0"?> -<DescribeVolumesResponse xmlns="http://ec2.amazonaws.com/doc/2009-11-30/"> - <requestId>31ab5542-e479-44cb-aa94-c340c2481e0b</requestId> - <volumeSet> - <item> - <volumeId>vol-2a21e543</volumeId> - <size>1</size> - <snapshotId /> - <availabilityZone>us-east-1a</availabilityZone> - <status>available</status> - <createTime>2009-12-28T05:42:53.000Z</createTime> - <attachmentSet /> - </item> - <item> - <volumeId>vol-4282672b</volumeId> - <size>800</size> - <snapshotId>snap-536d1b3a</snapshotId> - <availabilityZone>us-east-1a</availabilityZone> - <status>in-use</status> - <createTime>2008-05-07T11:51:50.000Z</createTime> - <attachmentSet> - <item> - <volumeId>vol-4282672b</volumeId> - <instanceId>i-6058a509</instanceId> - <device>/dev/sdh</device> - <status>attached</status> - <attachTime>2008-05-07T12:51:50.000Z</attachTime> - </item> - </attachmentSet> - </item> - </volumeSet> -</DescribeVolumesResponse> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/describe_volumes_single.xml ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/describe_volumes_single.xml b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/describe_volumes_single.xml deleted file mode 100644 index fcc10a5..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/describe_volumes_single.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0"?> -<DescribeVolumesResponse xmlns="http://ec2.amazonaws.com/doc/2009-11-30/"> - <requestId>31ab5542-e479-44cb-aa94-c340c2481e0b</requestId> - <volumeSet> - <item> - <volumeId>vol-4282672b</volumeId> - <size>800</size> - <snapshotId>snap-536d1b3a</snapshotId> - <availabilityZone>us-east-1a</availabilityZone> - <status>in-use</status> - <createTime>2008-05-07T11:51:50.000Z</createTime> - <attachmentSet /> - </item> - </volumeSet> -</DescribeVolumesResponse> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/disableApiTermination.xml ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/disableApiTermination.xml b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/disableApiTermination.xml deleted file mode 100644 index a01ca32..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/disableApiTermination.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0"?> -<DescribeInstanceAttributeResponse xmlns="http://ec2.amazonaws.com/doc/2009-11-30/"> - <requestId>b47e8cff-0647-4260-adfe-022c878b1f7d</requestId> - <instanceId>i-e9290f81</instanceId> - <disableApiTermination> - <value>false</value> - </disableApiTermination> -</DescribeInstanceAttributeResponse> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/get_console_output_response.xml ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/get_console_output_response.xml b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/get_console_output_response.xml deleted file mode 100644 index caf3ac9..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/get_console_output_response.xml +++ /dev/null @@ -1,13 +0,0 @@ -<GetConsoleOutputResponse xmlns="http://ec2.amazonaws.com/doc/2012-05-01/"> - <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId> - <instanceId>i-28a64341</instanceId> - <timestamp>2010-10-14T01:12:41.000Z</timestamp> - <output>TGludXggdmVyc2lvbiAyLjYuMTYteGVuVSAoYnVpbGRlckBwYXRjaGJhdC5hbWF6b25zYSkgKGdj -YyB2ZXJzaW9uIDQuMC4xIDIwMDUwNzI3IChSZWQgSGF0IDQuMC4xLTUpKSAjMSBTTVAgVGh1IE9j -dCAyNiAwODo0MToyNiBTQVNUIDIwMDYKQklPUy1wcm92aWRlZCBwaHlzaWNhbCBSQU0gbWFwOgpY -ZW46IDAwMDAwMDAwMDAwMDAwMDAgLSAwMDAwMDAwMDZhNDAwMDAwICh1c2FibGUpCjk4ME1CIEhJ -R0hNRU0gYXZhaWxhYmxlLgo3MjdNQiBMT1dNRU0gYXZhaWxhYmxlLgpOWCAoRXhlY3V0ZSBEaXNh -YmxlKSBwcm90ZWN0aW9uOiBhY3RpdmUKSVJRIGxvY2t1cCBkZXRlY3Rpb24gZGlzYWJsZWQKQnVp -bHQgMSB6b25lbGlzdHMKS2VybmVsIGNvbW1hbmQgbGluZTogcm9vdD0vZGV2L3NkYTEgcm8gNApF -bmFibGluZyBmYXN0IEZQVSBzYXZlIGFuZCByZXN0b3JlLi4uIGRvbmUuCg==</output> -</GetConsoleOutputResponse> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/get_passworddata.xml ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/get_passworddata.xml b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/get_passworddata.xml deleted file mode 100644 index a26932a..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/get_passworddata.xml +++ /dev/null @@ -1,6 +0,0 @@ -<GetPasswordDataResponse xmlns="http://ec2.amazonaws.com/doc/2012-06-15/"> - <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId> - <instanceId>i-2574e22a</instanceId> - <timestamp>2012-07-30T07:27:23.000+0000</timestamp> - <passwordData>TGludXggdmVyc2lvbiAyLjYuMTYteGVuVSAoYnVpbGRlckBwYXRjaGJhdC5hbWF6b25zYSkgKGdj</passwordData> -</GetPasswordDataResponse> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/instanceInitiatedShutdownBehavior.xml ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/instanceInitiatedShutdownBehavior.xml b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/instanceInitiatedShutdownBehavior.xml deleted file mode 100644 index dea1e6e..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/instanceInitiatedShutdownBehavior.xml +++ /dev/null @@ -1,7 +0,0 @@ -<DescribeInstanceAttributeResponse xmlns="http://ec2.amazonaws.com/doc/2009-11-30/"> - <requestId>564827a8-c70d-4a76-bb9b-87fb5e5a6cee</requestId> - <instanceId>i-7736101f</instanceId> - <instanceInitiatedShutdownBehavior> - <value>stop</value> - </instanceInitiatedShutdownBehavior> -</DescribeInstanceAttributeResponse> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/instanceType.xml ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/instanceType.xml b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/instanceType.xml deleted file mode 100644 index 9143645..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/instanceType.xml +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0"?> -<DescribeInstanceAttributeResponse - xmlns="http://ec2.amazonaws.com/doc/2009-11-30/"> - <requestId>947779ee-439a-46b5-82db-5f015f75b6d0</requestId> - <instanceId>i-7736101f</instanceId> - <instanceType> - <value>m1.small</value> - </instanceType> -</DescribeInstanceAttributeResponse> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/log4j.xml ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/log4j.xml b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/log4j.xml deleted file mode 100644 index 7527432..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/log4j.xml +++ /dev/null @@ -1,166 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> - - <!-- - For more configuration infromation and examples see the Apache - Log4j website: http://logging.apache.org/log4j/ - --> -<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" - debug="false"> - - <!-- A time/date based rolling appender --> - <appender name="WIREFILE" class="org.apache.log4j.DailyRollingFileAppender"> - <param name="File" value="target/test-data/jclouds-wire.log" /> - <param name="Append" value="true" /> - - <!-- Rollover at midnight each day --> - <param name="DatePattern" value="'.'yyyy-MM-dd" /> - - <param name="Threshold" value="TRACE" /> - - <layout class="org.apache.log4j.PatternLayout"> - <!-- The default pattern: Date Priority [Category] Message\n --> - <param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" /> - - <!-- - The full pattern: Date MS Priority [Category] - (Thread:NDC) Message\n <param name="ConversionPattern" - value="%d %-5r %-5p [%c] (%t:%x) %m%n"/> - --> - </layout> - </appender> - - <!-- A time/date based rolling appender --> - <appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender"> - <param name="File" value="target/test-data/jclouds.log" /> - <param name="Append" value="true" /> - - <!-- Rollover at midnight each day --> - <param name="DatePattern" value="'.'yyyy-MM-dd" /> - - <param name="Threshold" value="TRACE" /> - - <layout class="org.apache.log4j.PatternLayout"> - <!-- The default pattern: Date Priority [Category] Message\n --> - <param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" /> - - <!-- - The full pattern: Date MS Priority [Category] - (Thread:NDC) Message\n <param name="ConversionPattern" - value="%d %-5r %-5p [%c] (%t:%x) %m%n"/> - --> - </layout> - </appender> - <!-- A time/date based rolling appender --> - <appender name="BLOBSTOREFILE" class="org.apache.log4j.DailyRollingFileAppender"> - <param name="File" value="target/test-data/jclouds-blobstore.log" /> - <param name="Append" value="true" /> - <param name="DatePattern" value="'.'yyyy-MM-dd" /> - <param name="Threshold" value="TRACE" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" /> - </layout> - </appender> - - <!-- A time/date based rolling appender --> - <appender name="COMPUTEFILE" class="org.apache.log4j.DailyRollingFileAppender"> - <param name="File" value="target/test-data/jclouds-compute.log" /> - <param name="Append" value="true" /> - - <!-- Rollover at midnight each day --> - <param name="DatePattern" value="'.'yyyy-MM-dd" /> - - <param name="Threshold" value="TRACE" /> - - <layout class="org.apache.log4j.PatternLayout"> - <!-- The default pattern: Date Priority [Category] Message\n --> - <param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" /> - - <!-- - The full pattern: Date MS Priority [Category] - (Thread:NDC) Message\n <param name="ConversionPattern" - value="%d %-5r %-5p [%c] (%t:%x) %m%n"/> - --> - </layout> - </appender> - - <!-- A time/date based rolling appender --> - <appender name="SSHFILE" class="org.apache.log4j.DailyRollingFileAppender"> - <param name="File" value="target/test-data/jclouds-ssh.log" /> - <param name="Append" value="true" /> - - <!-- Rollover at midnight each day --> - <param name="DatePattern" value="'.'yyyy-MM-dd" /> - - <param name="Threshold" value="TRACE" /> - - <layout class="org.apache.log4j.PatternLayout"> - <!-- The default pattern: Date Priority [Category] Message\n --> - <param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" /> - - <!-- - The full pattern: Date MS Priority [Category] - (Thread:NDC) Message\n <param name="ConversionPattern" - value="%d %-5r %-5p [%c] (%t:%x) %m%n"/> - --> - </layout> - </appender> - - <appender name="ASYNCCOMPUTE" class="org.apache.log4j.AsyncAppender"> - <appender-ref ref="COMPUTEFILE" /> - </appender> - - <appender name="ASYNCSSH" class="org.apache.log4j.AsyncAppender"> - <appender-ref ref="SSHFILE" /> - </appender> - - <appender name="ASYNC" class="org.apache.log4j.AsyncAppender"> - <appender-ref ref="FILE" /> - </appender> - - <appender name="ASYNCWIRE" class="org.apache.log4j.AsyncAppender"> - <appender-ref ref="WIREFILE" /> - </appender> - - <appender name="ASYNCBLOBSTORE" class="org.apache.log4j.AsyncAppender"> - <appender-ref ref="BLOBSTOREFILE" /> - </appender> - <!-- ================ --> - <!-- Limit categories --> - <!-- ================ --> - - <category name="org.jclouds"> - <priority value="DEBUG" /> - <appender-ref ref="ASYNC" /> - </category> - - <category name="jclouds.headers"> - <priority value="DEBUG" /> - <appender-ref ref="ASYNCWIRE" /> - </category> - - <category name="jclouds.ssh"> - <priority value="DEBUG" /> - <appender-ref ref="ASYNCSSH" /> - </category> - <category name="jclouds.wire"> - <priority value="DEBUG" /> - <appender-ref ref="ASYNCWIRE" /> - </category> - <category name="jclouds.blobstore"> - <priority value="DEBUG" /> - <appender-ref ref="ASYNCBLOBSTORE" /> - </category> - <category name="jclouds.compute"> - <priority value="TRACE" /> - <appender-ref ref="ASYNCCOMPUTE" /> - </category> - <!-- ======================= --> - <!-- Setup the Root category --> - <!-- ======================= --> - - <root> - <priority value="WARN" /> - </root> - -</log4j:configuration> http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/new_instance.xml ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/new_instance.xml b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/new_instance.xml deleted file mode 100644 index 17a7b5f..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/new_instance.xml +++ /dev/null @@ -1,56 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<RunInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2011-05-15/"> - <requestId>99260d2b-1bdc-4473-b386-48d22e96900a</requestId> - <reservationId>r-205ad944</reservationId> - <ownerId>993194456877</ownerId> - <groupSet> - <item> - <groupId>sg-3c6ef654</groupId> - <groupName>jclouds#test</groupName> - </item> - </groupSet> - <instancesSet> - <item> - <instanceId>i-2baa5550</instanceId> - <imageId>ami-aecd60c7</imageId> - <instanceState> - <code>0</code> - <name>pending</name> - </instanceState> - <privateDnsName/> - <dnsName/> - <reason/> - <keyName>jclouds#test#0</keyName> - <amiLaunchIndex>0</amiLaunchIndex> - <productCodes/> - <instanceType>t1.micro</instanceType> - <launchTime>2012-08-02T04:28:30.000Z</launchTime> - <placement> - <availabilityZone>us-east-1e</availabilityZone> - <groupName/> - <tenancy>default</tenancy> - </placement> - <kernelId>aki-88aa75e1</kernelId> - <monitoring> - <state>disabled</state> - </monitoring> - <groupSet> - <item> - <groupId>sg-3c6ef654</groupId> - <groupName>jclouds#test</groupName> - </item> - </groupSet> - <stateReason> - <code>pending</code> - <message>pending</message> - </stateReason> - <architecture>x86_64</architecture> - <rootDeviceType>ebs</rootDeviceType> - <rootDeviceName>/dev/sda1</rootDeviceName> - <blockDeviceMapping/> - <virtualizationType>paravirtual</virtualizationType> - <clientToken/> - <hypervisor>xen</hypervisor> - </item> - </instancesSet> -</RunInstancesResponse> http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/new_securitygroup.xml ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/new_securitygroup.xml b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/new_securitygroup.xml deleted file mode 100644 index ce275aa..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/new_securitygroup.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<DescribeSecurityGroupsResponse xmlns="http://ec2.amazonaws.com/doc/2011-05-15/"> - <requestId>6df3e2a6-76c0-414b-89ff-9318144e0bbe</requestId> - <securityGroupInfo> - <item> - <ownerId>993194456877</ownerId> - <groupId>sg-3c6ef654</groupId> - <groupName>jclouds#test</groupName> - <groupDescription>jclouds#test</groupDescription> - <ipPermissions/> - <ipPermissionsEgress/> - </item> - </securityGroupInfo> -</DescribeSecurityGroupsResponse> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/ramdisk.xml ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/ramdisk.xml b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/ramdisk.xml deleted file mode 100644 index 8acfc40..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/ramdisk.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0"?> -<DescribeInstanceAttributeResponse xmlns="http://ec2.amazonaws.com/doc/2009-11-30/"> - <requestId>94174289-29d5-40d2-95f2-2b3d3005d58c</requestId> - <instanceId>i-c72d0baf</instanceId> - <ramdisk> - <value>ari-a51cf9cc</value> - </ramdisk> -</DescribeInstanceAttributeResponse> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/regionEndpoints-additional.xml ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/regionEndpoints-additional.xml b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/regionEndpoints-additional.xml deleted file mode 100644 index 38e27f6..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/regionEndpoints-additional.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0"?> -<DescribeRegionsResponse xmlns="http://ec2.amazonaws.com/doc/2009-11-30/"> - <requestId>2bffb2f8-3b03-4be9-92bd-a35b27a2f51a</requestId> - <regionInfo> - <item> - <regionName>eu-west-1</regionName> - <regionEndpoint>ec2.eu-west-1.amazonaws.com</regionEndpoint> - </item> - <item> - <regionName>us-east-1</regionName> - <regionEndpoint>ec2.us-east-1.amazonaws.com</regionEndpoint> - </item> - <item> - <regionName>us-west-1</regionName> - <regionEndpoint>ec2.us-west-1.amazonaws.com</regionEndpoint> - </item> - <item> - <regionName>jp-west-1</regionName> - <regionEndpoint>ec2.jp-west-1.amazonaws.com</regionEndpoint> - </item> - </regionInfo> -</DescribeRegionsResponse> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/regionEndpoints-all.xml ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/regionEndpoints-all.xml b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/regionEndpoints-all.xml deleted file mode 100644 index d577f72..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/regionEndpoints-all.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<DescribeRegionsResponse xmlns="http://ec2.amazonaws.com/doc/2011-05-15/"> - <requestId>8392a998-c7bb-41fc-be15-045f528d7627</requestId> - <regionInfo> - <item> - <regionName>eu-west-1</regionName> - <regionEndpoint>ec2.eu-west-1.amazonaws.com</regionEndpoint> - </item> - <item> - <regionName>sa-east-1</regionName> - <regionEndpoint>ec2.sa-east-1.amazonaws.com</regionEndpoint> - </item> - <item> - <regionName>us-east-1</regionName> - <regionEndpoint>ec2.us-east-1.amazonaws.com</regionEndpoint> - </item> - <item> - <regionName>ap-northeast-1</regionName> - <regionEndpoint>ec2.ap-northeast-1.amazonaws.com</regionEndpoint> - </item> - <item> - <regionName>us-west-2</regionName> - <regionEndpoint>ec2.us-west-2.amazonaws.com</regionEndpoint> - </item> - <item> - <regionName>us-west-1</regionName> - <regionEndpoint>ec2.us-west-1.amazonaws.com</regionEndpoint> - </item> - <item> - <regionName>ap-southeast-1</regionName> - <regionEndpoint>ec2.ap-southeast-1.amazonaws.com</regionEndpoint> - </item> - </regionInfo> -</DescribeRegionsResponse> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/regionEndpoints.xml ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/regionEndpoints.xml b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/regionEndpoints.xml deleted file mode 100644 index 3849b8e..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/regionEndpoints.xml +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0"?> -<DescribeRegionsResponse xmlns="http://ec2.amazonaws.com/doc/2009-11-30/"> - <requestId>2bffb2f8-3b03-4be9-92bd-a35b27a2f51a</requestId> - <regionInfo> - <item> - <regionName>eu-west-1</regionName> - <regionEndpoint>ec2.eu-west-1.amazonaws.com</regionEndpoint> - </item> - <item> - <regionName>us-east-1</regionName> - <regionEndpoint>ec2.us-east-1.amazonaws.com</regionEndpoint> - </item> - <item> - <regionName>us-west-1</regionName> - <regionEndpoint>ec2.us-west-1.amazonaws.com</regionEndpoint> - </item> - </regionInfo> -</DescribeRegionsResponse> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/run_instances.xml ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/run_instances.xml b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/run_instances.xml deleted file mode 100644 index 0b547fa..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/run_instances.xml +++ /dev/null @@ -1,74 +0,0 @@ -<RunInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2009-11-30/"> - <reservationId>r-47a5402e</reservationId> - <ownerId>AIDADH4IGTRXXKCD</ownerId> - <groupSet> - <item> - <groupId>default</groupId> - </item> - </groupSet> - <instancesSet> - <item> - <instanceId>i-2ba64342</instanceId> - <imageId>ami-60a54009</imageId> - <instanceState> - <code>0</code> - <name>pending</name> - </instanceState> - <privateDnsName></privateDnsName> - <dnsName></dnsName> - <keyName>example-key-name</keyName> - <amiLaunchIndex>0</amiLaunchIndex> - <instanceType>m1.small</instanceType> - <launchTime>2007-08-07T11:51:50.000Z</launchTime> - <placement> - <availabilityZone>us-east-1b</availabilityZone> - </placement> - <monitoring> - <state>enabled</state> - </monitoring> - <hypervisor>xen</hypervisor> - </item> - <item> - <instanceId>i-2bc64242</instanceId> - <imageId>ami-60a54009</imageId> - <instanceState> - <code>0</code> - <name>pending</name> - </instanceState> - <privateDnsName></privateDnsName> - <dnsName></dnsName> - <keyName>example-key-name</keyName> - <amiLaunchIndex>1</amiLaunchIndex> - <instanceType>m1.small</instanceType> - <launchTime>2007-08-07T11:51:50.000Z</launchTime> - <placement> - <availabilityZone>us-east-1b</availabilityZone> - </placement> - <monitoring> - <state>enabled</state> - </monitoring> - <hypervisor>xen</hypervisor> - </item> - <item> - <instanceId>i-2be64332</instanceId> - <imageId>ami-60a54009</imageId> - <instanceState> - <code>0</code> - <name>pending</name> - </instanceState> - <privateDnsName></privateDnsName> - <dnsName></dnsName> - <keyName>example-key-name</keyName> - <amiLaunchIndex>2</amiLaunchIndex> - <instanceType>m1.small</instanceType> - <launchTime>2007-08-07T11:51:50.000Z</launchTime> - <placement> - <availabilityZone>us-east-1b</availabilityZone> - </placement> - <monitoring> - <state>enabled</state> - </monitoring> - <hypervisor>xen</hypervisor> - </item> - </instancesSet> -</RunInstancesResponse> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/run_instances_cloudbridge.xml ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/run_instances_cloudbridge.xml b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/run_instances_cloudbridge.xml deleted file mode 100644 index 7dc31f0..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/run_instances_cloudbridge.xml +++ /dev/null @@ -1,68 +0,0 @@ -<?xml version="1.0"?> -<RunInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2010-08-31/"> - <requestId>56eeacd9-c790-45c3-85f3-e4380b55e1d8</requestId> - <reservationId>r-f847a6ca</reservationId> - <ownerId>55ed6530-9b32-48f1-acb7-6ec0d3255a65</ownerId> - <groupSet> - <item> - <groupId>jclouds#greenqloud-computeblock</groupId> - </item> - <item> - <groupId>jclouds#greenqloud-computeblock</groupId> - </item> - </groupSet> - <instancesSet> - <item> - <instanceId>i-01b0dac3</instanceId> - <imageId>qmi-9ac92558</imageId> - <instanceState> - <code>0</code> - <name>pending</name> - </instanceState> - <privateDnsName/> - <dnsName/> - <reason/> - <keyName>jclouds#greenqloud-computeblock#35</keyName> - <amiLaunchIndex>0</amiLaunchIndex> - <productCodes> - <item> - <productCode/> - </item> - </productCodes> - <instanceType>m1.small</instanceType> - <launchTime>2012-06-15T19:06:35.000+00:00</launchTime> - <placement> - <availabilityZone>is-1a</availabilityZone> - </placement> - <kernelId/> - <ramdiskId/> - <platform/> - <monitoring> - <state>disabled</state> - </monitoring> - <subnetId/> - <vpcId/> - <privateIpAddress/> - <groupSet> - <item> - <groupId>jclouds#greenqloud-computeblock</groupId> - </item> - <item> - <groupId>jclouds#greenqloud-computeblock</groupId> - </item> - </groupSet> - <stateReason> - <code>pending</code> - <message>pending</message> - </stateReason> - <architecture/> - <rootDeviceType>ebs</rootDeviceType> - <rootDeviceName/> - <blockDeviceMapping/> - <instanceLifecycle/> - <spotInstanceRequestId/> - <hypervisor>xen</hypervisor> - </item> - </instancesSet> - <requesterId/> -</RunInstancesResponse> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/start_instances.xml ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/start_instances.xml b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/start_instances.xml deleted file mode 100644 index de0ab4c..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/start_instances.xml +++ /dev/null @@ -1,15 +0,0 @@ -<StartInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2009-11-30/"> - <instancesSet> - <item> - <instanceId>i-10a64379</instanceId> - <currentState> - <code>0</code> - <name>pending</name> - </currentState> - <previousState> - <code>80</code> - <name>stopped</name> - </previousState> - </item> - </instancesSet> -</StartInstancesResponse> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/stop_instances.xml ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/stop_instances.xml b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/stop_instances.xml deleted file mode 100644 index 2c3530a..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/stop_instances.xml +++ /dev/null @@ -1,15 +0,0 @@ -<StopInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2009-11-30/"> - <instancesSet> - <item> - <instanceId>i-10a64379</instanceId> - <currentState> - <code>64</code> - <name>stopping</name> - </currentState> - <previousState> - <code>16</code> - <name>running</name> - </previousState> - </item> - </instancesSet> -</StopInstancesResponse> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/terminate_instances.xml ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/terminate_instances.xml b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/terminate_instances.xml deleted file mode 100644 index bf4fd4e..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/terminate_instances.xml +++ /dev/null @@ -1,15 +0,0 @@ -<TerminateInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2009-11-30/"> - <instancesSet> - <item> - <instanceId>i-3ea74257</instanceId> - <shutdownState> - <code>32</code> - <name>shutting-down</name> - </shutdownState> - <previousState> - <code>16</code> - <name>running</name> - </previousState> - </item> - </instancesSet> -</TerminateInstancesResponse> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/userData.xml ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/userData.xml b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/userData.xml deleted file mode 100644 index f0f7972..0000000 --- a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/test/resources/userData.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0"?> -<DescribeInstanceAttributeResponse xmlns="http://ec2.amazonaws.com/doc/2009-11-30/"> - <requestId>0d0ca353-fba3-402c-8516-005e2b41d0ba</requestId> - <instanceId>i-c72d0baf</instanceId> - <userData> - <value>IyEvYmluL2Jhc2gK</value> - </userData> -</DescribeInstanceAttributeResponse> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.8.0-stratos/README.txt ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.8.0-stratos/README.txt b/dependencies/jclouds/apis/ec2/1.8.0-stratos/README.txt new file mode 100644 index 0000000..11db7a2 --- /dev/null +++ b/dependencies/jclouds/apis/ec2/1.8.0-stratos/README.txt @@ -0,0 +1,15 @@ +# +# The jclouds API for Amazon's EC2 service (http://aws.amazon.com/ec2/). +# +# TODO: Implementation status. +# TODO: Supported features. +# TODO: Usage example. + +NOTE: The live tests in apis/ec2 will *not* work against AWS EC2 with AWS accounts created +from December 04, 2013 and onward, due to those accounts only supporting VPC, and VPC requiring +different parameters (ID rather than name) for referring to and acting on security groups. + +To run the EC2 live tests against AWS, go to providers/aws-ec2. + +apis/ec2 will retain the older security group name usage to support EC2 API shims, +such as OpenStack, CloudStack, etc. \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.8.0-stratos/pom.xml ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.8.0-stratos/pom.xml b/dependencies/jclouds/apis/ec2/1.8.0-stratos/pom.xml new file mode 100644 index 0000000..fc95b3d --- /dev/null +++ b/dependencies/jclouds/apis/ec2/1.8.0-stratos/pom.xml @@ -0,0 +1,144 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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. + +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.jclouds</groupId> + <artifactId>jclouds-project</artifactId> + <version>1.8.0</version> + </parent> + <groupId>org.apache.stratos</groupId> + <artifactId>ec2</artifactId> + <version>1.8.0-stratos</version> + <name>jclouds ec2 api</name> + <description>jclouds components to access an implementation of EC2</description> + <packaging>bundle</packaging> + + <properties> + <jclouds.version>1.8.0</jclouds.version> + <test.ec2.endpoint>https://ec2.us-east-1.amazonaws.com</test.ec2.endpoint> + <test.ec2.api-version>2010-08-31</test.ec2.api-version> + <test.ec2.build-version /> + <test.ec2.identity>${test.aws.identity}</test.ec2.identity> + <test.ec2.credential>${test.aws.credential}</test.ec2.credential> + <!-- default template pattern gets a problematic Ubuntu 10.04 AMI --> + <test.ec2.template>hardwareId=m1.small,imageId=us-east-1/ami-1ab3ce73</test.ec2.template> + <!-- Active EBS template as of 9/25/2013 --> + <test.ec2.ebs-template>hardwareId=m1.small,imageId=us-east-1/ami-53b1ff3a</test.ec2.ebs-template> + <!-- Windows_Server-2008-R2 with WinRM enabled (setup instructions at http://www.frontiertown.co.uk/2011/12/overthere-control-windows-from-java/) --> + <test.ec2.windows-template>hardwareId=m1.small,imageId=us-east-1/ami-0cb76d65</test.ec2.windows-template> + <jclouds.osgi.export>org.jclouds.ec2*;version="${project.version}"</jclouds.osgi.export> + <jclouds.osgi.import> + org.jclouds.compute.internal;version="${jclouds.version}", + org.jclouds.rest.internal;version="${jclouds.version}", + org.jclouds*;version="${jclouds.version}", + * + </jclouds.osgi.import> + </properties> + + <dependencies> + <dependency> + <groupId>org.apache.jclouds.api</groupId> + <artifactId>sts</artifactId> + <version>${jclouds.version}</version> + <type>jar</type> + </dependency> + <dependency> + <groupId>org.apache.jclouds</groupId> + <artifactId>jclouds-compute</artifactId> + <version>${jclouds.version}</version> + <type>jar</type> + </dependency> + <dependency> + <groupId>org.apache.jclouds</groupId> + <artifactId>jclouds-core</artifactId> + <version>${jclouds.version}</version> + <type>test-jar</type> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.jclouds</groupId> + <artifactId>jclouds-compute</artifactId> + <version>${jclouds.version}</version> + <type>test-jar</type> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.jclouds.driver</groupId> + <artifactId>jclouds-log4j</artifactId> + <version>${jclouds.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.jclouds.driver</groupId> + <artifactId>jclouds-sshj</artifactId> + <version>${jclouds.version}</version> + <scope>test</scope> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>com.theoryinpractise</groupId> + <artifactId>clojure-maven-plugin</artifactId> + </plugin> + </plugins> + </build> + <profiles> + <profile> + <id>live</id> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <executions> + <execution> + <id>integration</id> + <phase>integration-test</phase> + <goals> + <goal>test</goal> + </goals> + <configuration> + <systemPropertyVariables> + <test.ec2.endpoint>${test.ec2.endpoint}</test.ec2.endpoint> + <test.ec2.api-version>${test.ec2.api-version}</test.ec2.api-version> + <test.ec2.build-version>${test.ec2.build-version}</test.ec2.build-version> + <test.ec2.identity>${test.ec2.identity}</test.ec2.identity> + <test.ec2.credential>${test.ec2.credential}</test.ec2.credential> + <test.ec2.template>${test.ec2.template}</test.ec2.template> + <test.ec2.ebs-template>${test.ec2.ebs-template}</test.ec2.ebs-template> + <test.ec2.windows-template>${test.ec2.windows-template}</test.ec2.windows-template> + <test.ec2.windows-owner>${test.ec2.windows-owner}</test.ec2.windows-owner> + </systemPropertyVariables> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> + + <scm> + <tag>4.0.0-rc4</tag> + </scm> +</project> + http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/clojure/org/jclouds/ec2/ami2.clj ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/clojure/org/jclouds/ec2/ami2.clj b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/clojure/org/jclouds/ec2/ami2.clj new file mode 100644 index 0000000..d58eb6b --- /dev/null +++ b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/clojure/org/jclouds/ec2/ami2.clj @@ -0,0 +1,84 @@ +; +; 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. +; + +(ns + #^{:author "Hunter Hutchinson, [email protected]" + :doc "A clojure binding to the jclouds AMI service interface."} + org.jclouds.ec2.ami2 + (:use org.jclouds.compute2) + (:import org.jclouds.aws.domain.Region + org.jclouds.ec2.features.AMIApi + org.jclouds.ec2.options.CreateImageOptions + org.jclouds.compute.domain.NodeMetadata + (org.jclouds.ec2.domain Volume Volume$Status Snapshot Snapshot$Status AvailabilityZoneInfo))) + +(defn ^org.jclouds.ec2.features.AMIApi + ami-service + "" + [compute] + (-> compute + .getContext + .getProviderSpecificContext + .getApi + .getAMIApi().get)) + +(defn get-region + "Coerces the first parameter into a Region string; strings, keywords, and + NodeMetadata instances are acceptable arguments. An optional second argument + is returned if the first cannot be coerced into a region string. + Returns nil otherwise." + ([v] (get-region v nil)) + ([v default-region] + (cond + (string? v) v + (keyword? v) (name v) + (instance? NodeMetadata v) (let [zone (location v)] + ; no easier way to go from zone -> region? + (if (> (.indexOf zone "-") -1) + (subs zone 0 (-> zone count dec)) + zone)) + :else default-region))) + +(defn- as-string + [v] + (cond + (string? v) v + (keyword? v) (name v) + :else v)) + +(defn- get-string + [map key] + (as-string (get map key))) + +(defn- as-int + [v] + (cond + (number? v) (int v) + (string? v) (Integer/parseInt v) + :else (throw (IllegalArgumentException. + (str "Don't know how to convert object of type " (class v) " to a string"))))) + +(defn create-image-in-region + ([compute region name node-id description] + (.createImageInRegion (ami-service compute) + (get-region region) + (as-string name) + (as-string node-id) + (into-array CreateImageOptions + (when description + [(.withDescription (CreateImageOptions.) description)]))))) + http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/clojure/org/jclouds/ec2/ebs2.clj ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/clojure/org/jclouds/ec2/ebs2.clj b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/clojure/org/jclouds/ec2/ebs2.clj new file mode 100644 index 0000000..2bde9a5 --- /dev/null +++ b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/clojure/org/jclouds/ec2/ebs2.clj @@ -0,0 +1,286 @@ +; +; 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. +; + +(ns + #^{:author "Chas Emerick, [email protected]" + :doc "A clojure binding to the jclouds EBS service interface."} + org.jclouds.ec2.ebs2 + (:use org.jclouds.compute2 [clojure.core.incubator :only (-?>)]) + (:import org.jclouds.aws.domain.Region + org.jclouds.compute.domain.NodeMetadata + (org.jclouds.ec2.domain Volume Volume$Status Snapshot Snapshot$Status AvailabilityZoneInfo) + (org.jclouds.ec2.options DescribeSnapshotsOptions DetachVolumeOptions CreateSnapshotOptions))) +(defn snapshot? + "Returns true iff the argument is a org.jclouds.ec2.domain.Snapshot." + [s] + (instance? Snapshot s)) + +(defn volume? + "Returns true iff the argument is a org.jclouds.ec2.domain.Volume." + [v] + (instance? Volume v)) + +(defn ^org.jclouds.ec2.services.ElasticBlockStoreClient + ebs-service + "" + [compute] + (-> compute + .getContext + .getProviderSpecificContext + .getApi + .getElasticBlockStoreServices)) + +(defn get-region + "Coerces the first parameter into a Region string; strings, keywords, and + NodeMetadata instances are acceptable arguments. An optional second argument + is returned if the first cannot be coerced into a region string. + Returns nil otherwise." + ([v] (get-region v nil)) + ([v default-region] + (cond + (string? v) v + (keyword? v) (name v) + (instance? NodeMetadata v) (let [zone (location v)] + ; no easier way to go from zone -> region? + (if (> (.indexOf zone "-") -1) + (subs zone 0 (-> zone count dec)) + zone)) + :else default-region))) + +(defn get-volume-id + "Returns a string volume ID taken from the given string, keyword, or Volume argument." + [v] + (cond + (instance? Volume v) (.getId ^Volume v) + (keyword? v) (name v) + (string? v) v + :else (throw (IllegalArgumentException. + (str "Can't obtain volume id from argument of type " (class v)))))) + +(defn volumes + "Returns a set of org.jclouds.ec2.domain.Volume instances corresponding to the + volumes in the specified region (defaulting to your account's default region)." + [compute & [region & volume-ids]] + (set + (.describeVolumesInRegion (ebs-service compute) + (get-region region) + (into-array String (map get-volume-id + (if (get-region region) + volume-ids + (when region (cons region volume-ids)))))))) + +(defn- as-string + [v] + (cond + (string? v) v + (keyword? v) (name v) + :else v)) +(defn- get-string + [map key] + (as-string (get map key))) + +(defn- as-int + [v] + (cond + (number? v) (int v) + (string? v) (Integer/parseInt v) + :else (throw (IllegalArgumentException. + (str "Don't know how to convert object of type " (class v) " to a string"))))) + +(defn- snapshot-options + [optmap] + (let [string-array #(let [v (% optmap)] + (into-array String (cond + (keyword? v) [(name v)] + (string? v) [v] + :else (map as-string v))))] + (-> (DescribeSnapshotsOptions.) + (.ownedBy (string-array :owner)) + (.snapshotIds (string-array :ids)) + (.restorableBy (string-array :restorable-by))))) + +(defn snapshots + "Returns a set of org.jclouds.aws.ec2.domain.Snapshot instances that match + the criteria provided. Options include: + + :region - region string, keyword, or NodeMetadata + :owner - AWS account id (or \"amazon\" or \"self\") + :restorable-by - AWS account id + + Multiple values for each type of criteria can be provided by passing a seq + of the appropriate types as values." + [compute & options] + (let [options (apply hash-map options) + region (:region options) + options (snapshot-options (dissoc options :region))] + (set + (.describeSnapshotsInRegion (ebs-service compute) + (get-region region) + (into-array DescribeSnapshotsOptions [options]))))) + +(defn create-snapshot + "Creates a snapshot of a volume in the specified region with an optional description. + If provided, the description must be < 255 characters in length. Returns the + org.jclouds.aws.ec2.domain.Snapshot object representing the created snapshot." + ([compute ^Volume volume] (create-snapshot compute volume nil)) + ([compute ^Volume volume description] (create-snapshot compute (.getRegion volume) (.getId volume) description)) + ([compute region volume-id description] + (.createSnapshotInRegion (ebs-service compute) + (get-region region) + (as-string volume-id) + (into-array CreateSnapshotOptions (when description + [(.withDescription (CreateSnapshotOptions.) description)]))))) + +(defn delete-snapshot + "Deletes a snapshot in the specified region." + ([compute ^Snapshot snapshot] (delete-snapshot compute (.getRegion snapshot) (.getId snapshot))) + ([compute region snapshot-id] + (.deleteSnapshotInRegion (ebs-service compute) + (get-region region) + (as-string snapshot-id)))) + +(defn get-zone + [v] + (cond + (instance? AvailabilityZoneInfo v) (.getZone v) + (instance? NodeMetadata v) (location ^NodeMetadata v) + (string? v) v + (keyword? v) (name v) + :else (throw (IllegalArgumentException. + (str "Can't obtain zone from argument of type " (class v)))))) + +(defn attach-volume + "Attaches a volume to an instance, returning the resulting org.jclouds.aws.ec2.domain.Attachment." + ([compute ^NodeMetadata node volume device] + (attach-volume compute node (.getProviderId node) (get-volume-id volume) device)) + ([compute region instance-id volume-id device] + (apply #(.attachVolumeInRegion (ebs-service compute) + (get-region region) % %2 %3) + (map as-string [volume-id instance-id device])))) + +(defn detach-volume + "Detaches a volume from the instance to which it is currently attached. + The volume may be specified with a Volume instance, a string, or a keyword. + Providing a logical true value for the :force option will cause the volume + to be forcibly detached, regardless of whether it is in-use (mounted) or not. + + If the volume is specified as a string or keyword, one of the following options + is additionally required: + + :region - the region where the volume is allocated + :node - a node in the region where the volume is allocated + + FYI: It appears that issuing a detatch-volume command while the volume in question is mounted + will cause the volume to be detatched immediately upon the volume beign unmounted." + [compute volume & options] + (let [options (apply hash-map options) + volume-id (get-volume-id volume) + region (get-region (if (instance? Volume volume) + (.getRegion volume) + (or (:region options) (:node options))))] + (when (not region) + (throw (IllegalArgumentException. + "Must specify volume's region via :region or :node options, or by providing a Volume instance."))) + (.detachVolumeInRegion (ebs-service compute) + region + volume-id + (boolean (:force options)) + (into-array DetachVolumeOptions [])))) + +(defn create-volume + "Creates a new volume given a set of options: + + - one of :zone (keyword, string, or AvailabilityZoneInfo) or :node (NodeMetadata) + - one or both of :snapshot (keyword, string, or Snapshot instance) or :size + (string, keyword, or number) + - :device (string or keyword) provided *only* when you want to attach the new volume to + the :node you specified! + + Returns a vector of [created org.jclouds.ec2.domain.Volume, + optional org.jclouds.ec2.domain.Attachment] + + Note that specifying :node instead of :zone will only attach the created volume + :device is also provided. Otherwise, the node is only used to obtain the desired + availability zone. + + Note also that if :device and :node are specified, and the attach operation fails, + you will have \"leaked\" the newly-created volume + (volume creation and attachment cannot be done atomically)." + [compute & options] + (when (-> options count odd?) + (throw (IllegalArgumentException. "Must provide key-value pairs, e.g. :zone :us-east-1d :size 200"))) + (let [options (apply hash-map options) + snapshot (get-string options :snapshot) + snapshot (if (snapshot? snapshot) (.getId snapshot) snapshot) + size (-?> (get-string options :size) as-int) + ^NodeMetadata node (:node options) + zone (or node (get-string options :zone)) + zone (if zone + (get-zone zone) + (throw (IllegalArgumentException. "Must supply a :zone or :node option."))) + ebs (ebs-service compute)] + (when (and (:device options) (not node)) + (throw (IllegalArgumentException. "Cannot create and attach new volume; no :node specified"))) + (let [new-volume (cond + (and snapshot size) (.createVolumeFromSnapshotInAvailabilityZone ebs zone size snapshot) + snapshot (.createVolumeFromSnapshotInAvailabilityZone ebs zone snapshot) + size (.createVolumeInAvailabilityZone ebs zone size) + :else (throw (IllegalArgumentException. "Must supply :size and/or :snapshot options.")))] + [new-volume (when (:device options) + (attach-volume compute node new-volume (as-string (:device options))))]))) + +(defn delete-volume + "Deletes a volume in the specified region." + ([compute ^Volume volume] + (delete-volume (.getRegion volume) (.getId volume))) + ([compute region volume-id] + (.deleteVolumeInRegion (ebs-service compute) + (get-region region) + (as-string volume-id)))) + +(defn status + "Returns the status of the given entity; works for Volumes and Snapshots." + [k] + (.getStatus k)) + +(defn status-available? + [^Volume v] + (= Volume$Status/AVAILABLE (status v))) + +(defn status-creating? + [^Volume v] + (= Volume$Status/CREATING (status v))) + +(defn status-deleting? + [^Volume v] + (= Volume$Status/DELETING (status v))) + +(defn status-in-use? + [^Volume v] + (= Volume$Status/IN_USE (status v))) + +(defn status-completed? + [^Snapshot s] + (= Snapshot$Status/COMPLETED (status s))) + +(defn status-error? + [^Snapshot s] + (= Snapshot$Status/ERROR (status s))) + +(defn status-pending? + [^Snapshot s] + (= Snapshot$Status/PENDING (status s))) \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/clojure/org/jclouds/ec2/elastic_ip2.clj ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/clojure/org/jclouds/ec2/elastic_ip2.clj b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/clojure/org/jclouds/ec2/elastic_ip2.clj new file mode 100644 index 0000000..68c372f --- /dev/null +++ b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/clojure/org/jclouds/ec2/elastic_ip2.clj @@ -0,0 +1,80 @@ +; +; 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. +; + +(ns + #^{:author "Chas Emerick, [email protected]" + :doc "A clojure binding for the jclouds AWS elastic IP address interface."} + org.jclouds.ec2.elastic-ip2 + (:require (org.jclouds [compute2 :as compute]) + [org.jclouds.ec2.ebs2 :as ebs]) + (:import org.jclouds.compute.domain.NodeMetadata + (org.jclouds.ec2.domain PublicIpInstanceIdPair))) + +(defn ^org.jclouds.ec2.features.ElasticIPAddressApi + eip-service + "Returns an ElasticIPAddressApi for the given ComputeService" + [compute] + (-> compute + .getContext .getProviderSpecificContext .getApi .getElasticIPAddressApi().get)) + +(defn allocate + "Claims a new elastic IP address within the (optionally) specified region for your account. + Region may be a string, keyword, or a node from which the region + is inferred. Returns the IP address as a string." + ([compute] (allocate compute nil)) + ([compute region] + (.allocateAddressInRegion (eip-service compute) (ebs/get-region region)))) + +(defn associate + "Associates an elastic IP address with a node." + ([compute ^NodeMetadata node public-ip] + (associate node public-ip (.getProviderId node))) + ([compute region public-ip instance-id] + (.associateAddressInRegion (eip-service compute) + (ebs/get-region region) + public-ip + instance-id))) + +(defn addresses + "Returns a map of elastic IP addresses to maps with slots: + + :region - the region (string/keyword/NodeMetadata) the IP address is allocated within + :node-id - the ID of the instance with which the IP address is associated (optional) + + You may optionally specify which IP addresses you would like to query." + ([compute] (addresses compute nil)) + ([compute region & public-ips] + (into {} (for [^PublicIpInstanceIdPair pair (.describeAddressesInRegion (eip-service compute) + (ebs/get-region region) + (into-array String public-ips))] + [(.getPublicIp pair) (merge {:region (.getRegion pair)} + (when (.getInstanceId pair) {:node-id (.getInstanceId pair)}))])))) + +(defn dissociate + "Dissociates an elastic IP address from the node with which it is currently associated." + [compute region public-ip] + (.disassociateAddressInRegion (eip-service compute) + (ebs/get-region region) + public-ip)) + +(defn release + "Disclaims an elastic IP address from your account." + ([compute public-ip] (release compute public-ip nil)) + ([compute public-ip region] + (.releaseAddressInRegion (eip-service compute) + (ebs/get-region region) + public-ip))) http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/clojure/org/jclouds/ec2/security_group2.clj ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/clojure/org/jclouds/ec2/security_group2.clj b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/clojure/org/jclouds/ec2/security_group2.clj new file mode 100644 index 0000000..a4f33cf --- /dev/null +++ b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/clojure/org/jclouds/ec2/security_group2.clj @@ -0,0 +1,99 @@ +; +; 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. +; + +(ns + #^{:author "Juegen Hoetzel, [email protected]" + :doc "A clojure binding for the jclouds AWS security group interface."} + org.jclouds.ec2.security-group2 + (:require (org.jclouds [compute2 :as compute]) + [org.jclouds.ec2.ebs2 :as ebs]) + (:import org.jclouds.ec2.domain.SecurityGroup + org.jclouds.ec2.features.SecurityGroupApi + org.jclouds.net.domain.IpProtocol)) + +(defn #^SecurityGroupApi + sg-service + "Returns the SecurityGroup Api associated with the specified compute service." + [compute] + (-> compute .getContext .getProviderSpecificContext .getApi .getSecurityGroupApi().get)) + +(defn create-group + "Creates a new security group. + + e.g. (create-group compute \"Database Server\" \"Description for group\" :region :us-west-1)" + [compute name & {:keys [description region]}] + (.createSecurityGroupInRegion (sg-service compute) (ebs/get-region region) name (or description name))) + +(defn delete-group + "Deletes a security group. + + e.g. (delete-group compute \"Database Server\" :region :us-west-1)" + [compute name & {:keys [region]}] + (.deleteSecurityGroupInRegion (sg-service compute) (ebs/get-region region) name)) + +(defn groups + "Returns a map of GroupName -> org.jclouds.ec2.domain.SecurityGroup instances. + + e.g. (groups compute :region :us-east-1)" + [compute & {:keys [region]}] + (into {} (for [#^SecurityGroup group (.describeSecurityGroupsInRegion (sg-service compute) + (ebs/get-region region) + (into-array String '()))] + [(.getName group) group]))) + +(defn get-protocol [v] + "Coerce argument to a IP Protocol." + (cond + (instance? IpProtocol v) v + (keyword? v) (if-let [p (get {:tcp IpProtocol/TCP + :udp IpProtocol/UDP + :icmp IpProtocol/ICMP} + v)] + p + (throw (IllegalArgumentException. + (str "Can't obtain IP protocol from " v " (valid :tcp, :udp and :icmp)")))) + (nil? v) IpProtocol/TCP + :else (throw (IllegalArgumentException. + (str "Can't obtain IP protocol from argument of type " (type v)))))) + +(defn authorize + "Adds permissions to a security group. + + e.g. (authorize compute \"jclouds#webserver#us-east-1\" 80 :ip-range \"0.0.0.0/0\") + (authorize compute \"jclouds#webserver#us-east-1\" [1000,2000] :protocol :udp)" + + [compute group-name port & {:keys [protocol ip-range region]}] + (let [group ((groups compute :region region) group-name) + [from-port to-port] (if (number? port) [port port] port)] + (if group + (.authorizeSecurityGroupIngressInRegion + (sg-service compute) (ebs/get-region region) (.getName group) (get-protocol protocol) from-port to-port (or ip-range "0.0.0.0/0")) + (throw (IllegalArgumentException. + (str "Can't find security group for name " group-name)))))) + +(defn revoke + "Revokes permissions from a security group. + + e.g. (revoke compute 80 \"jclouds#webserver#us-east-1\" :protocol :tcp 80 80 :ip-range \"0.0.0.0/0\")" + [compute group-name port & {:keys [protocol ip-range region]}] + (let [group ((groups compute :region region) group-name) + [from-port to-port] (if (number? port) [port port] port)] + (if group + (.revokeSecurityGroupIngressInRegion + (sg-service compute) (ebs/get-region region) (.getName group) (get-protocol protocol) from-port to-port (or ip-range "0.0.0.0/0")) + (throw (IllegalArgumentException. + (str "Can't find security group for name " group-name)))))) \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/EC2Api.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/EC2Api.java b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/EC2Api.java new file mode 100644 index 0000000..a7e7ee0 --- /dev/null +++ b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/EC2Api.java @@ -0,0 +1,165 @@ +/* + * 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; + +import java.io.Closeable; +import java.util.Set; +import org.jclouds.ec2.features.SubnetApi; +import org.jclouds.ec2.features.TagApi; +import org.jclouds.ec2.features.WindowsApi; +import org.jclouds.ec2.features.AMIApi; +import org.jclouds.ec2.features.AvailabilityZoneAndRegionApi; +import org.jclouds.ec2.features.ElasticBlockStoreApi; +import org.jclouds.ec2.features.ElasticIPAddressApi; +import org.jclouds.ec2.features.InstanceApi; +import org.jclouds.ec2.features.KeyPairApi; +import org.jclouds.ec2.features.SecurityGroupApi; +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.location.Region; +import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull; +import org.jclouds.rest.annotations.Delegate; +import org.jclouds.rest.annotations.EndpointParam; + +import com.google.common.base.Optional; +import com.google.inject.Provides; + +/** + * Provides access to EC2 features, broken up by feature group. Use of the + * {@link Optional} type allows you to check to see if the underlying + * implementation supports a particular feature before attempting to use it. + * This is useful in clones like OpenStack, CloudStack, or Eucalyptus, which + * track the api, but are always behind Amazon's service. In the case of Amazon + * ({@code aws-ec2}), you can expect all features to be present. + * + * + * Example + * + * <pre> + * Optional<? extends WindowsApi> windowsOption = ec2Api.getWindowsApi(); + * checkState(windowsOption.isPresent(), "windows feature required, but not present"); + * </pre> + */ +public interface EC2Api extends Closeable { + /** + * + * @return the Region codes configured + */ + @Provides + @Region + Set<String> getConfiguredRegions(); + + /** + * Provides synchronous access to Windows features. + */ + @Delegate + Optional<? extends WindowsApi> getWindowsApi(); + + @Delegate + Optional<? extends WindowsApi> getWindowsApiForRegion( + @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region); + + /** + * Provides synchronous access to Tag features. + */ + @Delegate + Optional<? extends TagApi> getTagApi(); + + @Delegate + Optional<? extends TagApi> getTagApiForRegion( + @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region); + + /** + * Provides synchronous access to Subnet features. + */ + @Delegate + Optional<? extends SubnetApi> getSubnetApi(); + + @Delegate + Optional<? extends SubnetApi> getSubnetApiForRegion( + @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region); + + /** + * Provides synchronous access to AMI services. + */ + @Delegate + Optional<? extends AMIApi> getAMIApi(); + + @Delegate + Optional<? extends AMIApi> getAMIApiForRegion( + @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region); + + + /** + * Provides synchronous access to Elastic IP Address services. + */ + @Delegate + Optional<? extends ElasticIPAddressApi> getElasticIPAddressApi(); + + @Delegate + Optional<? extends ElasticIPAddressApi> getElasticIPAddressApiForRegion( + @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region); + + /** + * Provides synchronous access to Instance services. + */ + @Delegate + Optional<? extends InstanceApi> getInstanceApi(); + + @Delegate + Optional<? extends InstanceApi> getInstanceApiForRegion( + @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region); + + /** + * Provides synchronous access to KeyPair services. + */ + @Delegate + Optional<? extends KeyPairApi> getKeyPairApi(); + + @Delegate + Optional<? extends KeyPairApi> getKeyPairApiForRegion( + @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region); + + /** + * Provides synchronous access to SecurityGroup services. + */ + @Delegate + Optional<? extends SecurityGroupApi> getSecurityGroupApi(); + + @Delegate + Optional<? extends SecurityGroupApi> getSecurityGroupApiForRegion( + @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region); + + /** + * Provides synchronous access to Availability Zones and Regions services. + */ + @Delegate + Optional<? extends AvailabilityZoneAndRegionApi> getAvailabilityZoneAndRegionApi(); + + @Delegate + Optional<? extends AvailabilityZoneAndRegionApi> getAvailabilityZoneAndRegionApiForRegion( + @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region); + + /** + * Provides synchronous access to Elastic Block Store services. + */ + @Delegate + Optional<? extends ElasticBlockStoreApi> getElasticBlockStoreApi(); + + @Delegate + Optional<? extends ElasticBlockStoreApi> getElasticBlockStoreApiForRegion( + @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region); +} http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/EC2ApiMetadata.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/EC2ApiMetadata.java b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/EC2ApiMetadata.java new file mode 100644 index 0000000..2b081c5 --- /dev/null +++ b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/EC2ApiMetadata.java @@ -0,0 +1,91 @@ +/* + * 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; + +import static org.jclouds.aws.reference.AWSConstants.PROPERTY_AUTH_TAG; +import static org.jclouds.aws.reference.AWSConstants.PROPERTY_HEADER_TAG; +import static org.jclouds.compute.config.ComputeServiceProperties.RESOURCENAME_DELIMITER; +import static org.jclouds.ec2.reference.EC2Constants.PROPERTY_EC2_AMI_OWNERS; +import static org.jclouds.ec2.reference.EC2Constants.PROPERTY_EC2_AUTO_ALLOCATE_ELASTIC_IPS; +import static org.jclouds.ec2.reference.EC2Constants.PROPERTY_EC2_GENERATE_INSTANCE_NAMES; +import static org.jclouds.ec2.reference.EC2Constants.PROPERTY_EC2_TIMEOUT_SECURITYGROUP_PRESENT; + +import java.net.URI; +import java.util.Properties; + +import org.jclouds.apis.ApiMetadata; +import org.jclouds.ec2.compute.EC2ComputeServiceContext; +import org.jclouds.ec2.compute.config.EC2ComputeServiceContextModule; +import org.jclouds.ec2.compute.config.EC2ResolveImagesModule; +import org.jclouds.ec2.config.EC2HttpApiModule; +import org.jclouds.rest.internal.BaseHttpApiMetadata; + +import com.google.common.collect.ImmutableSet; +import com.google.inject.Module; + +public final class EC2ApiMetadata extends BaseHttpApiMetadata<EC2Api> { + + @Override + public Builder toBuilder() { + return new Builder().fromApiMetadata(this); + } + + public EC2ApiMetadata() { + super(new Builder()); + } + + protected EC2ApiMetadata(Builder builder) { + super(builder); + } + + public static Properties defaultProperties() { + Properties properties = BaseHttpApiMetadata.defaultProperties(); + properties.setProperty(PROPERTY_AUTH_TAG, "AWS"); + properties.setProperty(PROPERTY_HEADER_TAG, "amz"); + properties.setProperty(PROPERTY_EC2_AMI_OWNERS, "*"); + properties.setProperty(PROPERTY_EC2_TIMEOUT_SECURITYGROUP_PRESENT, "500"); + properties.setProperty(PROPERTY_EC2_AUTO_ALLOCATE_ELASTIC_IPS, "false"); + properties.setProperty(RESOURCENAME_DELIMITER, "#"); + properties.setProperty(PROPERTY_EC2_GENERATE_INSTANCE_NAMES, "true"); + return properties; + } + + public static final class Builder extends BaseHttpApiMetadata.Builder<EC2Api, Builder> { + public Builder() { + id("ec2") + .name("Amazon Elastic Compute Cloud (EC2) API") + .identityName("Access Key ID") + .credentialName("Secret Access Key") + .defaultEndpoint("https://ec2.us-east-1.amazonaws.com") + .documentation(URI.create("http://docs.amazonwebservices.com/AWSEC2/latest/APIReference")) + .version("2010-08-31") + .defaultProperties(EC2ApiMetadata.defaultProperties()) + .view(EC2ComputeServiceContext.class) + .defaultModules(ImmutableSet.<Class<? extends Module>>of(EC2HttpApiModule.class, EC2ResolveImagesModule.class, EC2ComputeServiceContextModule.class)); + } + + @Override + public ApiMetadata build() { + return new EC2ApiMetadata(this); + } + + @Override + protected Builder self() { + return this; + } + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/EC2Fallbacks.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/EC2Fallbacks.java b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/EC2Fallbacks.java new file mode 100644 index 0000000..7cb4675 --- /dev/null +++ b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/EC2Fallbacks.java @@ -0,0 +1,50 @@ +/* + * 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; + +import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.base.Throwables.propagate; +import static com.google.common.util.concurrent.Futures.immediateFuture; + +import org.jclouds.Fallback; +import org.jclouds.aws.AWSResponseException; + +import com.google.common.base.Predicates; +import com.google.common.collect.ImmutableSet; +import com.google.common.util.concurrent.ListenableFuture; + +public final class EC2Fallbacks { + private EC2Fallbacks() { + } + + public static final class VoidOnVolumeAvailable implements Fallback<Void> { + @Override + public ListenableFuture<Void> create(Throwable t) throws Exception { + return immediateFuture(createOrPropagate(t)); + } + + @Override + public Void createOrPropagate(Throwable t) throws Exception { + if (checkNotNull(t, "throwable") instanceof AWSResponseException) { + AWSResponseException e = AWSResponseException.class.cast(t); + if (Predicates.in(ImmutableSet.of("IncorrectState", "available")).apply(e.getError().getCode())) + return null; + } + throw propagate(t); + } + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/binders/BindBlockDeviceMappingToIndexedFormParams.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/binders/BindBlockDeviceMappingToIndexedFormParams.java b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/binders/BindBlockDeviceMappingToIndexedFormParams.java new file mode 100644 index 0000000..bc41217 --- /dev/null +++ b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/binders/BindBlockDeviceMappingToIndexedFormParams.java @@ -0,0 +1,63 @@ +/* + * 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.binders; + +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; +import static java.lang.String.format; +import static org.jclouds.http.utils.Queries.queryParser; +import static org.jclouds.io.Payloads.newUrlEncodedFormPayload; + +import java.util.Map; +import java.util.Map.Entry; + +import org.jclouds.ec2.domain.BlockDevice; +import org.jclouds.http.HttpRequest; +import org.jclouds.rest.Binder; + +import com.google.common.collect.ImmutableMultimap; +import com.google.common.collect.Multimap; + +public class BindBlockDeviceMappingToIndexedFormParams implements Binder { + + private static final String deviceNamePattern = "BlockDeviceMapping.%d.DeviceName"; + private static final String deleteOnTerminationPattern = "BlockDeviceMapping.%d.Ebs.DeleteOnTermination"; + private static final String volumeIdPattern = "BlockDeviceMapping.%d.Ebs.VolumeId"; + + @SuppressWarnings("unchecked") + @Override + public <R extends HttpRequest> R bindToRequest(R request, Object input) { + checkArgument(checkNotNull(input, "input") instanceof Map, "this binder is only valid for Map"); + Map<String, BlockDevice> blockDeviceMapping = (Map<String, BlockDevice>) input; + Multimap<String, String> original = queryParser().apply(request.getPayload().getRawContent().toString()); + ImmutableMultimap.Builder<String, String> builder = ImmutableMultimap.builder(); + builder.putAll("Action", "ModifyInstanceAttribute"); + int amazonOneBasedIndex = 1; // according to docs, counters must start with 1 + for (Entry<String, BlockDevice> ebsBlockDeviceName : blockDeviceMapping.entrySet()) { + // not null by contract + builder.put(format(deviceNamePattern, amazonOneBasedIndex), ebsBlockDeviceName.getKey()); + builder.put(format(deleteOnTerminationPattern, amazonOneBasedIndex), + String.valueOf(ebsBlockDeviceName.getValue().isDeleteOnTermination())); + builder.put(format(volumeIdPattern, amazonOneBasedIndex), ebsBlockDeviceName.getValue().getVolumeId()); + amazonOneBasedIndex++; + } + builder.putAll("InstanceId", original.get("InstanceId")); + request.setPayload(newUrlEncodedFormPayload(builder.build())); + return request; + } + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/binders/BindBundleIdsToIndexedFormParams.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/binders/BindBundleIdsToIndexedFormParams.java b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/binders/BindBundleIdsToIndexedFormParams.java new file mode 100644 index 0000000..0f936ef --- /dev/null +++ b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/main/java/org/jclouds/ec2/binders/BindBundleIdsToIndexedFormParams.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.ec2.binders; + +import javax.inject.Singleton; + +import org.jclouds.aws.util.AWSUtils; +import org.jclouds.http.HttpRequest; +import org.jclouds.rest.Binder; + +/** + * Binds the String [] to form parameters named with BundleId.index + */ +@Singleton +public class BindBundleIdsToIndexedFormParams implements Binder { + @Override + public <R extends HttpRequest> R bindToRequest(R request, Object input) { + return AWSUtils.indexStringArrayToFormValuesWithPrefix(request, "BundleId", input); + } + +}
