Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Side by Side Diff: boto/vpc/__init__.py

Issue 8386013: Merging in latest boto. (Closed) Base URL: svn://svn.chromium.org/boto
Patch Set: Redoing vendor drop by deleting and then merging. Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « boto/utils.py ('k') | boto/vpc/internetgateway.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2009 Mitch Garnaat http://garnaat.org/ 1 # Copyright (c) 2009 Mitch Garnaat http://garnaat.org/
2 # 2 #
3 # Permission is hereby granted, free of charge, to any person obtaining a 3 # Permission is hereby granted, free of charge, to any person obtaining a
4 # copy of this software and associated documentation files (the 4 # copy of this software and associated documentation files (the
5 # "Software"), to deal in the Software without restriction, including 5 # "Software"), to deal in the Software without restriction, including
6 # without limitation the rights to use, copy, modify, merge, publish, dis- 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 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- 8 # persons to whom the Software is furnished to do so, subject to the fol-
9 # lowing conditions: 9 # lowing conditions:
10 # 10 #
11 # The above copyright notice and this permission notice shall be included 11 # The above copyright notice and this permission notice shall be included
12 # in all copies or substantial portions of the Software. 12 # in all copies or substantial portions of the Software.
13 # 13 #
14 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 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- 15 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
16 # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 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, 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, 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 19 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 # IN THE SOFTWARE. 20 # IN THE SOFTWARE.
21 21
22 """ 22 """
23 Represents a connection to the EC2 service. 23 Represents a connection to the EC2 service.
24 """ 24 """
25 25
26 from boto.ec2.connection import EC2Connection 26 from boto.ec2.connection import EC2Connection
27 from boto.resultset import ResultSet
27 from boto.vpc.vpc import VPC 28 from boto.vpc.vpc import VPC
28 from boto.vpc.customergateway import CustomerGateway 29 from boto.vpc.customergateway import CustomerGateway
30 from boto.vpc.routetable import RouteTable
31 from boto.vpc.internetgateway import InternetGateway
29 from boto.vpc.vpngateway import VpnGateway, Attachment 32 from boto.vpc.vpngateway import VpnGateway, Attachment
30 from boto.vpc.dhcpoptions import DhcpOptions 33 from boto.vpc.dhcpoptions import DhcpOptions
31 from boto.vpc.subnet import Subnet 34 from boto.vpc.subnet import Subnet
32 from boto.vpc.vpnconnection import VpnConnection 35 from boto.vpc.vpnconnection import VpnConnection
33 36
34 class VPCConnection(EC2Connection): 37 class VPCConnection(EC2Connection):
35 38
36 # VPC methods 39 # VPC methods
37 40
38 def get_all_vpcs(self, vpc_ids=None, filters=None): 41 def get_all_vpcs(self, vpc_ids=None, filters=None):
39 """ 42 """
40 Retrieve information about your VPCs. You can filter results to 43 Retrieve information about your VPCs. You can filter results to
41 return information only about those VPCs that match your search 44 return information only about those VPCs that match your search
42 parameters. Otherwise, all VPCs associated with your account 45 parameters. Otherwise, all VPCs associated with your account
43 are returned. 46 are returned.
44 47
45 :type vpc_ids: list 48 :type vpc_ids: list
46 :param vpc_ids: A list of strings with the desired VPC ID's 49 :param vpc_ids: A list of strings with the desired VPC ID's
47 50
48 :type filters: list of tuples 51 :type filters: list of tuples
49 :param filters: A list of tuples containing filters. Each tuple 52 :param filters: A list of tuples containing filters. Each tuple
50 consists of a filter key and a filter value. 53 consists of a filter key and a filter value.
51 Possible filter keys are: 54 Possible filter keys are:
52 55
53 - *state*, the state of the VPC (pending or available) 56 - *state*, the state of the VPC (pending or available)
54 - *cidrBlock*, CIDR block of the VPC 57 - *cidrBlock*, CIDR block of the VPC
55 - *dhcpOptionsId*, the ID of a set of DHCP options 58 - *dhcpOptionsId*, the ID of a set of DHCP options
56 59
57 :rtype: list 60 :rtype: list
58 :return: A list of :class:`boto.vpc.vpc.VPC` 61 :return: A list of :class:`boto.vpc.vpc.VPC`
59 """ 62 """
60 params = {} 63 params = {}
61 if vpc_ids: 64 if vpc_ids:
62 self.build_list_params(params, vpc_ids, 'VpcId') 65 self.build_list_params(params, vpc_ids, 'VpcId')
63 if filters: 66 if filters:
64 i = 1 67 i = 1
65 for filter in filters: 68 for filter in filters:
66 params[('Filter.%d.Key' % i)] = filter[0] 69 params[('Filter.%d.Name' % i)] = filter[0]
67 params[('Filter.%d.Value.1')] = filter[1] 70 params[('Filter.%d.Value.1' % i)] = filter[1]
68 i += 1 71 i += 1
69 return self.get_list('DescribeVpcs', params, [('item', VPC)]) 72 return self.get_list('DescribeVpcs', params, [('item', VPC)])
70 73
71 def create_vpc(self, cidr_block): 74 def create_vpc(self, cidr_block):
72 """ 75 """
73 Create a new Virtual Private Cloud. 76 Create a new Virtual Private Cloud.
74 77
75 :type cidr_block: str 78 :type cidr_block: str
76 :param cidr_block: A valid CIDR block 79 :param cidr_block: A valid CIDR block
77 80
78 :rtype: The newly created VPC 81 :rtype: The newly created VPC
79 :return: A :class:`boto.vpc.vpc.VPC` object 82 :return: A :class:`boto.vpc.vpc.VPC` object
80 """ 83 """
81 params = {'CidrBlock' : cidr_block} 84 params = {'CidrBlock' : cidr_block}
82 return self.get_object('CreateVpc', params, VPC) 85 return self.get_object('CreateVpc', params, VPC)
83 86
84 def delete_vpc(self, vpc_id): 87 def delete_vpc(self, vpc_id):
85 """ 88 """
86 Delete a Virtual Private Cloud. 89 Delete a Virtual Private Cloud.
87 90
88 :type vpc_id: str 91 :type vpc_id: str
89 :param vpc_id: The ID of the vpc to be deleted. 92 :param vpc_id: The ID of the vpc to be deleted.
90 93
91 :rtype: bool 94 :rtype: bool
92 :return: True if successful 95 :return: True if successful
93 """ 96 """
94 params = {'VpcId': vpc_id} 97 params = {'VpcId': vpc_id}
95 return self.get_status('DeleteVpc', params) 98 return self.get_status('DeleteVpc', params)
96 99
100 # Route Tables
101
102 def get_all_route_tables(self, route_table_ids=None, filters=None):
103 """
104 Retrieve information about your routing tables. You can filter results
105 to return information only about those route tables that match your
106 search parameters. Otherwise, all route tables associated with your
107 account are returned.
108
109 :type route_table_ids: list
110 :param route_table_ids: A list of strings with the desired route table
111 IDs.
112
113 :type filters: list of tuples
114 :param filters: A list of tuples containing filters. Each tuple
115 consists of a filter key and a filter value.
116
117 :rtype: list
118 :return: A list of :class:`boto.vpc.routetable.RouteTable`
119 """
120 params = {}
121 if route_table_ids:
122 self.build_list_params(params, route_table_ids, "RouteTableId")
123 if filters:
124 self.build_filter_params(params, dict(filters))
125 return self.get_list('DescribeRouteTables', params, [('item', RouteTable )])
126
127 def associate_route_table(self, route_table_id, subnet_id):
128 """
129 Associates a route table with a specific subnet.
130
131 :type route_table_id: str
132 :param route_table_id: The ID of the route table to associate.
133
134 :type subnet_id: str
135 :param subnet_id: The ID of the subnet to associate with.
136
137 :rtype: str
138 :return: The ID of the association created
139 """
140 params = {
141 'RouteTableId': route_table_id,
142 'SubnetId': subnet_id
143 }
144
145 result = self.get_object('AssociateRouteTable', params, ResultSet)
146 return result.associationId
147
148 def disassociate_route_table(self, association_id):
149 """
150 Removes an association from a route table. This will cause all subnets
151 that would've used this association to now use the main routing
152 association instead.
153
154 :type association_id: str
155 :param association_id: The ID of the association to disassociate.
156
157 :rtype: bool
158 :return: True if successful
159 """
160 params = { 'AssociationId': association_id }
161 return self.get_status('DisassociateRouteTable', params)
162
163 def create_route_table(self, vpc_id):
164 """
165 Creates a new route table.
166
167 :type vpc_id: str
168 :param vpc_id: The VPC ID to associate this route table with.
169
170 :rtype: The newly created route table
171 :return: A :class:`boto.vpc.routetable.RouteTable` object
172 """
173 params = { 'VpcId': vpc_id }
174 return self.get_object('CreateRouteTable', params, RouteTable)
175
176 def delete_route_table(self, route_table_id):
177 """
178 Delete a route table.
179
180 :type route_table_id: str
181 :param route_table_id: The ID of the route table to delete.
182
183 :rtype: bool
184 :return: True if successful
185 """
186 params = { 'RouteTableId': route_table_id }
187 return self.get_status('DeleteRouteTable', params)
188
189 def create_route(self, route_table_id, destination_cidr_block, gateway_id=No ne, instance_id=None):
190 """
191 Creates a new route in the route table within a VPC. The route's target
192 can be either a gateway attached to the VPC or a NAT instance in the
193 VPC.
194
195 :type route_table_id: str
196 :param route_table_id: The ID of the route table for the route.
197
198 :type destination_cidr_block: str
199 :param destination_cidr_block: The CIDR address block used for the
200 destination match.
201
202 :type gateway_id: str
203 :param gateway_id: The ID of the gateway attached to your VPC.
204
205 :type instance_id: str
206 :param instance_id: The ID of a NAT instance in your VPC.
207
208 :rtype: bool
209 :return: True if successful
210 """
211 params = {
212 'RouteTableId': route_table_id,
213 'DestinationCidrBlock': destination_cidr_block
214 }
215
216 if gateway_id is not None:
217 params['GatewayId'] = gateway_id
218 elif instance_id is not None:
219 params['InstanceId'] = instance_id
220
221 return self.get_status('CreateRoute', params)
222
223 def delete_route(self, route_table_id, destination_cidr_block):
224 """
225 Deletes a route from a route table within a VPC.
226
227 :type route_table_id: str
228 :param route_table_id: The ID of the route table with the route.
229
230 :type destination_cidr_block: str
231 :param destination_cidr_block: The CIDR address block used for
232 destination match.
233
234 :rtype: bool
235 :return: True if successful
236 """
237 params = {
238 'RouteTableId': route_table_id,
239 'DestinationCidrBlock': destination_cidr_block
240 }
241
242 return self.get_status('DeleteRoute', params)
243
244 # Internet Gateways
245
246 def get_all_internet_gateways(self, internet_gateway_ids=None, filters=None) :
247 """
248 Get a list of internet gateways. You can filter results to return inform ation
249 about only those gateways that you're interested in.
250
251 :type internet_gateway_ids: list
252 :param internet_gateway_ids: A list of strings with the desired gateway IDs.
253
254 :type filters: list of tuples
255 :param filters: A list of tuples containing filters. Each tuple
256 consists of a filter key and a filter value.
257 """
258 params = {}
259
260 if internet_gateway_ids:
261 self.build_list_params(params, internet_gateway_ids, 'InternetGatewa yId')
262 if filters:
263 self.build_filter_params(params, dict(filters))
264
265 return self.get_list('DescribeInternetGateways', params, [('item', Inter netGateway)])
266
267 def create_internet_gateway(self):
268 """
269 Creates an internet gateway for VPC.
270
271 :rtype: Newly created internet gateway.
272 :return: `boto.vpc.internetgateway.InternetGateway`
273 """
274 return self.get_object('CreateInternetGateway', {}, InternetGateway)
275
276 def delete_internet_gateway(self, internet_gateway_id):
277 """
278 Deletes an internet gateway from the VPC.
279
280 :type internet_gateway_id: str
281 :param internet_gateway_id: The ID of the internet gateway to delete.
282
283 :rtype: Bool
284 :return: True if successful
285 """
286 params = { 'InternetGatewayId': internet_gateway_id }
287 return self.get_status('DeleteInternetGateway', params)
288
289 def attach_internet_gateway(self, internet_gateway_id, vpc_id):
290 """
291 Attach an internet gateway to a specific VPC.
292
293 :type internet_gateway_id: str
294 :param internet_gateway_id: The ID of the internet gateway to delete.
295
296 :type vpc_id: str
297 :param vpc_id: The ID of the VPC to attach to.
298
299 :rtype: Bool
300 :return: True if successful
301 """
302 params = {
303 'InternetGatewayId': internet_gateway_id,
304 'VpcId': vpc_id
305 }
306
307 return self.get_status('AttachInternetGateway', params)
308
309 def detach_internet_gateway(self, internet_gateway_id, vpc_id):
310 """
311 Detach an internet gateway from a specific VPC.
312
313 :type internet_gateway_id: str
314 :param internet_gateway_id: The ID of the internet gateway to delete.
315
316 :type vpc_id: str
317 :param vpc_id: The ID of the VPC to attach to.
318
319 :rtype: Bool
320 :return: True if successful
321 """
322 params = {
323 'InternetGatewayId': internet_gateway_id,
324 'VpcId': vpc_id
325 }
326
327 return self.get_status('DetachInternetGateway', params)
328
97 # Customer Gateways 329 # Customer Gateways
98 330
99 def get_all_customer_gateways(self, customer_gateway_ids=None, filters=None) : 331 def get_all_customer_gateways(self, customer_gateway_ids=None, filters=None) :
100 """ 332 """
101 Retrieve information about your CustomerGateways. You can filter result s to 333 Retrieve information about your CustomerGateways. You can filter result s to
102 return information only about those CustomerGateways that match your sea rch 334 return information only about those CustomerGateways that match your sea rch
103 parameters. Otherwise, all CustomerGateways associated with your accoun t 335 parameters. Otherwise, all CustomerGateways associated with your accoun t
104 are returned. 336 are returned.
105 337
106 :type customer_gateway_ids: list 338 :type customer_gateway_ids: list
107 :param customer_gateway_ids: A list of strings with the desired Customer Gateway ID's 339 :param customer_gateway_ids: A list of strings with the desired Customer Gateway ID's
108 340
109 :type filters: list of tuples 341 :type filters: list of tuples
110 :param filters: A list of tuples containing filters. Each tuple 342 :param filters: A list of tuples containing filters. Each tuple
111 consists of a filter key and a filter value. 343 consists of a filter key and a filter value.
112 Possible filter keys are: 344 Possible filter keys are:
113 345
114 - *state*, the state of the CustomerGateway 346 - *state*, the state of the CustomerGateway
115 (pending,available,deleting,deleted) 347 (pending,available,deleting,deleted)
116 - *type*, the type of customer gateway (ipsec.1) 348 - *type*, the type of customer gateway (ipsec.1)
117 - *ipAddress* the IP address of customer gateway's 349 - *ipAddress* the IP address of customer gateway's
118 internet-routable external inteface 350 internet-routable external inteface
119 351
120 :rtype: list 352 :rtype: list
121 :return: A list of :class:`boto.vpc.customergateway.CustomerGateway` 353 :return: A list of :class:`boto.vpc.customergateway.CustomerGateway`
122 """ 354 """
123 params = {} 355 params = {}
124 if customer_gateway_ids: 356 if customer_gateway_ids:
125 self.build_list_params(params, customer_gateway_ids, 'CustomerGatewa yId') 357 self.build_list_params(params, customer_gateway_ids, 'CustomerGatewa yId')
126 if filters: 358 if filters:
127 i = 1 359 i = 1
128 for filter in filters: 360 for filter in filters:
129 params[('Filter.%d.Key' % i)] = filter[0] 361 params[('Filter.%d.Name' % i)] = filter[0]
130 params[('Filter.%d.Value.1')] = filter[1] 362 params[('Filter.%d.Value.1')] = filter[1]
131 i += 1 363 i += 1
132 return self.get_list('DescribeCustomerGateways', params, [('item', Custo merGateway)]) 364 return self.get_list('DescribeCustomerGateways', params, [('item', Custo merGateway)])
133 365
134 def create_customer_gateway(self, type, ip_address, bgp_asn): 366 def create_customer_gateway(self, type, ip_address, bgp_asn):
135 """ 367 """
136 Create a new Customer Gateway 368 Create a new Customer Gateway
137 369
138 :type type: str 370 :type type: str
139 :param type: Type of VPN Connection. Only valid valid currently is 'ips ec.1' 371 :param type: Type of VPN Connection. Only valid valid currently is 'ips ec.1'
140 372
141 :type ip_address: str 373 :type ip_address: str
142 :param ip_address: Internet-routable IP address for customer's gateway. 374 :param ip_address: Internet-routable IP address for customer's gateway.
143 Must be a static address. 375 Must be a static address.
144 376
145 :type bgp_asn: str 377 :type bgp_asn: str
146 :param bgp_asn: Customer gateway's Border Gateway Protocol (BGP) 378 :param bgp_asn: Customer gateway's Border Gateway Protocol (BGP)
147 Autonomous System Number (ASN) 379 Autonomous System Number (ASN)
148 380
149 :rtype: The newly created CustomerGateway 381 :rtype: The newly created CustomerGateway
150 :return: A :class:`boto.vpc.customergateway.CustomerGateway` object 382 :return: A :class:`boto.vpc.customergateway.CustomerGateway` object
151 """ 383 """
152 params = {'Type' : type, 384 params = {'Type' : type,
153 'IpAddress' : ip_address, 385 'IpAddress' : ip_address,
154 'BgpAsn' : bgp_asn} 386 'BgpAsn' : bgp_asn}
155 return self.get_object('CreateCustomerGateway', params, CustomerGateway) 387 return self.get_object('CreateCustomerGateway', params, CustomerGateway)
156 388
157 def delete_customer_gateway(self, customer_gateway_id): 389 def delete_customer_gateway(self, customer_gateway_id):
158 """ 390 """
159 Delete a Customer Gateway. 391 Delete a Customer Gateway.
160 392
161 :type customer_gateway_id: str 393 :type customer_gateway_id: str
162 :param customer_gateway_id: The ID of the customer_gateway to be deleted . 394 :param customer_gateway_id: The ID of the customer_gateway to be deleted .
163 395
164 :rtype: bool 396 :rtype: bool
165 :return: True if successful 397 :return: True if successful
166 """ 398 """
167 params = {'CustomerGatewayId': customer_gateway_id} 399 params = {'CustomerGatewayId': customer_gateway_id}
168 return self.get_status('DeleteCustomerGateway', params) 400 return self.get_status('DeleteCustomerGateway', params)
169 401
170 # VPN Gateways 402 # VPN Gateways
171 403
172 def get_all_vpn_gateways(self, vpn_gateway_ids=None, filters=None): 404 def get_all_vpn_gateways(self, vpn_gateway_ids=None, filters=None):
173 """ 405 """
174 Retrieve information about your VpnGateways. You can filter results to 406 Retrieve information about your VpnGateways. You can filter results to
175 return information only about those VpnGateways that match your search 407 return information only about those VpnGateways that match your search
176 parameters. Otherwise, all VpnGateways associated with your account 408 parameters. Otherwise, all VpnGateways associated with your account
177 are returned. 409 are returned.
178 410
179 :type vpn_gateway_ids: list 411 :type vpn_gateway_ids: list
180 :param vpn_gateway_ids: A list of strings with the desired VpnGateway ID 's 412 :param vpn_gateway_ids: A list of strings with the desired VpnGateway ID 's
181 413
182 :type filters: list of tuples 414 :type filters: list of tuples
183 :param filters: A list of tuples containing filters. Each tuple 415 :param filters: A list of tuples containing filters. Each tuple
184 consists of a filter key and a filter value. 416 consists of a filter key and a filter value.
185 Possible filter keys are: 417 Possible filter keys are:
186 418
187 - *state*, the state of the VpnGateway 419 - *state*, the state of the VpnGateway
188 (pending,available,deleting,deleted) 420 (pending,available,deleting,deleted)
189 - *type*, the type of customer gateway (ipsec.1) 421 - *type*, the type of customer gateway (ipsec.1)
190 - *availabilityZone*, the Availability zone the 422 - *availabilityZone*, the Availability zone the
191 VPN gateway is in. 423 VPN gateway is in.
192 424
193 :rtype: list 425 :rtype: list
194 :return: A list of :class:`boto.vpc.customergateway.VpnGateway` 426 :return: A list of :class:`boto.vpc.customergateway.VpnGateway`
195 """ 427 """
196 params = {} 428 params = {}
197 if vpn_gateway_ids: 429 if vpn_gateway_ids:
198 self.build_list_params(params, vpn_gateway_ids, 'VpnGatewayId') 430 self.build_list_params(params, vpn_gateway_ids, 'VpnGatewayId')
199 if filters: 431 if filters:
200 i = 1 432 i = 1
201 for filter in filters: 433 for filter in filters:
202 params[('Filter.%d.Key' % i)] = filter[0] 434 params[('Filter.%d.Name' % i)] = filter[0]
203 params[('Filter.%d.Value.1')] = filter[1] 435 params[('Filter.%d.Value.1')] = filter[1]
204 i += 1 436 i += 1
205 return self.get_list('DescribeVpnGateways', params, [('item', VpnGateway )]) 437 return self.get_list('DescribeVpnGateways', params, [('item', VpnGateway )])
206 438
207 def create_vpn_gateway(self, type, availability_zone=None): 439 def create_vpn_gateway(self, type, availability_zone=None):
208 """ 440 """
209 Create a new Vpn Gateway 441 Create a new Vpn Gateway
210 442
211 :type type: str 443 :type type: str
212 :param type: Type of VPN Connection. Only valid valid currently is 'ips ec.1' 444 :param type: Type of VPN Connection. Only valid valid currently is 'ips ec.1'
213 445
214 :type availability_zone: str 446 :type availability_zone: str
215 :param availability_zone: The Availability Zone where you want the VPN g ateway. 447 :param availability_zone: The Availability Zone where you want the VPN g ateway.
216 448
217 :rtype: The newly created VpnGateway 449 :rtype: The newly created VpnGateway
218 :return: A :class:`boto.vpc.vpngateway.VpnGateway` object 450 :return: A :class:`boto.vpc.vpngateway.VpnGateway` object
219 """ 451 """
220 params = {'Type' : type} 452 params = {'Type' : type}
221 if availability_zone: 453 if availability_zone:
222 params['AvailabilityZone'] = availability_zone 454 params['AvailabilityZone'] = availability_zone
223 return self.get_object('CreateVpnGateway', params, VpnGateway) 455 return self.get_object('CreateVpnGateway', params, VpnGateway)
224 456
225 def delete_vpn_gateway(self, vpn_gateway_id): 457 def delete_vpn_gateway(self, vpn_gateway_id):
226 """ 458 """
227 Delete a Vpn Gateway. 459 Delete a Vpn Gateway.
228 460
229 :type vpn_gateway_id: str 461 :type vpn_gateway_id: str
230 :param vpn_gateway_id: The ID of the vpn_gateway to be deleted. 462 :param vpn_gateway_id: The ID of the vpn_gateway to be deleted.
231 463
232 :rtype: bool 464 :rtype: bool
233 :return: True if successful 465 :return: True if successful
234 """ 466 """
(...skipping 18 matching lines...) Expand all
253 return self.get_object('AttachVpnGateway', params, Attachment) 485 return self.get_object('AttachVpnGateway', params, Attachment)
254 486
255 # Subnets 487 # Subnets
256 488
257 def get_all_subnets(self, subnet_ids=None, filters=None): 489 def get_all_subnets(self, subnet_ids=None, filters=None):
258 """ 490 """
259 Retrieve information about your Subnets. You can filter results to 491 Retrieve information about your Subnets. You can filter results to
260 return information only about those Subnets that match your search 492 return information only about those Subnets that match your search
261 parameters. Otherwise, all Subnets associated with your account 493 parameters. Otherwise, all Subnets associated with your account
262 are returned. 494 are returned.
263 495
264 :type subnet_ids: list 496 :type subnet_ids: list
265 :param subnet_ids: A list of strings with the desired Subnet ID's 497 :param subnet_ids: A list of strings with the desired Subnet ID's
266 498
267 :type filters: list of tuples 499 :type filters: list of tuples
268 :param filters: A list of tuples containing filters. Each tuple 500 :param filters: A list of tuples containing filters. Each tuple
269 consists of a filter key and a filter value. 501 consists of a filter key and a filter value.
270 Possible filter keys are: 502 Possible filter keys are:
271 503
272 - *state*, the state of the Subnet 504 - *state*, the state of the Subnet
273 (pending,available) 505 (pending,available)
274 - *vpdId*, the ID of teh VPC the subnet is in. 506 - *vpdId*, the ID of teh VPC the subnet is in.
275 - *cidrBlock*, CIDR block of the subnet 507 - *cidrBlock*, CIDR block of the subnet
276 - *availabilityZone*, the Availability Zone 508 - *availabilityZone*, the Availability Zone
277 the subnet is in. 509 the subnet is in.
278 510
279 511
280 :rtype: list 512 :rtype: list
281 :return: A list of :class:`boto.vpc.subnet.Subnet` 513 :return: A list of :class:`boto.vpc.subnet.Subnet`
282 """ 514 """
283 params = {} 515 params = {}
284 if subnet_ids: 516 if subnet_ids:
285 self.build_list_params(params, subnet_ids, 'SubnetId') 517 self.build_list_params(params, subnet_ids, 'SubnetId')
286 if filters: 518 if filters:
287 i = 1 519 i = 1
288 for filter in filters: 520 for filter in filters:
289 params[('Filter.%d.Key' % i)] = filter[0] 521 params[('Filter.%d.Name' % i)] = filter[0]
290 params[('Filter.%d.Value.1' % i)] = filter[1] 522 params[('Filter.%d.Value.1' % i)] = filter[1]
291 i += 1 523 i += 1
292 return self.get_list('DescribeSubnets', params, [('item', Subnet)]) 524 return self.get_list('DescribeSubnets', params, [('item', Subnet)])
293 525
294 def create_subnet(self, vpc_id, cidr_block, availability_zone=None): 526 def create_subnet(self, vpc_id, cidr_block, availability_zone=None):
295 """ 527 """
296 Create a new Subnet 528 Create a new Subnet
297 529
298 :type vpc_id: str 530 :type vpc_id: str
299 :param vpc_id: The ID of the VPC where you want to create the subnet. 531 :param vpc_id: The ID of the VPC where you want to create the subnet.
300 532
301 :type cidr_block: str 533 :type cidr_block: str
302 :param cidr_block: The CIDR block you want the subnet to cover. 534 :param cidr_block: The CIDR block you want the subnet to cover.
303 535
304 :type availability_zone: str 536 :type availability_zone: str
305 :param availability_zone: The AZ you want the subnet in 537 :param availability_zone: The AZ you want the subnet in
306 538
307 :rtype: The newly created Subnet 539 :rtype: The newly created Subnet
308 :return: A :class:`boto.vpc.customergateway.Subnet` object 540 :return: A :class:`boto.vpc.customergateway.Subnet` object
309 """ 541 """
310 params = {'VpcId' : vpc_id, 542 params = {'VpcId' : vpc_id,
311 'CidrBlock' : cidr_block} 543 'CidrBlock' : cidr_block}
312 if availability_zone: 544 if availability_zone:
313 params['AvailabilityZone'] = availability_zone 545 params['AvailabilityZone'] = availability_zone
314 return self.get_object('CreateSubnet', params, Subnet) 546 return self.get_object('CreateSubnet', params, Subnet)
315 547
316 def delete_subnet(self, subnet_id): 548 def delete_subnet(self, subnet_id):
317 """ 549 """
318 Delete a subnet. 550 Delete a subnet.
319 551
320 :type subnet_id: str 552 :type subnet_id: str
321 :param subnet_id: The ID of the subnet to be deleted. 553 :param subnet_id: The ID of the subnet to be deleted.
322 554
323 :rtype: bool 555 :rtype: bool
324 :return: True if successful 556 :return: True if successful
325 """ 557 """
326 params = {'SubnetId': subnet_id} 558 params = {'SubnetId': subnet_id}
327 return self.get_status('DeleteSubnet', params) 559 return self.get_status('DeleteSubnet', params)
328 560
329 561
330 # DHCP Options 562 # DHCP Options
331 563
332 def get_all_dhcp_options(self, dhcp_options_ids=None): 564 def get_all_dhcp_options(self, dhcp_options_ids=None):
333 """ 565 """
334 Retrieve information about your DhcpOptions. 566 Retrieve information about your DhcpOptions.
335 567
336 :type dhcp_options_ids: list 568 :type dhcp_options_ids: list
337 :param dhcp_options_ids: A list of strings with the desired DhcpOption I D's 569 :param dhcp_options_ids: A list of strings with the desired DhcpOption I D's
338 570
339 :rtype: list 571 :rtype: list
340 :return: A list of :class:`boto.vpc.dhcpoptions.DhcpOptions` 572 :return: A list of :class:`boto.vpc.dhcpoptions.DhcpOptions`
341 """ 573 """
342 params = {} 574 params = {}
343 if dhcp_options_ids: 575 if dhcp_options_ids:
344 self.build_list_params(params, dhcp_options_ids, 'DhcpOptionsId') 576 self.build_list_params(params, dhcp_options_ids, 'DhcpOptionsId')
345 return self.get_list('DescribeDhcpOptions', params, [('item', DhcpOption s)]) 577 return self.get_list('DescribeDhcpOptions', params, [('item', DhcpOption s)])
346 578
347 def create_dhcp_options(self, vpc_id, cidr_block, availability_zone=None): 579 def create_dhcp_options(self, vpc_id, cidr_block, availability_zone=None):
348 """ 580 """
349 Create a new DhcpOption 581 Create a new DhcpOption
350 582
351 :type vpc_id: str 583 :type vpc_id: str
352 :param vpc_id: The ID of the VPC where you want to create the subnet. 584 :param vpc_id: The ID of the VPC where you want to create the subnet.
353 585
354 :type cidr_block: str 586 :type cidr_block: str
355 :param cidr_block: The CIDR block you want the subnet to cover. 587 :param cidr_block: The CIDR block you want the subnet to cover.
356 588
357 :type availability_zone: str 589 :type availability_zone: str
358 :param availability_zone: The AZ you want the subnet in 590 :param availability_zone: The AZ you want the subnet in
359 591
360 :rtype: The newly created DhcpOption 592 :rtype: The newly created DhcpOption
361 :return: A :class:`boto.vpc.customergateway.DhcpOption` object 593 :return: A :class:`boto.vpc.customergateway.DhcpOption` object
362 """ 594 """
363 params = {'VpcId' : vpc_id, 595 params = {'VpcId' : vpc_id,
364 'CidrBlock' : cidr_block} 596 'CidrBlock' : cidr_block}
365 if availability_zone: 597 if availability_zone:
366 params['AvailabilityZone'] = availability_zone 598 params['AvailabilityZone'] = availability_zone
367 return self.get_object('CreateDhcpOption', params, DhcpOptions) 599 return self.get_object('CreateDhcpOption', params, DhcpOptions)
368 600
369 def delete_dhcp_options(self, dhcp_options_id): 601 def delete_dhcp_options(self, dhcp_options_id):
370 """ 602 """
371 Delete a DHCP Options 603 Delete a DHCP Options
372 604
373 :type dhcp_options_id: str 605 :type dhcp_options_id: str
374 :param dhcp_options_id: The ID of the DHCP Options to be deleted. 606 :param dhcp_options_id: The ID of the DHCP Options to be deleted.
375 607
376 :rtype: bool 608 :rtype: bool
377 :return: True if successful 609 :return: True if successful
378 """ 610 """
379 params = {'DhcpOptionsId': dhcp_options_id} 611 params = {'DhcpOptionsId': dhcp_options_id}
380 return self.get_status('DeleteDhcpOptions', params) 612 return self.get_status('DeleteDhcpOptions', params)
381 613
382 def associate_dhcp_options(self, dhcp_options_id, vpc_id): 614 def associate_dhcp_options(self, dhcp_options_id, vpc_id):
383 """ 615 """
384 Associate a set of Dhcp Options with a VPC. 616 Associate a set of Dhcp Options with a VPC.
385 617
386 :type dhcp_options_id: str 618 :type dhcp_options_id: str
387 :param dhcp_options_id: The ID of the Dhcp Options 619 :param dhcp_options_id: The ID of the Dhcp Options
388 620
389 :type vpc_id: str 621 :type vpc_id: str
390 :param vpc_id: The ID of the VPC. 622 :param vpc_id: The ID of the VPC.
391 623
392 :rtype: bool 624 :rtype: bool
393 :return: True if successful 625 :return: True if successful
394 """ 626 """
395 params = {'DhcpOptionsId': dhcp_options_id, 627 params = {'DhcpOptionsId': dhcp_options_id,
396 'VpcId' : vpc_id} 628 'VpcId' : vpc_id}
397 return self.get_status('AssociateDhcpOptions', params) 629 return self.get_status('AssociateDhcpOptions', params)
398 630
399 # VPN Connection 631 # VPN Connection
400 632
401 def get_all_vpn_connections(self, vpn_connection_ids=None, filters=None): 633 def get_all_vpn_connections(self, vpn_connection_ids=None, filters=None):
402 """ 634 """
403 Retrieve information about your VPN_CONNECTIONs. You can filter results to 635 Retrieve information about your VPN_CONNECTIONs. You can filter results to
404 return information only about those VPN_CONNECTIONs that match your sear ch 636 return information only about those VPN_CONNECTIONs that match your sear ch
405 parameters. Otherwise, all VPN_CONNECTIONs associated with your account 637 parameters. Otherwise, all VPN_CONNECTIONs associated with your account
406 are returned. 638 are returned.
407 639
408 :type vpn_connection_ids: list 640 :type vpn_connection_ids: list
409 :param vpn_connection_ids: A list of strings with the desired VPN_CONNEC TION ID's 641 :param vpn_connection_ids: A list of strings with the desired VPN_CONNEC TION ID's
410 642
411 :type filters: list of tuples 643 :type filters: list of tuples
412 :param filters: A list of tuples containing filters. Each tuple 644 :param filters: A list of tuples containing filters. Each tuple
413 consists of a filter key and a filter value. 645 consists of a filter key and a filter value.
414 Possible filter keys are: 646 Possible filter keys are:
415 647
416 - *state*, the state of the VPN_CONNECTION 648 - *state*, the state of the VPN_CONNECTION
417 pending,available,deleting,deleted 649 pending,available,deleting,deleted
418 - *type*, the type of connection, currently 'ipsec.1' 650 - *type*, the type of connection, currently 'ipsec.1'
419 - *customerGatewayId*, the ID of the customer gateway 651 - *customerGatewayId*, the ID of the customer gateway
420 associated with the VPN 652 associated with the VPN
421 - *vpnGatewayId*, the ID of the VPN gateway associated 653 - *vpnGatewayId*, the ID of the VPN gateway associated
422 with the VPN connection 654 with the VPN connection
423 655
424 :rtype: list 656 :rtype: list
425 :return: A list of :class:`boto.vpn_connection.vpnconnection.VpnConnecti on` 657 :return: A list of :class:`boto.vpn_connection.vpnconnection.VpnConnecti on`
426 """ 658 """
427 params = {} 659 params = {}
428 if vpn_connection_ids: 660 if vpn_connection_ids:
429 self.build_list_params(params, vpn_connection_ids, 'Vpn_ConnectionId ') 661 self.build_list_params(params, vpn_connection_ids, 'Vpn_ConnectionId ')
430 if filters: 662 if filters:
431 i = 1 663 i = 1
432 for filter in filters: 664 for filter in filters:
433 params[('Filter.%d.Key' % i)] = filter[0] 665 params[('Filter.%d.Name' % i)] = filter[0]
434 params[('Filter.%d.Value.1')] = filter[1] 666 params[('Filter.%d.Value.1')] = filter[1]
435 i += 1 667 i += 1
436 return self.get_list('DescribeVpnConnections', params, [('item', VpnConn ection)]) 668 return self.get_list('DescribeVpnConnections', params, [('item', VpnConn ection)])
437 669
438 def create_vpn_connection(self, type, customer_gateway_id, vpn_gateway_id): 670 def create_vpn_connection(self, type, customer_gateway_id, vpn_gateway_id):
439 """ 671 """
440 Create a new VPN Connection. 672 Create a new VPN Connection.
441 673
442 :type type: str 674 :type type: str
443 :param type: The type of VPN Connection. Currently only 'ipsec.1' 675 :param type: The type of VPN Connection. Currently only 'ipsec.1'
444 is supported 676 is supported
445 677
446 :type customer_gateway_id: str 678 :type customer_gateway_id: str
447 :param customer_gateway_id: The ID of the customer gateway. 679 :param customer_gateway_id: The ID of the customer gateway.
448 680
449 :type vpn_gateway_id: str 681 :type vpn_gateway_id: str
450 :param vpn_gateway_id: The ID of the VPN gateway. 682 :param vpn_gateway_id: The ID of the VPN gateway.
451 683
452 :rtype: The newly created VpnConnection 684 :rtype: The newly created VpnConnection
453 :return: A :class:`boto.vpc.vpnconnection.VpnConnection` object 685 :return: A :class:`boto.vpc.vpnconnection.VpnConnection` object
454 """ 686 """
455 params = {'Type' : type, 687 params = {'Type' : type,
456 'CustomerGatewayId' : customer_gateway_id, 688 'CustomerGatewayId' : customer_gateway_id,
457 'VpnGatewayId' : vpn_gateway_id} 689 'VpnGatewayId' : vpn_gateway_id}
458 return self.get_object('CreateVpnConnection', params, VpnConnection) 690 return self.get_object('CreateVpnConnection', params, VpnConnection)
459 691
460 def delete_vpn_connection(self, vpn_connection_id): 692 def delete_vpn_connection(self, vpn_connection_id):
461 """ 693 """
462 Delete a VPN Connection. 694 Delete a VPN Connection.
463 695
464 :type vpn_connection_id: str 696 :type vpn_connection_id: str
465 :param vpn_connection_id: The ID of the vpn_connection to be deleted. 697 :param vpn_connection_id: The ID of the vpn_connection to be deleted.
466 698
467 :rtype: bool 699 :rtype: bool
468 :return: True if successful 700 :return: True if successful
469 """ 701 """
470 params = {'VpnConnectionId': vpn_connection_id} 702 params = {'VpnConnectionId': vpn_connection_id}
471 return self.get_status('DeleteVpnConnection', params) 703 return self.get_status('DeleteVpnConnection', params)
472 704
473 705
OLDNEW
« no previous file with comments | « boto/utils.py ('k') | boto/vpc/internetgateway.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698