1# Copyright (c) 2010 Mitch Garnaat http://garnaat.org/
2#
3# Permission is hereby granted, free of charge, to any person obtaining a
4# copy of this software and associated documentation files (the
5# "Software"), to deal in the Software without restriction, including
6# without limitation the rights to use, copy, modify, merge, publish, dis-
7# tribute, sublicense, and/or sell copies of the Software, and to permit
8# persons to whom the Software is furnished to do so, subject to the fol-
9# lowing conditions:
10#
11# The above copyright notice and this permission notice shall be included
12# in all copies or substantial portions of the Software.
13#
14# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
16# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
17# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
18# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20# IN THE SOFTWARE.
21
22"""
23Represents an EC2 Bundle Task
24"""
25
26from boto.ec2.ec2object import EC2Object
27
28
29class BundleInstanceTask(EC2Object):
30
31    def __init__(self, connection=None):
32        super(BundleInstanceTask, self).__init__(connection)
33        self.id = None
34        self.instance_id = None
35        self.progress = None
36        self.start_time = None
37        self.state = None
38        self.bucket = None
39        self.prefix = None
40        self.upload_policy = None
41        self.upload_policy_signature = None
42        self.update_time = None
43        self.code = None
44        self.message = None
45
46    def __repr__(self):
47        return 'BundleInstanceTask:%s' % self.id
48
49    def startElement(self, name, attrs, connection):
50        return None
51
52    def endElement(self, name, value, connection):
53        if name == 'bundleId':
54            self.id = value
55        elif name == 'instanceId':
56            self.instance_id = value
57        elif name == 'progress':
58            self.progress = value
59        elif name == 'startTime':
60            self.start_time = value
61        elif name == 'state':
62            self.state = value
63        elif name == 'bucket':
64            self.bucket = value
65        elif name == 'prefix':
66            self.prefix = value
67        elif name == 'uploadPolicy':
68            self.upload_policy = value
69        elif name == 'uploadPolicySignature':
70            self.upload_policy_signature = value
71        elif name == 'updateTime':
72            self.update_time = value
73        elif name == 'code':
74            self.code = value
75        elif name == 'message':
76            self.message = value
77        else:
78            setattr(self, name, value)
79