| Index: third_party/gsutil/boto/boto/vpc/internetgateway.py
|
| diff --git a/third_party/gsutil/20110627/boto/boto/vpc/vpngateway.py b/third_party/gsutil/boto/boto/vpc/internetgateway.py
|
| similarity index 66%
|
| copy from third_party/gsutil/20110627/boto/boto/vpc/vpngateway.py
|
| copy to third_party/gsutil/boto/boto/vpc/internetgateway.py
|
| index 83b912efd745f6c7592cb53c34e0e25e7a890766..011fdee1af40cc223351868d5992d6cf63e7a7a9 100644
|
| --- a/third_party/gsutil/20110627/boto/boto/vpc/vpngateway.py
|
| +++ b/third_party/gsutil/boto/boto/vpc/internetgateway.py
|
| @@ -14,70 +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 Vpn Gateway
|
| +Represents an Internet Gateway
|
| """
|
|
|
| from boto.ec2.ec2object import TaggedEC2Object
|
| +from boto.resultset import ResultSet
|
|
|
| -class Attachment(object):
|
| -
|
| +class InternetGateway(TaggedEC2Object):
|
| def __init__(self, connection=None):
|
| - self.vpc_id = None
|
| - self.state = None
|
| + TaggedEC2Object.__init__(self, connection)
|
| + self.id = None
|
| + self.attachments = []
|
| +
|
| + def __repr__(self):
|
| + return 'InternetGateway:%s' % self.id
|
|
|
| def startElement(self, name, attrs, connection):
|
| - pass
|
| -
|
| + 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 == 'vpcId':
|
| - self.vpc_id = value
|
| - elif name == 'state':
|
| - self.state = value
|
| + if name == 'internetGatewayId':
|
| + self.id = value
|
| else:
|
| setattr(self, name, value)
|
| -
|
| -class VpnGateway(TaggedEC2Object):
|
|
|
| +class InternetGatewayAttachment(object):
|
| def __init__(self, connection=None):
|
| - TaggedEC2Object.__init__(self, connection)
|
| - self.id = None
|
| - self.type = None
|
| + self.vpc_id = None
|
| self.state = None
|
| - self.availability_zone = None
|
| - self.attachments = []
|
|
|
| def __repr__(self):
|
| - return 'VpnGateway:%s' % self.id
|
| + return 'InternetGatewayAttachment:%s' % self.vpc_id
|
|
|
| def startElement(self, name, attrs, connection):
|
| - retval = TaggedEC2Object.startElement(self, name, attrs, connection)
|
| - if retval is not None:
|
| - return retval
|
| - if name == 'item':
|
| - att = Attachment()
|
| - self.attachments.append(att)
|
| - return att
|
| -
|
| + return None
|
| +
|
| def endElement(self, name, value, connection):
|
| - if name == 'vpnGatewayId':
|
| - self.id = value
|
| - elif name == 'type':
|
| - self.type = value
|
| + if name == 'vpcId':
|
| + self.vpc_id = value
|
| elif name == 'state':
|
| self.state = value
|
| - elif name == 'availabilityZone':
|
| - self.availability_zone = value
|
| - elif name == 'attachments':
|
| - pass
|
| - else:
|
| - setattr(self, name, value)
|
| -
|
| - def attach(self, vpc_id):
|
| - return self.connection.attach_vpn_gateway(self.id, vpc_id)
|
| -
|
|
|