1# Copyright (c) 2013 Anthony Tonns http://www.corsis.com/ 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""" 23Represents a VPCSecurityGroupMembership 24""" 25 26 27class VPCSecurityGroupMembership(object): 28 """ 29 Represents VPC Security Group that this RDS database is a member of 30 31 Properties reference available from the AWS documentation at 32 http://docs.aws.amazon.com/AmazonRDS/latest/APIReference/\ 33 API_VpcSecurityGroupMembership.html 34 35 Example:: 36 pri = "sg-abcdefgh" 37 sec = "sg-hgfedcba" 38 39 # Create with list of str 40 db = c.create_dbinstance(... vpc_security_groups=[pri], ... ) 41 42 # Modify with list of str 43 db.modify(... vpc_security_groups=[pri,sec], ... ) 44 45 # Create with objects 46 memberships = [] 47 membership = VPCSecurityGroupMembership() 48 membership.vpc_group = pri 49 memberships.append(membership) 50 51 db = c.create_dbinstance(... vpc_security_groups=memberships, ... ) 52 53 # Modify with objects 54 memberships = d.vpc_security_groups 55 membership = VPCSecurityGroupMembership() 56 membership.vpc_group = sec 57 memberships.append(membership) 58 59 db.modify(... vpc_security_groups=memberships, ... ) 60 61 :ivar connection: :py:class:`boto.rds.RDSConnection` associated with the 62 current object 63 :ivar vpc_group: This id of the VPC security group 64 :ivar status: Status of the VPC security group membership 65 <boto.ec2.securitygroup.SecurityGroup>` objects that this RDS Instance 66 is a member of 67 """ 68 def __init__(self, connection=None, status=None, vpc_group=None): 69 self.connection = connection 70 self.status = status 71 self.vpc_group = vpc_group 72 73 def __repr__(self): 74 return 'VPCSecurityGroupMembership:%s' % self.vpc_group 75 76 def startElement(self, name, attrs, connection): 77 pass 78 79 def endElement(self, name, value, connection): 80 if name == 'VpcSecurityGroupId': 81 self.vpc_group = value 82 elif name == 'Status': 83 self.status = value 84 else: 85 setattr(self, name, value) 86