Merge lp:~oubiwann/txaws/422066-fix-optional-params into lp:~txawsteam/txaws/trunk

Proposed by Duncan McGreggor
Status: Merged
Merged at revision: not available
Proposed branch: lp:~oubiwann/txaws/422066-fix-optional-params
Merge into: lp:~txawsteam/txaws/trunk
Diff against target: None lines
To merge this branch: bzr merge lp:~oubiwann/txaws/422066-fix-optional-params
Reviewer Review Type Date Requested Status
Robert Collins (community) Approve
Review via email: mp+10941@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Duncan McGreggor (oubiwann) wrote :

Ready for review!

Revision history for this message
Robert Collins (lifeless) wrote :

 review +1

I think we should have kept the XML namespace support - its not correct
without it.

-Rob

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'txaws/ec2/client.py'
--- txaws/ec2/client.py 2009-08-31 07:52:14 +0000
+++ txaws/ec2/client.py 2009-08-31 19:25:50 +0000
@@ -1,4 +1,7 @@
1# -*- coding: utf-8 -*-
1# Copyright (C) 2009 Robert Collins <robertc@robertcollins.net>2# Copyright (C) 2009 Robert Collins <robertc@robertcollins.net>
3# Copyright (C) 2009 Duncan McGreggor <duncan@canonical.com>
4# Copyright (C) 2009 Thomas Hervé <thomas@canonical.com>
2# Licenced under the txaws licence available at /LICENSE in the txaws source.5# Licenced under the txaws licence available at /LICENSE in the txaws source.
36
4"""EC2 client support."""7"""EC2 client support."""
@@ -8,6 +11,7 @@
811
9from twisted.web.client import getPage12from twisted.web.client import getPage
1013
14from txaws import version
11from txaws.credentials import AWSCredentials15from txaws.credentials import AWSCredentials
12from txaws.service import AWSServiceEndpoint16from txaws.service import AWSServiceEndpoint
13from txaws.util import iso8601time, XML17from txaws.util import iso8601time, XML
@@ -140,6 +144,14 @@
140 return the object that most developers and their code will be144 return the object that most developers and their code will be
141 interested in: the instances. In instances reservation is available on145 interested in: the instances. In instances reservation is available on
142 the instance object.146 the instance object.
147
148 The following instance attributes are optional:
149 * ami_launch_index
150 * key_name
151 * kernel_id
152 * product_codes
153 * ramdisk_id
154 * reason
143 """155 """
144 root = XML(xml_bytes)156 root = XML(xml_bytes)
145 results = []157 results = []
@@ -171,9 +183,10 @@
171 placement = instance_data.find("placement").findtext(183 placement = instance_data.find("placement").findtext(
172 "availabilityZone")184 "availabilityZone")
173 products = []185 products = []
174 for product_data in instance_data.find("productCodesSet"):186 product_codes = instance_data.find("productCodes")
175 product_code = product_data.findtext("productCode")187 if product_codes:
176 products.append(product_code)188 for product_data in instance_data.find("productCodes"):
189 products.append(product_data.text)
177 kernel_id = instance_data.findtext("kernelId")190 kernel_id = instance_data.findtext("kernelId")
178 ramdisk_id = instance_data.findtext("ramdiskId")191 ramdisk_id = instance_data.findtext("ramdiskId")
179 instance = Instance(192 instance = Instance(
@@ -362,15 +375,15 @@
362 """A query that may be submitted to EC2."""375 """A query that may be submitted to EC2."""
363376
364 def __init__(self, action, creds, endpoint, other_params=None,377 def __init__(self, action, creds, endpoint, other_params=None,
365 time_tuple=None):378 time_tuple=None, api_version=None):
366 """Create a Query to submit to EC2."""379 """Create a Query to submit to EC2."""
367 self.creds = creds380 self.creds = creds
368 self.endpoint = endpoint381 self.endpoint = endpoint
369 # Require params (2008-12-01 API):382 # Currently, txAWS only supports version 2008-12-01
370 # Version, SignatureVersion, SignatureMethod, Action, AWSAccessKeyId,383 if api_version is None:
371 # Timestamp || Expires, Signature,384 api_version = version.aws_api
372 self.params = {385 self.params = {
373 'Version': '2008-12-01',386 'Version': api_version,
374 'SignatureVersion': '2',387 'SignatureVersion': '2',
375 'SignatureMethod': 'HmacSHA1',388 'SignatureMethod': 'HmacSHA1',
376 'Action': action,389 'Action': action,
377390
=== modified file 'txaws/ec2/tests/test_client.py'
--- txaws/ec2/tests/test_client.py 2009-08-31 07:52:14 +0000
+++ txaws/ec2/tests/test_client.py 2009-08-31 20:07:58 +0000
@@ -1,4 +1,7 @@
1# -*- coding: utf-8 -*-
1# Copyright (C) 2009 Robert Collins <robertc@robertcollins.net>2# Copyright (C) 2009 Robert Collins <robertc@robertcollins.net>
3# Copyright (C) 2009 Duncan McGreggor <duncan@canonical.com>
4# Copyright (C) 2009 Thomas Hervé <thomas@canonical.com>
2# Licenced under the txaws licence available at /LICENSE in the txaws source.5# Licenced under the txaws licence available at /LICENSE in the txaws source.
36
4from datetime import datetime7from datetime import datetime
@@ -9,173 +12,10 @@
9from txaws.credentials import AWSCredentials12from txaws.credentials import AWSCredentials
10from txaws.ec2 import client13from txaws.ec2 import client
11from txaws.service import AWSServiceEndpoint, EC2_ENDPOINT_US14from txaws.service import AWSServiceEndpoint, EC2_ENDPOINT_US
15from txaws.testing import payload
12from txaws.testing.base import TXAWSTestCase16from txaws.testing.base import TXAWSTestCase
1317
1418
15sample_describe_instances_result = """<?xml version="1.0"?>
16<DescribeInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2008-12-01/">
17 <requestId>52b4c730-f29f-498d-94c1-91efb75994cc</requestId>
18 <reservationSet>
19 <item>
20 <reservationId>r-cf24b1a6</reservationId>
21 <ownerId>123456789012</ownerId>
22 <groupSet>
23 <item>
24 <groupId>default</groupId>
25 </item>
26 </groupSet>
27 <instancesSet>
28 <item>
29 <instanceId>i-abcdef01</instanceId>
30 <imageId>ami-12345678</imageId>
31 <instanceState>
32 <code>16</code>
33 <name>running</name>
34 </instanceState>
35 <privateDnsName>domU-12-31-39-03-15-11.compute-1.internal</privateDnsName>
36 <dnsName>ec2-75-101-245-65.compute-1.amazonaws.com</dnsName>
37 <reason/>
38 <keyName>keyname</keyName>
39 <amiLaunchIndex>0</amiLaunchIndex>
40 <productCodesSet>
41 <item>
42 <productCode>774F4FF8</productCode>
43 </item>
44 </productCodesSet>
45
46 <instanceType>c1.xlarge</instanceType>
47 <launchTime>2009-04-27T02:23:18.000Z</launchTime>
48 <placement>
49 <availabilityZone>us-east-1c</availabilityZone>
50 </placement>
51 <kernelId>aki-b51cf9dc</kernelId>
52 <ramdiskId>ari-b31cf9da</ramdiskId>
53 </item>
54 </instancesSet>
55 </item>
56 </reservationSet>
57</DescribeInstancesResponse>
58"""
59
60
61sample_terminate_instances_result = """<?xml version="1.0"?>
62<TerminateInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2008-12-01/">
63 <instancesSet>
64 <item>
65 <instanceId>i-1234</instanceId>
66 <shutdownState>
67 <code>32</code>
68 <name>shutting-down</name>
69 </shutdownState>
70 <previousState>
71 <code>16</code>
72 <name>running</name>
73 </previousState>
74 </item>
75 <item>
76 <instanceId>i-5678</instanceId>
77 <shutdownState>
78 <code>32</code>
79 <name>shutting-down</name>
80 </shutdownState>
81 <previousState>
82 <code>32</code>
83 <name>shutting-down</name>
84 </previousState>
85 </item>
86 </instancesSet>
87</TerminateInstancesResponse>
88"""
89
90
91sample_describe_volumes_result = """<?xml version="1.0"?>
92<DescribeVolumesResponse xmlns="http://ec2.amazonaws.com/doc/2008-12-01/">
93 <volumeSet>
94 <item>
95 <volumeId>vol-4282672b</volumeId>
96 <size>800</size>
97 <status>in-use</status>
98 <createTime>2008-05-07T11:51:50.000Z</createTime>
99 <attachmentSet>
100 <item>
101 <volumeId>vol-4282672b</volumeId>
102 <instanceId>i-6058a509</instanceId>
103 <size>800</size>
104 <snapshotId>snap-12345678</snapshotId>
105 <availabilityZone>us-east-1a</availabilityZone>
106 <status>attached</status>
107 <attachTime>2008-05-07T12:51:50.000Z</attachTime>
108 </item>
109 </attachmentSet>
110 </item>
111 </volumeSet>
112</DescribeVolumesResponse>
113"""
114
115
116sample_describe_snapshots_result = """<?xml version="1.0"?>
117<DescribeSnapshotsResponse xmlns="http://ec2.amazonaws.com/doc/2008-12-01">
118 <snapshotSet>
119 <item>
120 <snapshotId>snap-78a54011</snapshotId>
121 <volumeId>vol-4d826724</volumeId>
122 <status>pending</status>
123 <startTime>2008-05-07T12:51:50.000Z</startTime>
124 <progress>80%</progress>
125 </item>
126 </snapshotSet>
127</DescribeSnapshotsResponse>
128"""
129
130
131sample_create_volume_result = """<?xml version="1.0"?>
132<CreateVolumeResponse xmlns="http://ec2.amazonaws.com/doc/2008-12-01">
133 <volumeId>vol-4d826724</volumeId>
134 <size>800</size>
135 <status>creating</status>
136 <createTime>2008-05-07T11:51:50.000Z</createTime>
137 <availabilityZone>us-east-1a</availabilityZone>
138 <snapshotId></snapshotId>
139</CreateVolumeResponse>
140"""
141
142
143sample_delete_volume_result = """<?xml version="1.0"?>
144<DeleteVolumeResponse xmlns="http://ec2.amazonaws.com/doc/2008-12-01">
145 <return>true</return>
146</DeleteVolumeResponse>
147"""
148
149
150sample_create_snapshot_result = """<?xml version="1.0"?>
151<CreateSnapshotResponse xmlns="http://ec2.amazonaws.com/doc/2008-12-01">
152 <snapshotId>snap-78a54011</snapshotId>
153 <volumeId>vol-4d826724</volumeId>
154 <status>pending</status>
155 <startTime>2008-05-07T12:51:50.000Z</startTime>
156 <progress></progress>
157</CreateSnapshotResponse>
158"""
159
160
161sample_delete_snapshot_result = """<?xml version="1.0"?>
162<DeleteSnapshotResponse xmlns="http://ec2.amazonaws.com/doc/2008-12-01">
163 <return>true</return>
164</DeleteSnapshotResponse>
165"""
166
167
168sample_attach_volume_result = """<?xml version="1.0"?>
169<AttachVolumeResponse xmlns="http://ec2.amazonaws.com/doc/2008-12-01">
170 <volumeId>vol-4d826724</volumeId>
171 <instanceId>i-6058a509</instanceId>
172 <device>/dev/sdh</device>
173 <status>attaching</status>
174 <attachTime>2008-05-07T11:51:50.000Z</attachTime>
175</AttachVolumeResponse>
176"""
177
178
179class ReservationTestCase(TXAWSTestCase):19class ReservationTestCase(TXAWSTestCase):
18020
181 def test_reservation_creation(self):21 def test_reservation_creation(self):
@@ -251,10 +91,39 @@
251 self.assertEquals(instance.kernel_id, "aki-b51cf9dc")91 self.assertEquals(instance.kernel_id, "aki-b51cf9dc")
252 self.assertEquals(instance.ramdisk_id, "ari-b31cf9da")92 self.assertEquals(instance.ramdisk_id, "ari-b31cf9da")
25393
94 def check_parsed_instances_required(self, results):
95 instance = results[0]
96 # check reservations
97 reservation = instance.reservation
98 self.assertEquals(reservation.reservation_id, "r-cf24b1a6")
99 self.assertEquals(reservation.owner_id, "123456789012")
100 # check groups
101 group = reservation.groups[0]
102 self.assertEquals(group, "default")
103 # check instance
104 self.assertEquals(instance.instance_id, "i-abcdef01")
105 self.assertEquals(instance.instance_state, "running")
106 self.assertEquals(instance.instance_type, "c1.xlarge")
107 self.assertEquals(instance.image_id, "ami-12345678")
108 self.assertEquals(
109 instance.private_dns_name,
110 "domU-12-31-39-03-15-11.compute-1.internal")
111 self.assertEquals(
112 instance.dns_name,
113 "ec2-75-101-245-65.compute-1.amazonaws.com")
114 self.assertEquals(instance.key_name, None)
115 self.assertEquals(instance.ami_launch_index, None)
116 self.assertEquals(instance.launch_time, "2009-04-27T02:23:18.000Z")
117 self.assertEquals(instance.placement, "us-east-1c")
118 self.assertEquals(instance.product_codes, [])
119 self.assertEquals(instance.kernel_id, None)
120 self.assertEquals(instance.ramdisk_id, None)
121
254 def test_parse_reservation(self):122 def test_parse_reservation(self):
255 creds = AWSCredentials("foo", "bar")123 creds = AWSCredentials("foo", "bar")
256 ec2 = client.EC2Client(creds=creds)124 ec2 = client.EC2Client(creds=creds)
257 results = ec2._parse_instances(sample_describe_instances_result)125 results = ec2._parse_instances(
126 payload.sample_describe_instances_result)
258 self.check_parsed_instances(results)127 self.check_parsed_instances(results)
259128
260 def test_describe_instances(self):129 def test_describe_instances(self):
@@ -264,13 +133,28 @@
264 self.assertEqual(creds.access_key, "foo")133 self.assertEqual(creds.access_key, "foo")
265 self.assertEqual(creds.secret_key, "bar")134 self.assertEqual(creds.secret_key, "bar")
266 def submit(self):135 def submit(self):
267 return succeed(sample_describe_instances_result)136 return succeed(payload.sample_describe_instances_result)
268 creds = AWSCredentials("foo", "bar")137 creds = AWSCredentials("foo", "bar")
269 ec2 = client.EC2Client(creds, query_factory=StubQuery)138 ec2 = client.EC2Client(creds, query_factory=StubQuery)
270 d = ec2.describe_instances()139 d = ec2.describe_instances()
271 d.addCallback(self.check_parsed_instances)140 d.addCallback(self.check_parsed_instances)
272 return d141 return d
273142
143 def test_describe_instances_required(self):
144 class StubQuery(object):
145 def __init__(stub, action, creds, endpoint):
146 self.assertEqual(action, 'DescribeInstances')
147 self.assertEqual(creds.access_key, "foo")
148 self.assertEqual(creds.secret_key, "bar")
149 def submit(self):
150 return succeed(
151 payload.sample_required_describe_instances_result)
152 creds = AWSCredentials("foo", "bar")
153 ec2 = client.EC2Client(creds, query_factory=StubQuery)
154 d = ec2.describe_instances()
155 d.addCallback(self.check_parsed_instances_required)
156 return d
157
274 def test_terminate_instances(self):158 def test_terminate_instances(self):
275 class StubQuery(object):159 class StubQuery(object):
276 def __init__(stub, action, creds, endpoint, other_params):160 def __init__(stub, action, creds, endpoint, other_params):
@@ -281,7 +165,7 @@
281 {'InstanceId.1': 'i-1234', 'InstanceId.2': 'i-5678'},165 {'InstanceId.1': 'i-1234', 'InstanceId.2': 'i-5678'},
282 other_params)166 other_params)
283 def submit(self):167 def submit(self):
284 return succeed(sample_terminate_instances_result)168 return succeed(payload.sample_terminate_instances_result)
285 creds = AWSCredentials("foo", "bar")169 creds = AWSCredentials("foo", "bar")
286 endpoint = AWSServiceEndpoint(uri=EC2_ENDPOINT_US)170 endpoint = AWSServiceEndpoint(uri=EC2_ENDPOINT_US)
287 ec2 = client.EC2Client(creds=creds, endpoint=endpoint,171 ec2 = client.EC2Client(creds=creds, endpoint=endpoint,
@@ -414,7 +298,7 @@
414 self.assertEquals(params, {})298 self.assertEquals(params, {})
415299
416 def submit(self):300 def submit(self):
417 return succeed(sample_describe_volumes_result)301 return succeed(payload.sample_describe_volumes_result)
418302
419 ec2 = client.EC2Client(creds="foo", query_factory=StubQuery)303 ec2 = client.EC2Client(creds="foo", query_factory=StubQuery)
420 d = ec2.describe_volumes()304 d = ec2.describe_volumes()
@@ -432,7 +316,7 @@
432 {"VolumeId.1": "vol-4282672b"})316 {"VolumeId.1": "vol-4282672b"})
433317
434 def submit(self):318 def submit(self):
435 return succeed(sample_describe_volumes_result)319 return succeed(payload.sample_describe_volumes_result)
436320
437 ec2 = client.EC2Client(creds="foo", query_factory=StubQuery)321 ec2 = client.EC2Client(creds="foo", query_factory=StubQuery)
438 d = ec2.describe_volumes("vol-4282672b")322 d = ec2.describe_volumes("vol-4282672b")
@@ -458,7 +342,7 @@
458 self.assertEquals(params, {})342 self.assertEquals(params, {})
459343
460 def submit(self):344 def submit(self):
461 return succeed(sample_describe_snapshots_result)345 return succeed(payload.sample_describe_snapshots_result)
462346
463 ec2 = client.EC2Client(creds="foo", query_factory=StubQuery)347 ec2 = client.EC2Client(creds="foo", query_factory=StubQuery)
464 d = ec2.describe_snapshots()348 d = ec2.describe_snapshots()
@@ -476,7 +360,7 @@
476 {"SnapshotId.1": "snap-78a54011"})360 {"SnapshotId.1": "snap-78a54011"})
477361
478 def submit(self):362 def submit(self):
479 return succeed(sample_describe_snapshots_result)363 return succeed(payload.sample_describe_snapshots_result)
480364
481 ec2 = client.EC2Client(creds="foo", query_factory=StubQuery)365 ec2 = client.EC2Client(creds="foo", query_factory=StubQuery)
482 d = ec2.describe_snapshots("snap-78a54011")366 d = ec2.describe_snapshots("snap-78a54011")
@@ -494,7 +378,7 @@
494 params)378 params)
495379
496 def submit(self):380 def submit(self):
497 return succeed(sample_create_volume_result)381 return succeed(payload.sample_create_volume_result)
498382
499 def check_parsed_volume(volume):383 def check_parsed_volume(volume):
500 self.assertEquals(volume.id, "vol-4d826724")384 self.assertEquals(volume.id, "vol-4d826724")
@@ -519,7 +403,7 @@
519 params)403 params)
520404
521 def submit(self):405 def submit(self):
522 return succeed(sample_create_volume_result)406 return succeed(payload.sample_create_volume_result)
523407
524 def check_parsed_volume(volume):408 def check_parsed_volume(volume):
525 self.assertEquals(volume.id, "vol-4d826724")409 self.assertEquals(volume.id, "vol-4d826724")
@@ -558,7 +442,7 @@
558 params)442 params)
559443
560 def submit(self):444 def submit(self):
561 return succeed(sample_delete_volume_result)445 return succeed(payload.sample_delete_volume_result)
562446
563 ec2 = client.EC2Client(creds="foo", query_factory=StubQuery)447 ec2 = client.EC2Client(creds="foo", query_factory=StubQuery)
564 d = ec2.delete_volume("vol-4282672b")448 d = ec2.delete_volume("vol-4282672b")
@@ -576,7 +460,7 @@
576 params)460 params)
577461
578 def submit(self):462 def submit(self):
579 return succeed(sample_create_snapshot_result)463 return succeed(payload.sample_create_snapshot_result)
580464
581 def check_parsed_snapshot(snapshot):465 def check_parsed_snapshot(snapshot):
582 self.assertEquals(snapshot.id, "snap-78a54011")466 self.assertEquals(snapshot.id, "snap-78a54011")
@@ -602,7 +486,7 @@
602 params)486 params)
603487
604 def submit(self):488 def submit(self):
605 return succeed(sample_delete_snapshot_result)489 return succeed(payload.sample_delete_snapshot_result)
606490
607 ec2 = client.EC2Client(creds="foo", query_factory=StubQuery)491 ec2 = client.EC2Client(creds="foo", query_factory=StubQuery)
608 d = ec2.delete_snapshot("snap-78a54011")492 d = ec2.delete_snapshot("snap-78a54011")
@@ -621,7 +505,7 @@
621 params)505 params)
622506
623 def submit(self):507 def submit(self):
624 return succeed(sample_attach_volume_result)508 return succeed(payload.sample_attach_volume_result)
625509
626 def check_parsed_response(response):510 def check_parsed_response(response):
627 self.assertEquals(511 self.assertEquals(
628512
=== added file 'txaws/testing/payload.py'
--- txaws/testing/payload.py 1970-01-01 00:00:00 +0000
+++ txaws/testing/payload.py 2009-08-31 20:07:58 +0000
@@ -0,0 +1,198 @@
1from txaws.version import aws_api
2
3
4sample_required_describe_instances_result = """<?xml version="1.0"?>
5<DescribeInstancesResponse xmlns="http://ec2.amazonaws.com/doc/""" + aws_api + """/">
6 <requestId>52b4c730-f29f-498d-94c1-91efb75994cc</requestId>
7 <reservationSet>
8 <item>
9 <reservationId>r-cf24b1a6</reservationId>
10 <ownerId>123456789012</ownerId>
11 <groupSet>
12 <item>
13 <groupId>default</groupId>
14 </item>
15 </groupSet>
16 <instancesSet>
17 <item>
18 <instanceId>i-abcdef01</instanceId>
19 <imageId>ami-12345678</imageId>
20 <instanceState>
21 <code>16</code>
22 <name>running</name>
23 </instanceState>
24 <privateDnsName>domU-12-31-39-03-15-11.compute-1.internal</privateDnsName>
25 <dnsName>ec2-75-101-245-65.compute-1.amazonaws.com</dnsName>
26 <instanceType>c1.xlarge</instanceType>
27 <launchTime>2009-04-27T02:23:18.000Z</launchTime>
28 <placement>
29 <availabilityZone>us-east-1c</availabilityZone>
30 </placement>
31 </item>
32 </instancesSet>
33 </item>
34 </reservationSet>
35</DescribeInstancesResponse>
36"""
37
38
39sample_describe_instances_result = """<?xml version="1.0"?>
40<DescribeInstancesResponse xmlns="http://ec2.amazonaws.com/doc/""" + aws_api + """/">
41 <requestId>52b4c730-f29f-498d-94c1-91efb75994cc</requestId>
42 <reservationSet>
43 <item>
44 <reservationId>r-cf24b1a6</reservationId>
45 <ownerId>123456789012</ownerId>
46 <groupSet>
47 <item>
48 <groupId>default</groupId>
49 </item>
50 </groupSet>
51 <instancesSet>
52 <item>
53 <instanceId>i-abcdef01</instanceId>
54 <imageId>ami-12345678</imageId>
55 <instanceState>
56 <code>16</code>
57 <name>running</name>
58 </instanceState>
59 <privateDnsName>domU-12-31-39-03-15-11.compute-1.internal</privateDnsName>
60 <dnsName>ec2-75-101-245-65.compute-1.amazonaws.com</dnsName>
61 <reason/>
62 <keyName>keyname</keyName>
63 <amiLaunchIndex>0</amiLaunchIndex>
64 <productCodes>
65 <productCode>774F4FF8</productCode>
66 </productCodes>
67
68 <instanceType>c1.xlarge</instanceType>
69 <launchTime>2009-04-27T02:23:18.000Z</launchTime>
70 <placement>
71 <availabilityZone>us-east-1c</availabilityZone>
72 </placement>
73 <kernelId>aki-b51cf9dc</kernelId>
74 <ramdiskId>ari-b31cf9da</ramdiskId>
75 </item>
76 </instancesSet>
77 </item>
78 </reservationSet>
79</DescribeInstancesResponse>
80"""
81
82
83sample_terminate_instances_result = """<?xml version="1.0"?>
84<TerminateInstancesResponse xmlns="http://ec2.amazonaws.com/doc/""" + aws_api + """/">
85 <instancesSet>
86 <item>
87 <instanceId>i-1234</instanceId>
88 <shutdownState>
89 <code>32</code>
90 <name>shutting-down</name>
91 </shutdownState>
92 <previousState>
93 <code>16</code>
94 <name>running</name>
95 </previousState>
96 </item>
97 <item>
98 <instanceId>i-5678</instanceId>
99 <shutdownState>
100 <code>32</code>
101 <name>shutting-down</name>
102 </shutdownState>
103 <previousState>
104 <code>32</code>
105 <name>shutting-down</name>
106 </previousState>
107 </item>
108 </instancesSet>
109</TerminateInstancesResponse>
110"""
111
112
113sample_describe_volumes_result = """<?xml version="1.0"?>
114<DescribeVolumesResponse xmlns="http://ec2.amazonaws.com/doc/""" + aws_api + """/">
115 <volumeSet>
116 <item>
117 <volumeId>vol-4282672b</volumeId>
118 <size>800</size>
119 <status>in-use</status>
120 <createTime>2008-05-07T11:51:50.000Z</createTime>
121 <attachmentSet>
122 <item>
123 <volumeId>vol-4282672b</volumeId>
124 <instanceId>i-6058a509</instanceId>
125 <size>800</size>
126 <snapshotId>snap-12345678</snapshotId>
127 <availabilityZone>us-east-1a</availabilityZone>
128 <status>attached</status>
129 <attachTime>2008-05-07T12:51:50.000Z</attachTime>
130 </item>
131 </attachmentSet>
132 </item>
133 </volumeSet>
134</DescribeVolumesResponse>
135"""
136
137
138sample_describe_snapshots_result = """<?xml version="1.0"?>
139<DescribeSnapshotsResponse xmlns="http://ec2.amazonaws.com/doc/""" + aws_api + """/">
140 <snapshotSet>
141 <item>
142 <snapshotId>snap-78a54011</snapshotId>
143 <volumeId>vol-4d826724</volumeId>
144 <status>pending</status>
145 <startTime>2008-05-07T12:51:50.000Z</startTime>
146 <progress>80%</progress>
147 </item>
148 </snapshotSet>
149</DescribeSnapshotsResponse>
150"""
151
152
153sample_create_volume_result = """<?xml version="1.0"?>
154<CreateVolumeResponse xmlns="http://ec2.amazonaws.com/doc/""" + aws_api + """/">
155 <volumeId>vol-4d826724</volumeId>
156 <size>800</size>
157 <status>creating</status>
158 <createTime>2008-05-07T11:51:50.000Z</createTime>
159 <availabilityZone>us-east-1a</availabilityZone>
160 <snapshotId></snapshotId>
161</CreateVolumeResponse>
162"""
163
164
165sample_delete_volume_result = """<?xml version="1.0"?>
166<DeleteVolumeResponse xmlns="http://ec2.amazonaws.com/doc/""" + aws_api + """/">
167 <return>true</return>
168</DeleteVolumeResponse>
169"""
170
171
172sample_create_snapshot_result = """<?xml version="1.0"?>
173<CreateSnapshotResponse xmlns="http://ec2.amazonaws.com/doc/""" + aws_api + """/">
174 <snapshotId>snap-78a54011</snapshotId>
175 <volumeId>vol-4d826724</volumeId>
176 <status>pending</status>
177 <startTime>2008-05-07T12:51:50.000Z</startTime>
178 <progress></progress>
179</CreateSnapshotResponse>
180"""
181
182
183sample_delete_snapshot_result = """<?xml version="1.0"?>
184<DeleteSnapshotResponse xmlns="http://ec2.amazonaws.com/doc/""" + aws_api + """/">
185 <return>true</return>
186</DeleteSnapshotResponse>
187"""
188
189
190sample_attach_volume_result = """<?xml version="1.0"?>
191<AttachVolumeResponse xmlns="http://ec2.amazonaws.com/doc/""" + aws_api + """/">
192 <volumeId>vol-4d826724</volumeId>
193 <instanceId>i-6058a509</instanceId>
194 <device>/dev/sdh</device>
195 <status>attaching</status>
196 <attachTime>2008-05-07T11:51:50.000Z</attachTime>
197</AttachVolumeResponse>
198"""
0199
=== added file 'txaws/version.py'
--- txaws/version.py 1970-01-01 00:00:00 +0000
+++ txaws/version.py 2009-08-31 20:07:58 +0000
@@ -0,0 +1,2 @@
1txaws = "0.0.1"
2aws_api = "2008-12-01"

Subscribers

People subscribed via source and target branches