Mercurial > repos > shellac > guppy_basecaller
comparison env/lib/python3.7/site-packages/boto/vpc/routetable.py @ 2:6af9afd405e9 draft
"planemo upload commit 0a63dd5f4d38a1f6944587f52a8cd79874177fc1"
author | shellac |
---|---|
date | Thu, 14 May 2020 14:56:58 -0400 |
parents | 26e78fe6e8c4 |
children |
comparison
equal
deleted
inserted
replaced
1:75ca89e9b81c | 2:6af9afd405e9 |
---|---|
1 # Copyright (c) 2009-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 """ | |
23 Represents a Route Table | |
24 """ | |
25 | |
26 from boto.ec2.ec2object import TaggedEC2Object | |
27 from boto.resultset import ResultSet | |
28 | |
29 class RouteTable(TaggedEC2Object): | |
30 | |
31 def __init__(self, connection=None): | |
32 super(RouteTable, self).__init__(connection) | |
33 self.id = None | |
34 self.vpc_id = None | |
35 self.routes = [] | |
36 self.associations = [] | |
37 | |
38 def __repr__(self): | |
39 return 'RouteTable:%s' % self.id | |
40 | |
41 def startElement(self, name, attrs, connection): | |
42 result = super(RouteTable, self).startElement(name, attrs, connection) | |
43 | |
44 if result is not None: | |
45 # Parent found an interested element, just return it | |
46 return result | |
47 | |
48 if name == 'routeSet': | |
49 self.routes = ResultSet([('item', Route)]) | |
50 return self.routes | |
51 elif name == 'associationSet': | |
52 self.associations = ResultSet([('item', RouteAssociation)]) | |
53 return self.associations | |
54 else: | |
55 return None | |
56 | |
57 def endElement(self, name, value, connection): | |
58 if name == 'routeTableId': | |
59 self.id = value | |
60 elif name == 'vpcId': | |
61 self.vpc_id = value | |
62 else: | |
63 setattr(self, name, value) | |
64 | |
65 class Route(object): | |
66 def __init__(self, connection=None): | |
67 self.destination_cidr_block = None | |
68 self.gateway_id = None | |
69 self.instance_id = None | |
70 self.interface_id = None | |
71 self.vpc_peering_connection_id = None | |
72 self.state = None | |
73 self.origin = None | |
74 | |
75 def __repr__(self): | |
76 return 'Route:%s' % self.destination_cidr_block | |
77 | |
78 def startElement(self, name, attrs, connection): | |
79 return None | |
80 | |
81 def endElement(self, name, value, connection): | |
82 if name == 'destinationCidrBlock': | |
83 self.destination_cidr_block = value | |
84 elif name == 'gatewayId': | |
85 self.gateway_id = value | |
86 elif name == 'instanceId': | |
87 self.instance_id = value | |
88 elif name == 'networkInterfaceId': | |
89 self.interface_id = value | |
90 elif name == 'vpcPeeringConnectionId': | |
91 self.vpc_peering_connection_id = value | |
92 elif name == 'state': | |
93 self.state = value | |
94 elif name == 'origin': | |
95 self.origin = value | |
96 | |
97 class RouteAssociation(object): | |
98 def __init__(self, connection=None): | |
99 self.id = None | |
100 self.route_table_id = None | |
101 self.subnet_id = None | |
102 self.main = False | |
103 | |
104 def __repr__(self): | |
105 return 'RouteAssociation:%s' % self.id | |
106 | |
107 def startElement(self, name, attrs, connection): | |
108 return None | |
109 | |
110 def endElement(self, name, value, connection): | |
111 if name == 'routeTableAssociationId': | |
112 self.id = value | |
113 elif name == 'routeTableId': | |
114 self.route_table_id = value | |
115 elif name == 'subnetId': | |
116 self.subnet_id = value | |
117 elif name == 'main': | |
118 self.main = value == 'true' |