1
# Software License Agreement (BSD License)
3
# Copyright (c) 2009-2011, Eucalyptus Systems, Inc.
6
# Redistribution and use of this software in source and binary forms, with or
7
# without modification, are permitted provided that the following conditions
10
# Redistributions of source code must retain the above
11
# copyright notice, this list of conditions and the
12
# following disclaimer.
14
# Redistributions in binary form must reproduce the above
15
# copyright notice, this list of conditions and the
16
# following disclaimer in the documentation and/or other
17
# materials provided with the distribution.
19
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
# POSSIBILITY OF SUCH DAMAGE.
31
# Author: Neil Soman neil@eucalyptus.com
32
# Mitch Garnaat mgarnaat@eucalyptus.com
34
import euca2ools.commands.eucacommand
35
from boto.roboto.param import Param
37
class DescribeAddresses(euca2ools.commands.eucacommand.EucaCommand):
39
APIVersion = '2010-08-31'
40
Description = 'Shows information about addresses.'
41
Args = [Param(name='ip', ptype='string',
42
cardinality='+', optional=True)]
43
Filters = [Param(name='instance-id', ptype='string',
44
doc='Instance the address is associated with (if any).'),
45
Param(name='public-ip', ptype='string',
46
doc='The elastic IP address.')]
48
def display_addresses(self, addresses):
49
for address in addresses:
50
address_string = '%s\t%s' % (address.public_ip,
52
print 'ADDRESS\t%s' % address_string
55
conn = self.make_connection_cli()
56
return self.make_request_cli(conn, 'get_all_addresses',
60
addresses = self.main()
61
self.display_addresses(addresses)