U
    W+d1=                     @   s   d Z ddlmZ ddlmZ G dd deZG dd deZG dd	 d	eZG d
d deZ	G dd deZ
G dd deZdS )z
Represents an OptionGroup
    )DBSecurityGroup)	ResultSetc                   @   s:   e Zd ZdZdddZdd Zdd	 Zd
d Zdd ZdS )OptionGroupa  
    Represents an RDS option group

    Properties reference available from the AWS documentation at
    http://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_OptionGroup.html

    :ivar connection: :py:class:`boto.rds.RDSConnection` associated with the
                      current object
    :ivar name: Name of the option group
    :ivar description: The description of the option group
    :ivar engine_name: The name of the database engine to use
    :ivar major_engine_version: The major version number of the engine to use
    :ivar allow_both_vpc_and_nonvpc: Indicates whether this option group can be
                                     applied to both VPC and non-VPC instances.
                                     The value ``True`` indicates the option
                                     group can be applied to both VPC and
                                     non-VPC instances.
    :ivar vpc_id: If AllowsVpcAndNonVpcInstanceMemberships is 'false', this
                  field is blank. If AllowsVpcAndNonVpcInstanceMemberships is
                  ``True`` and this field is blank, then this option group can
                  be applied to both VPC and non-VPC instances. If this field
                  contains a value, then this option group can only be applied
                  to instances that are in the VPC indicated by this field.
    :ivar options: The list of :py:class:`boto.rds.optiongroup.Option` objects
                   associated with the group
    NFc                 C   s.   || _ || _|| _|| _|| _|| _g | _d S N)nameengine_namemajor_engine_versiondescriptionallow_both_vpc_and_nonvpcvpc_idoptions)self
connectionr   r   r   r	   r
   r    r   8/tmp/pip-unpacked-wheel-dlxw5sjy/boto/rds/optiongroup.py__init__:   s    zOptionGroup.__init__c                 C   s
   d| j  S )NzOptionGroup:%sr   r   r   r   r   __repr__E   s    zOptionGroup.__repr__c                 C   s"   |dkrt dtfg| _nd S d S )NOptions)r   Optionr   r   r   attrsr   r   r   r   startElementH   s
    
zOptionGroup.startElementc                 C   s   |dkr|| _ np|dkr || _n`|dkr0|| _nP|dkr@|| _n@|dkrd| dkr\d| _qd| _n|d	krt|| _nt| || d S )
NZOptionGroupName
EngineNameMajorEngineVersionZOptionGroupDescriptionZ%AllowsVpcAndNonVpcInstanceMembershipstrueTFZVpcId)r   r   r   r	   lowerr
   r   setattrr   r   valuer   r   r   r   
endElementP   s    zOptionGroup.endElementc                 C   s   | j | jS r   )r   Zdelete_option_groupr   r   r   r   r   deletec   s    zOptionGroup.delete)NNNNNFN)	__name__
__module____qualname____doc__r   r   r   r!   r"   r   r   r   r   r      s          
r   c                   @   s2   e Zd ZdZdddZdd Zdd	 Zd
d ZdS )r   a  
    Describes a Option for use in an OptionGroup

    :ivar name: The name of the option
    :ivar description: The description of the option.
    :ivar permanent: Indicate if this option is permanent.
    :ivar persistent: Indicate if this option is persistent.
    :ivar port: If required, the port configured for this option to use.
    :ivar settings: The option settings for this option.
    :ivar db_security_groups: If the option requires access to a port, then
                              this DB Security Group allows access to the port.
    :ivar vpc_security_groups: If the option requires access to a port, then
                               this VPC Security Group allows access to the
                               port.
    NFc	           	      C   sd   || _ || _|| _|| _|| _|| _|| _|| _| jd kr@g | _| jd krPg | _| jd kr`g | _d S r   )r   r	   	permanent
persistentportsettingsdb_security_groupsvpc_security_groups)	r   r   r	   r'   r(   r)   r*   r+   r,   r   r   r   r   w   s    


zOption.__init__c                 C   s
   d| j  S )Nz	Option:%sr   r   r   r   r   r      s    zOption.__repr__c                 C   sV   |dkrt dtfg| _n8|dkr4t dtfg| _n|dkrNt dtfg| _nd S d S )NZOptionSettingsZDBSecurityGroupMembershipsZVpcSecurityGroupMemberships)r   OptionSettingr*   r   r+   VpcSecurityGroupr,   r   r   r   r   r      s    


zOption.startElementc                 C   s   |dkr|| _ nx|dkr || _nh|dkrD| dkr<d| _qd| _nD|dkrh| dkr`d| _qd| _n |dkr|t|| _nt| || d S )	NZ
OptionNameZOptionDescription	Permanentr   TF
PersistentZPort)r   r	   r   	permenantr(   intr)   r   r   r   r   r   r!      s    zOption.endElement)NNFFNNNNr#   r$   r%   r&   r   r   r   r!   r   r   r   r   r   g   s            
r   c                	   @   s2   e Zd ZdZdddZdd Zdd	 Zd
d ZdS )r-   a  
    Describes a OptionSetting for use in an Option

    :ivar name: The name of the option that has settings that you can set.
    :ivar description: The description of the option setting.
    :ivar value: The current value of the option setting.
    :ivar default_value: The default value of the option setting.
    :ivar allowed_values: The allowed values of the option setting.
    :ivar data_type: The data type of the option setting.
    :ivar apply_type: The DB engine specific parameter type.
    :ivar is_modifiable: A Boolean value that, when true, indicates the option
                         setting can be modified from the default.
    :ivar is_collection: Indicates if the option setting is part of a
                         collection.
    NFc
           
      C   s:   || _ || _|| _|| _|| _|| _|| _|| _|	| _d S r   )	r   r	   r    default_valueallowed_values	data_type
apply_typeis_modifiableis_collection)
r   r   r	   r    r4   r5   r6   r7   r8   r9   r   r   r   r      s    zOptionSetting.__init__c                 C   s
   d| j  S )NzOptionSetting:%sr   r   r   r   r   r      s    zOptionSetting.__repr__c                 C   s   d S r   r   r   r   r   r   r      s    zOptionSetting.startElementc                 C   s   |dkr|| _ n|dkr || _n|dkr0|| _n|dkr@|| _n|dkrP|| _nt|dkr`|| _nd|dkrp|| _nT|dkr| d	krd
| _qd| _n0|dkr| d	krd
| _	qd| _	nt
| || d S )NNameDescriptionValueDefaultValueAllowedValuesZDataType	ApplyTypeIsModifiabler   TFZIsCollection)r   r	   r    r4   r5   r6   r7   r   r8   r9   r   r   r   r   r   r!      s.    zOptionSetting.endElement)	NNNFNNNFFr3   r   r   r   r   r-      s              
r-   c                   @   s2   e Zd ZdZdddZdd Zdd Zd	d
 ZdS )r.   zA
    Describes a VPC security group for use in a OptionGroup
    Nc                 C   s   || _ || _d S r   )r   status)r   r   rA   r   r   r   r      s    zVpcSecurityGroup.__init__c                 C   s
   d| j  S )NzVpcSecurityGroup:%s)r   r   r   r   r   r      s    zVpcSecurityGroup.__repr__c                 C   s   d S r   r   r   r   r   r   r      s    zVpcSecurityGroup.startElementc                 C   s0   |dkr|| _ n|dkr || _nt| || d S )NZVpcSecurityGroupIdZStatus)r   rA   r   r   r   r   r   r!     s
    zVpcSecurityGroup.endElement)NNr3   r   r   r   r   r.      s
   
r.   c                   @   s2   e Zd ZdZdddZdd Zdd	 Zd
d ZdS )OptionGroupOptiona  
    Describes a OptionGroupOption for use in an OptionGroup

    :ivar name: The name of the option
    :ivar description: The description of the option.
    :ivar engine_name: Engine name that this option can be applied to.
    :ivar major_engine_version: Indicates the major engine version that the
                                option is available for.
    :ivar min_minor_engine_version: The minimum required engine version for the
                                    option to be applied.
    :ivar permanent: Indicate if this option is permanent.
    :ivar persistent: Indicate if this option is persistent.
    :ivar port_required: Specifies whether the option requires a port.
    :ivar default_port: If the option requires a port, specifies the default
                        port for the option.
    :ivar settings: The option settings for this option.
    :ivar depends_on: List of all options that are prerequisites for this
                      option.
    NFc                 C   sf   || _ || _|| _|| _|| _|| _|| _|| _|	| _|
| _	|| _
| j	d krRg | _	| j
d krbg | _
d S r   )r   r	   r   r   min_minor_engine_versionr'   r(   port_requireddefault_portr*   
depends_on)r   r   r	   r   r   rC   r'   r(   rD   rE   r*   rF   r   r   r   r      s    

zOptionGroupOption.__init__c                 C   s
   d| j  S )NzOptionGroupOption:%sr   r   r   r   r   r   6  s    zOptionGroupOption.__repr__c                 C   s2   |dkrt dtfg| _n|dkr*g | _nd S d S )NZOptionGroupOptionSettingsZOptionsDependedOn)r   OptionGroupOptionSettingr*   rF   r   r   r   r   r   9  s    
zOptionGroupOption.startElementc                 C   s   |dkr|| _ n|dkr || _n|dkr0|| _n|dkr@|| _n|dkrP|| _n|dkrt| dkrld| _qd	| _nh|d
kr| dkrd| _qd	| _nD|dkr| dkrd| _qd	| _n |dkrt	|| _
nt| || d S )Nr:   r;   r   r   Z!MinimumRequiredMinorEngineVersionr/   r   TFr0   ZPortRequiredZDefaultPort)r   r	   r   r   rC   r   r1   r(   rD   r2   rE   r   r   r   r   r   r!   C  s2    zOptionGroupOption.endElement)NNNNNFFFNNNr3   r   r   r   r   rB     s                 

rB   c                   @   s2   e Zd ZdZdddZdd Zdd	 Zd
d ZdS )rG   a  
    Describes a OptionGroupOptionSetting for use in an OptionGroupOption.

    :ivar name: The name of the option that has settings that you can set.
    :ivar description: The description of the option setting.
    :ivar value: The current value of the option setting.
    :ivar default_value: The default value of the option setting.
    :ivar allowed_values: The allowed values of the option setting.
    :ivar data_type: The data type of the option setting.
    :ivar apply_type: The DB engine specific parameter type.
    :ivar is_modifiable: A Boolean value that, when true, indicates the option
                         setting can be modified from the default.
    :ivar is_collection: Indicates if the option setting is part of a
                         collection.
    NFc                 C   s(   || _ || _|| _|| _|| _|| _d S r   )r   r	   r4   r5   r7   r8   )r   r   r	   r4   r5   r7   r8   r   r   r   r   t  s    z!OptionGroupOptionSetting.__init__c                 C   s
   d| j  S )NzOptionGroupOptionSetting:%sr   r   r   r   r   r   }  s    z!OptionGroupOptionSetting.__repr__c                 C   s   d S r   r   r   r   r   r   r     s    z%OptionGroupOptionSetting.startElementc                 C   s   |dkr|| _ np|dkr || _n`|dkr0|| _nP|dkr@|| _n@|dkrP|| _n0|dkrt| dkrld| _qd	| _nt| || d S )
NZSettingNameZSettingDescriptionr=   r>   r?   r@   r   TF)r   r	   r4   r5   r7   r   r8   r   r   r   r   r   r!     s    z#OptionGroupOptionSetting.endElement)NNFNNFr3   r   r   r   r   rG   c  s         
	rG   N)r&   Zboto.rds.dbsecuritygroupr   Zboto.resultsetr   objectr   r   r-   r.   rB   rG   r   r   r   r   <module>   s   HMAW