| Index: boto/vpc/internetgateway.py
|
| diff --git a/boto/vpc/subnet.py b/boto/vpc/internetgateway.py
|
| similarity index 58%
|
| copy from boto/vpc/subnet.py
|
| copy to boto/vpc/internetgateway.py
|
| index 135e1a28207e4ebf5a2263ca9f4321e9c68864cb..011fdee1af40cc223351868d5992d6cf63e7a7a9 100644
|
| --- a/boto/vpc/subnet.py
|
| +++ b/boto/vpc/internetgateway.py
|
| @@ -14,41 +14,59 @@
|
| # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
| # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
|
| # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
| -# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
| +# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
| # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
| # IN THE SOFTWARE.
|
|
|
| """
|
| -Represents a Subnet
|
| +Represents an Internet Gateway
|
| """
|
|
|
| from boto.ec2.ec2object import TaggedEC2Object
|
| +from boto.resultset import ResultSet
|
|
|
| -class Subnet(TaggedEC2Object):
|
| -
|
| +class InternetGateway(TaggedEC2Object):
|
| def __init__(self, connection=None):
|
| TaggedEC2Object.__init__(self, connection)
|
| self.id = None
|
| - self.state = None
|
| - self.cidr_block = None
|
| - self.available_ip_address_count = 0
|
| - self.availability_zone = None
|
| + self.attachments = []
|
|
|
| def __repr__(self):
|
| - return 'Subnet:%s' % self.id
|
| -
|
| + return 'InternetGateway:%s' % self.id
|
| +
|
| + def startElement(self, name, attrs, connection):
|
| + result = super(InternetGateway, self).startElement(name, attrs, connection)
|
| +
|
| + if result is not None:
|
| + # Parent found an interested element, just return it
|
| + return result
|
| +
|
| + if name == 'attachmentSet':
|
| + self.attachments = ResultSet([('item', InternetGatewayAttachment)])
|
| + return self.attachments
|
| + else:
|
| + return None
|
| +
|
| def endElement(self, name, value, connection):
|
| - if name == 'subnetId':
|
| + if name == 'internetGatewayId':
|
| self.id = value
|
| - elif name == 'state':
|
| - self.state = value
|
| - elif name == 'cidrBlock':
|
| - self.cidr_block = value
|
| - elif name == 'availableIpAddressCount':
|
| - self.available_ip_address_count = int(value)
|
| - elif name == 'availabilityZone':
|
| - self.availability_zone = value
|
| else:
|
| setattr(self, name, value)
|
|
|
| +class InternetGatewayAttachment(object):
|
| + def __init__(self, connection=None):
|
| + self.vpc_id = None
|
| + self.state = None
|
| +
|
| + def __repr__(self):
|
| + return 'InternetGatewayAttachment:%s' % self.vpc_id
|
| +
|
| + def startElement(self, name, attrs, connection):
|
| + return None
|
| +
|
| + def endElement(self, name, value, connection):
|
| + if name == 'vpcId':
|
| + self.vpc_id = value
|
| + elif name == 'state':
|
| + self.state = value
|
|
|