
?F[c           @   s   d  d l  m Z d  d l m Z d  d l m Z d  d l m Z d  d l m	 Z	 d  d l
 m Z d e f d     YZ d	 e f d
     YZ d e f d     YZ d S(   i(   t   DBSecurityGroup(   t   ParameterGroup(   t
   StatusInfo(   t   DBSubnetGroup(   t   VPCSecurityGroupMembership(   t	   ResultSett
   DBInstancec           B   s   e  Z d  Z d d d  Z d   Z d   Z d   Z e d    Z	 e d    Z
 d   Z d   Z e d	  Z e d
 d  Z d d d d d d d d e d d e d d  Z RS(   s  
    Represents a RDS DBInstance

    Properties reference available from the AWS documentation at
    http://goo.gl/sC2Kn

    :ivar connection: connection
    :ivar id: The name and identifier of the DBInstance
    :ivar create_time: The date and time of creation
    :ivar engine: The database engine being used
    :ivar status: The status of the database in a string. e.g. "available"
    :ivar allocated_storage: The size of the disk in gigabytes (int).
    :ivar auto_minor_version_upgrade: Indicates that minor version patches 
        are applied automatically.
    :ivar endpoint: A tuple that describes the hostname and port of
        the instance. This is only available when the database is
        in status "available".
    :ivar instance_class: Contains the name of the compute and memory
        capacity class of the DB Instance.
    :ivar master_username: The username that is set as master username
        at creation time.
    :ivar parameter_groups: Provides the list of DB Parameter Groups
        applied to this DB Instance.
    :ivar security_groups: Provides List of DB Security Group elements
        containing only DBSecurityGroup.Name and DBSecurityGroup.Status
        subelements.
    :ivar availability_zone: Specifies the name of the Availability Zone
        the DB Instance is located in.
    :ivar backup_retention_period: Specifies the number of days for
        which automatic DB Snapshots are retained.
    :ivar preferred_backup_window: Specifies the daily time range during
        which automated backups are created if automated backups are
        enabled, as determined by the backup_retention_period.
    :ivar preferred_maintenance_window: Specifies the weekly time
        range (in UTC) during which system maintenance can occur. (string)
    :ivar latest_restorable_time: Specifies the latest time to which
        a database can be restored with point-in-time restore. (string)
    :ivar multi_az: Boolean that specifies if the DB Instance is a
        Multi-AZ deployment.
    :ivar iops: The current number of provisioned IOPS for the DB Instance.
        Can be None if this is a standard instance.
    :ivar vpc_security_groups: List of VPC Security Group Membership elements
        containing only VpcSecurityGroupMembership.VpcSecurityGroupId and
        VpcSecurityGroupMembership.Status subelements.
    :ivar pending_modified_values: Specifies that changes to the
        DB Instance are pending. This element is only included when changes
        are pending. Specific changes are identified by subelements.
    :ivar read_replica_dbinstance_identifiers: List of read replicas
        associated with this DB instance.
    :ivar status_infos: The status of a Read Replica. If the instance is not a
        for a read replica, this will be blank.
    :ivar character_set_name: If present, specifies the name of the character 
        set that this instance is associated with.
    :ivar subnet_group: Specifies information on the subnet group associated 
        with the DB instance, including the name, description, and subnets 
        in the subnet group.
    :ivar engine_version: Indicates the database engine version.
    :ivar license_model: License model information for this DB instance.
    c         C   s  | |  _  | |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  |  _	 d  |  _
 g  |  _ g  |  _ g  |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  |  _ t |  _ d  |  _ d  |  _ d  |  _ t |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  S(   N(    t
   connectiont   idt   Nonet   create_timet   enginet   statust   allocated_storaget   auto_minor_version_upgradet   endpointt   instance_classt   master_usernamet   parameter_groupst   security_groupst#   read_replica_dbinstance_identifierst   availability_zonet   backup_retention_periodt   preferred_backup_windowt   preferred_maintenance_windowt   latest_restorable_timet   Falset   multi_azt   iopst   vpc_security_groupst   pending_modified_valuest   _in_endpointt   _portt   _addresst   status_infost   character_set_namet   subnet_groupt   engine_versiont   license_model(   t   selfR   R   (    (    s2   lib/python2.7/site-packages/boto/rds/dbinstance.pyt   __init__[   s<    																													c         C   s   d |  j  S(   Ns   DBInstance:%s(   R   (   R'   (    (    s2   lib/python2.7/site-packages/boto/rds/dbinstance.pyt   __repr__{   s    c         C   s%  | d k r t  |  _ n	| d k rC t d t f g  |  _ |  j S| d k rn t d t f g  |  _ |  j S| d k r t d t f g  |  _ |  j S| d k r t	   |  _
 |  j
 S| d	 k r t   |  _ |  j S| d
 k rt d t f g  |  _ |  j S| d k r!t   |  _ |  j Sd  S(   Nt   Endpointt   DBParameterGroupst   DBParameterGroupt   DBSecurityGroupsR    t   VpcSecurityGroupst   VpcSecurityGroupMembershipt   PendingModifiedValuest    ReadReplicaDBInstanceIdentifierst   StatusInfost   DBInstanceStatusInfoR   (   t   TrueR   R   R   R   R    R   R   R   R0   R   R1   R   R   R"   R   R$   R	   (   R'   t   namet   attrsR   (    (    s2   lib/python2.7/site-packages/boto/rds/dbinstance.pyt   startElement~   s8    c         C   s  | d k r | |  _  nn| d k r0 | |  _ nV| d k rH | |  _ n>| d k r` | |  _ n&| d k rx | |  _ n| d k r t |  |  _ n| d k r | j   d k |  _ n| d k r | |  _ n| d	 k r | |  _	 n| d
 k r|  j
 rt |  |  _ qnr| d k r8|  j
 r| |  _ qnN| d k re|  j |  j f |  _ t |  _
 n!| d k r}| |  _ n	| d k rt |  |  _ n | d k r| |  _ n | d k r| |  _ n | d k r| |  _ n | d k r| j   d k rt |  _ qnv | d k r.t |  |  _ nX | d k rF| |  _ n@ | d k r^| |  _ n( | d k rv| |  _ n t |  | |  d  S(   Nt   DBInstanceIdentifiert   DBInstanceStatust   InstanceCreateTimet   Enginet   AllocatedStoraget   AutoMinorVersionUpgradet   truet   DBInstanceClasst   MasterUsernamet   Portt   AddressR*   t   AvailabilityZonet   BackupRetentionPeriodt   LatestRestorableTimet   PreferredMaintenanceWindowt   PreferredBackupWindowt   MultiAZt   Iopst   CharacterSetNamet   EngineVersiont   LicenseModel(   R   R   R
   R   t   intR   t   lowerR   R   R   R   R    R!   R   R   R   R   R   R   R   R4   R   R   R#   R%   R&   t   setattr(   R'   R5   t   valueR   (    (    s2   lib/python2.7/site-packages/boto/rds/dbinstance.pyt
   endElement   sb    		c         C   s(   t  |  j  d k r  |  j d Sd Sd S(   s_   
        Provide backward compatibility for previous security_group
        attribute.
        i    iN(   t   lenR   R	   (   R'   (    (    s2   lib/python2.7/site-packages/boto/rds/dbinstance.pyt   security_group   s    c         C   s(   t  |  j  d k r  |  j d Sd Sd S(   s`   
        Provide backward compatibility for previous parameter_group
        attribute.
        i    iN(   RR   R   R	   (   R'   (    (    s2   lib/python2.7/site-packages/boto/rds/dbinstance.pyt   parameter_group   s    c         C   s   |  j  j | |  j  S(   s  
        Create a new DB snapshot of this DBInstance.

        :type identifier: string
        :param identifier: The identifier for the DBSnapshot

        :rtype: :class:`boto.rds.dbsnapshot.DBSnapshot`
        :return: The newly created DBSnapshot
        (   R   t   create_dbsnapshotR   (   R'   t   snapshot_id(    (    s2   lib/python2.7/site-packages/boto/rds/dbinstance.pyt   snapshot   s    
c         C   s   |  j  j |  j  S(   s   
        Reboot this DBInstance

        :rtype: :class:`boto.rds.dbsnapshot.DBSnapshot`
        :return: The newly created DBSnapshot
        (   R   t   reboot_dbinstanceR   (   R'   (    (    s2   lib/python2.7/site-packages/boto/rds/dbinstance.pyt   reboot   s    c         C   s   |  j  j |  j  } t |  d k rc xU | D]. } | j |  j k r. |  j j | j  q. q. Wn | r t d |  j   n  |  j S(   s  
        Update the DB instance's status information by making a call to fetch
        the current instance attributes from the service.

        :type validate: bool
        :param validate: By default, if EC2 returns no data about the
            instance the update method returns quietly.  If the
            validate param is True, however, it will raise a
            ValueError exception if no data is returned from EC2.
        i    s   %s is not a valid Instance ID(   R   t   get_all_dbinstancesR   RR   t   __dict__t   updatet
   ValueErrorR   (   R'   t   validatet   rst   i(    (    s2   lib/python2.7/site-packages/boto/rds/dbinstance.pyR\      s    t    c         C   s   |  j  j |  j | |  S(   sd  
        Delete this DBInstance.

        :type skip_final_snapshot: bool
        :param skip_final_snapshot: This parameter determines whether
            a final db snapshot is created before the instance is
            deleted.  If True, no snapshot is created.  If False, a
            snapshot is created before deleting the instance.

        :type final_snapshot_id: str
        :param final_snapshot_id: If a final snapshot is requested, this
            is the identifier used for that snapshot.

        :rtype: :class:`boto.rds.dbinstance.DBInstance`
        :return: The deleted db instance.
        (   R   t   delete_dbinstanceR   (   R'   t   skip_final_snapshott   final_snapshot_id(    (    s2   lib/python2.7/site-packages/boto/rds/dbinstance.pyt   stop  s    c         C   s:   |  j  j |  j | | | | | | | | |	 | |
 | |  S(   s  
        Modify this DBInstance.

        :type param_group: str
        :param param_group: Name of DBParameterGroup to associate with
                            this DBInstance.

        :type security_groups: list of str or list of DBSecurityGroup objects
        :param security_groups: List of names of DBSecurityGroup to
            authorize on this DBInstance.

        :type preferred_maintenance_window: str
        :param preferred_maintenance_window: The weekly time range (in
            UTC) during which maintenance can occur.  Default is
            Sun:05:00-Sun:09:00

        :type master_password: str
        :param master_password: Password of master user for the DBInstance.
            Must be 4-15 alphanumeric characters.

        :type allocated_storage: int
        :param allocated_storage: The new allocated storage size, in GBs.
            Valid values are [5-1024]

        :type instance_class: str
        :param instance_class: The compute and memory capacity of the
            DBInstance.  Changes will be applied at next maintenance
            window unless apply_immediately is True.

            Valid values are:

            * db.m1.small
            * db.m1.large
            * db.m1.xlarge
            * db.m2.xlarge
            * db.m2.2xlarge
            * db.m2.4xlarge

        :type apply_immediately: bool
        :param apply_immediately: If true, the modifications will be
            applied as soon as possible rather than waiting for the
            next preferred maintenance window.
            
        :type new_instance_id: str
        :param new_instance_id: The new DB instance identifier.

        :type backup_retention_period: int
        :param backup_retention_period: The number of days for which
            automated backups are retained.  Setting this to zero
            disables automated backups.

        :type preferred_backup_window: str
        :param preferred_backup_window: The daily time range during
            which automated backups are created (if enabled).  Must be
            in h24:mi-hh24:mi format (UTC).

        :type multi_az: bool
        :param multi_az: If True, specifies the DB Instance will be
            deployed in multiple availability zones.

        :type iops: int
        :param iops: The amount of IOPS (input/output operations per
            second) to Provisioned for the DB Instance. Can be
            modified at a later date.

            Must scale linearly. For every 1000 IOPS provision, you
            must allocated 100 GB of storage space. This scales up to
            1 TB / 10 000 IOPS for MySQL and Oracle. MSSQL is limited
            to 700 GB / 7 000 IOPS.

            If you specify a value, it must be at least 1000 IOPS and
            you must allocate 100 GB of storage.

        :type vpc_security_groups: list
        :param vpc_security_groups: List of VPCSecurityGroupMembership
            that this DBInstance is a memberof.

        :rtype: :class:`boto.rds.dbinstance.DBInstance`
        :return: The modified db instance.
        (   R   t   modify_dbinstanceR   (   R'   t   param_groupR   R   t   master_passwordR   R   R   R   R   R   R   t   apply_immediatelyt   new_instance_id(    (    s2   lib/python2.7/site-packages/boto/rds/dbinstance.pyt   modify&  s    [N(   t   __name__t
   __module__t   __doc__R	   R(   R)   R7   RQ   t   propertyRS   RT   RW   RY   R   R\   Re   Rk   (    (    (    s2   lib/python2.7/site-packages/boto/rds/dbinstance.pyR      s,   ; 		 	4			R0   c           B   s   e  Z d    Z d   Z RS(   c         C   s   d  S(   N(   R	   (   R'   R5   R6   R   (    (    s2   lib/python2.7/site-packages/boto/rds/dbinstance.pyR7     s    c         C   s   | d k r | |  | <n  d  S(   NR0   (    (   R'   R5   RP   R   (    (    s2   lib/python2.7/site-packages/boto/rds/dbinstance.pyRQ     s    (   Rl   Rm   R7   RQ   (    (    (    s2   lib/python2.7/site-packages/boto/rds/dbinstance.pyR0     s   	R1   c           B   s   e  Z d    Z d   Z RS(   c         C   s   d  S(   N(   R	   (   R'   R5   R6   R   (    (    s2   lib/python2.7/site-packages/boto/rds/dbinstance.pyR7     s    c         C   s    | d k r |  j  |  n  d  S(   Nt   ReadReplicaDBInstanceIdentifier(   t   append(   R'   R5   RP   R   (    (    s2   lib/python2.7/site-packages/boto/rds/dbinstance.pyRQ     s    (   Rl   Rm   R7   RQ   (    (    (    s2   lib/python2.7/site-packages/boto/rds/dbinstance.pyR1     s   	N(   t   boto.rds.dbsecuritygroupR    t   boto.rds.parametergroupR   t   boto.rds.statusinfoR   t   boto.rds.dbsubnetgroupR   t#   boto.rds.vpcsecuritygroupmembershipR   t   boto.resultsetR   t   objectR   t   dictR0   t   listR1   (    (    (    s2   lib/python2.7/site-packages/boto/rds/dbinstance.pyt   <module>   s    t	