ó
è?F[c           @   s\   d  Z  d d l m Z d e f d     YZ d e f d     YZ d e f d     YZ d	 S(
   s   
Represents an DBSecurityGroup
iÿÿÿÿ(   t   SecurityGroupt   DBSecurityGroupc           B   se   e  Z d  Z d d d d d  Z d   Z d   Z d   Z d   Z d d d  Z	 d d d  Z
 RS(	   sº  
    Represents an RDS database security group

    Properties reference available from the AWS documentation at
    http://docs.amazonwebservices.com/AmazonRDS/latest/APIReference/API_DeleteDBSecurityGroup.html

    :ivar Status: The current status of the security group. Possible values are
        [ active, ? ]. Reference documentation lacks specifics of possibilities
    :ivar connection: :py:class:`boto.rds.RDSConnection` associated with the current object
    :ivar description: The description of the security group
    :ivar ec2_groups: List of :py:class:`EC2 Security Group
        <boto.ec2.securitygroup.SecurityGroup>` objects that this security
        group PERMITS
    :ivar ip_ranges: List of :py:class:`boto.rds.dbsecuritygroup.IPRange`
        objects (containing CIDR addresses) that this security group PERMITS
    :ivar name: Name of the security group
    :ivar owner_id: ID of the owner of the security group. Can be 'None'
    c         C   s:   | |  _  | |  _ | |  _ | |  _ g  |  _ g  |  _ d  S(   N(   t
   connectiont   owner_idt   namet   descriptiont
   ec2_groupst	   ip_ranges(   t   selfR   R   R   R   (    (    s7   lib/python2.7/site-packages/boto/rds/dbsecuritygroup.pyt   __init__.   s    					c         C   s   d |  j  S(   Ns   DBSecurityGroup:%s(   R   (   R   (    (    s7   lib/python2.7/site-packages/boto/rds/dbsecuritygroup.pyt   __repr__7   s    c         C   s`   | d k r, t  |   } |  j j |  | S| d k rX t |   } |  j j |  | Sd  Sd  S(   Nt   IPRanget   EC2SecurityGroup(   R   R   t   appendR   R   t   None(   R   R   t   attrsR   t   cidrt   ec2_grp(    (    s7   lib/python2.7/site-packages/boto/rds/dbsecuritygroup.pyt   startElement:   s    c         C   sk   | d k r | |  _  nO | d k r0 | |  _ n7 | d k rH | |  _ n | d k rW n t |  | |  d  S(   Nt   OwnerIdt   DBSecurityGroupNamet   DBSecurityGroupDescriptiont   IPRanges(   R   R   R   t   setattr(   R   R   t   valueR   (    (    s7   lib/python2.7/site-packages/boto/rds/dbsecuritygroup.pyt
   endElementF   s    c         C   s   |  j  j |  j  S(   N(   R   t   delete_dbsecurity_groupR   (   R   (    (    s7   lib/python2.7/site-packages/boto/rds/dbsecuritygroup.pyt   deleteR   s    c         C   sL   t  | t  r$ | j } | j } n d } d } |  j j |  j | | |  S(   s³  
        Add a new rule to this DBSecurity group.
        You need to pass in either a CIDR block to authorize or
        and EC2 SecurityGroup.

        :type cidr_ip: string
        :param cidr_ip: A valid CIDR IP range to authorize

        :type ec2_group: :class:`boto.ec2.securitygroup.SecurityGroup`
        :param ec2_group: An EC2 security group to authorize

        :rtype: bool
        :return: True if successful.
        N(   t
   isinstanceR    R   R   R   R   t   authorize_dbsecurity_group(   R   t   cidr_ipt	   ec2_groupt
   group_namet   group_owner_id(    (    s7   lib/python2.7/site-packages/boto/rds/dbsecuritygroup.pyt	   authorizeU   s    	c         C   sY   t  | t  r@ | j } | j } |  j j |  j d | d | S|  j j |  j d | S(   sÆ  
        Revoke access to a CIDR range or EC2 SecurityGroup.
        You need to pass in either a CIDR block or
        an EC2 SecurityGroup from which to revoke access.

        :type cidr_ip: string
        :param cidr_ip: A valid CIDR IP range to revoke

        :type ec2_group: :class:`boto.ec2.securitygroup.SecurityGroup`
        :param ec2_group: An EC2 security group to revoke

        :rtype: bool
        :return: True if successful.
        t   ec2_security_group_namet   ec2_security_group_owner_idR   (   R   R    R   R   R   t   revoke_dbsecurity_group(   R   R   R   R    R!   (    (    s7   lib/python2.7/site-packages/boto/rds/dbsecuritygroup.pyt   revokeo   s    					N(   t   __name__t
   __module__t   __doc__R   R	   R
   R   R   R   R"   R&   (    (    (    s7   lib/python2.7/site-packages/boto/rds/dbsecuritygroup.pyR      s   				R   c           B   s5   e  Z d  Z d d  Z d   Z d   Z d   Z RS(   sj   
    Describes a CIDR address range for use in a DBSecurityGroup

    :ivar cidr_ip: IP Address range
    c         C   s   | |  _  d  |  _ d  |  _ d  S(   N(   t   parentR   R   t   status(   R   R*   (    (    s7   lib/python2.7/site-packages/boto/rds/dbsecuritygroup.pyR	      s    		c         C   s   d |  j  S(   Ns
   IPRange:%s(   R   (   R   (    (    s7   lib/python2.7/site-packages/boto/rds/dbsecuritygroup.pyR
      s    c         C   s   d  S(   N(    (   R   R   R   R   (    (    s7   lib/python2.7/site-packages/boto/rds/dbsecuritygroup.pyR      s    c         C   sD   | d k r | |  _  n( | d k r0 | |  _ n t |  | |  d  S(   Nt   CIDRIPt   Status(   R   R+   R   (   R   R   R   R   (    (    s7   lib/python2.7/site-packages/boto/rds/dbsecuritygroup.pyR      s
    N(   R'   R(   R)   R   R	   R
   R   R   (    (    (    s7   lib/python2.7/site-packages/boto/rds/dbsecuritygroup.pyR      s
   		R   c           B   s5   e  Z d  Z d d  Z d   Z d   Z d   Z RS(   sF   
    Describes an EC2 security group for use in a DBSecurityGroup
    c         C   s   | |  _  d  |  _ d  |  _ d  S(   N(   R*   R   R   R   (   R   R*   (    (    s7   lib/python2.7/site-packages/boto/rds/dbsecuritygroup.pyR	   ©   s    		c         C   s   d |  j  S(   Ns   EC2SecurityGroup:%s(   R   (   R   (    (    s7   lib/python2.7/site-packages/boto/rds/dbsecuritygroup.pyR
   ®   s    c         C   s   d  S(   N(    (   R   R   R   R   (    (    s7   lib/python2.7/site-packages/boto/rds/dbsecuritygroup.pyR   ±   s    c         C   sD   | d k r | |  _  n( | d k r0 | |  _ n t |  | |  d  S(   Nt   EC2SecurityGroupNamet   EC2SecurityGroupOwnerId(   R   R   R   (   R   R   R   R   (    (    s7   lib/python2.7/site-packages/boto/rds/dbsecuritygroup.pyR   Ž   s
    N(   R'   R(   R)   R   R	   R
   R   R   (    (    (    s7   lib/python2.7/site-packages/boto/rds/dbsecuritygroup.pyR   €   s
   		N(   R)   t   boto.ec2.securitygroupR    t   objectR   R   R   (    (    (    s7   lib/python2.7/site-packages/boto/rds/dbsecuritygroup.pyt   <module>   s   o