U
    3ìdT  ã                   @   s   G d d„ de ƒZdS )c                   @   s6   e Zd ZdZdZdd„ Zedd„ ƒZejdd„ ƒZdS )	ÚSourceAttributeaL  
    Provide information about attributes for an index field.
    A maximum of 20 source attributes can be configured for
    each index field.

    :ivar default: Optional default value if the source attribute
        is not specified in a document.
        
    :ivar name: The name of the document source field to add
        to this ``IndexField``.

    :ivar data_function: Identifies the transformation to apply
        when copying data from a source attribute.
        
    :ivar data_map: The value is a dict with the following keys:
        * cases - A dict that translates source field values
            to custom values.
        * default - An optional default value to use if the
            source attribute is not specified in a document.
        * name - the name of the document source field to add
            to this ``IndexField``
    :ivar data_trim_title: Trims common title words from a source
        document attribute when populating an ``IndexField``.
        This can be used to create an ``IndexField`` you can
        use for sorting.  The value is a dict with the following
        fields:
        * default - An optional default value.
        * language - an IETF RFC 4646 language code.
        * separator - The separator that follows the text to trim.
        * name - The name of the document source field to add.
    )ZCopyZ	TrimTitleZMapc                 C   s"   i | _ | jd | _i | _i | _d S )Né    )Z	data_copyÚValidDataFunctionsÚ_data_functionZdata_mapZdata_trim_title©Úself© r   úD/tmp/pip-unpacked-wheel-d7dsrkjd/boto/cloudsearch/sourceattribute.pyÚ__init__;   s    zSourceAttribute.__init__c                 C   s   | j S )N)r   r   r   r   r   Údata_functionA   s    zSourceAttribute.data_functionc                 C   s,   || j kr"d | j ¡}td| ƒ‚|| _d S )Nú|z data_function must be one of: %s)r   ÚjoinÚ
ValueErrorr   )r   ÚvalueZvalidr   r   r   r
   E   s    
N)	Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r	   Úpropertyr
   Úsetterr   r   r   r   r      s    
r   N)Úobjectr   r   r   r   r   Ú<module>   ó    