o
    È·e¬  ã                   @   s8   d dl mZ dd„ ZG dd„ deƒZG dd„ deƒZdS )	é    )ÚOriginAccessIdentityc                 C   s   t | tƒr	|  ¡ S | S ©N)Ú
isinstancer   Úuri)Úorigin_access_identity© r   úM/var/www/ideatree/venv/lib/python3.10/site-packages/boto/cloudfront/origin.pyÚget_oai_value   s   
r	   c                   @   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 )ÚS3Originzž
    Origin information to associate with the distribution.
    If your distribution will use an Amazon S3 origin,
    then you use the S3Origin element.
    Nc                 C   s   || _ || _dS )a  
        :param dns_name: The DNS name of your Amazon S3 bucket to
                         associate with the distribution.
                         For example: mybucket.s3.amazonaws.com.
        :type dns_name: str
        
        :param origin_access_identity: The CloudFront origin access
                                       identity to associate with the
                                       distribution. If you want the
                                       distribution to serve private content,
                                       include this element; if you want the
                                       distribution to serve public content,
                                       remove this element.
        :type origin_access_identity: str
        
        N)Údns_namer   )Úselfr   r   r   r   r   Ú__init__&   s   
zS3Origin.__init__c                 C   ó
   d| j  S )Nz<S3Origin: %s>©r   ©r   r   r   r   Ú__repr__:   ó   
zS3Origin.__repr__c                 C   ó   d S r   r   ©r   ÚnameÚattrsÚ
connectionr   r   r   ÚstartElement=   ó   zS3Origin.startElementc                 C   s4   |dkr	|| _ d S |dkr|| _d S t| ||ƒ d S )NÚDNSNamer   )r   r   Úsetattr©r   r   Úvaluer   r   r   r   Ú
endElement@   s
   

zS3Origin.endElementc                 C   s:   d}|d| j  7 }| jrt| jƒ}|d| 7 }|d7 }|S )Nz  <S3Origin>
ú    <DNSName>%s</DNSName>
z4    <OriginAccessIdentity>%s</OriginAccessIdentity>
z  </S3Origin>
)r   r   r	   )r   ÚsÚvalr   r   r   Úto_xmlH   s   
zS3Origin.to_xml)NN©	Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r"   r   r   r   r   r
      s    
r
   c                   @   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 )ÚCustomOriginz¥
    Origin information to associate with the distribution.
    If your distribution will use a non-Amazon S3 origin,
    then you use the CustomOrigin element.
    NéP   é»  c                 C   s   || _ || _|| _|| _dS )a8  
        :param dns_name: The DNS name of your Amazon S3 bucket to
                         associate with the distribution.
                         For example: mybucket.s3.amazonaws.com.
        :type dns_name: str
        
        :param http_port: The HTTP port the custom origin listens on.
        :type http_port: int
        
        :param https_port: The HTTPS port the custom origin listens on.
        :type http_port: int
        
        :param origin_protocol_policy: The origin protocol policy to
                                       apply to your origin. If you
                                       specify http-only, CloudFront
                                       will use HTTP only to access the origin.
                                       If you specify match-viewer, CloudFront
                                       will fetch from your origin using HTTP
                                       or HTTPS, based on the protocol of the
                                       viewer request.
        :type origin_protocol_policy: str
        
        N©r   Ú	http_portÚ
https_portÚorigin_protocol_policy)r   r   r,   r-   r.   r   r   r   r   X   s   
zCustomOrigin.__init__c                 C   r   )Nz<CustomOrigin: %s>r   r   r   r   r   r   v   r   zCustomOrigin.__repr__c                 C   r   r   r   r   r   r   r   r   y   r   zCustomOrigin.startElementc                 C   sœ   |dkr	|| _ d S |dkr#zt|ƒ| _W d S  ty"   || _Y d S w |dkr=zt|ƒ| _W d S  ty<   || _Y d S w |dkrF|| _d S t| ||ƒ d S )Nr   ÚHTTPPortÚ	HTTPSPortÚOriginProtocolPolicy)r   Úintr,   Ú
ValueErrorr-   r.   r   r   r   r   r   r   |   s"   
ÿÿ
zCustomOrigin.endElementc                 C   sH   d}|d| j  7 }|d| j 7 }|d| j 7 }|d| j 7 }|d7 }|S )Nz  <CustomOrigin>
r   z    <HTTPPort>%d</HTTPPort>
z    <HTTPSPort>%d</HTTPSPort>
z4    <OriginProtocolPolicy>%s</OriginProtocolPolicy>
z  </CustomOrigin>
r+   )r   r    r   r   r   r"   Ž   s   zCustomOrigin.to_xml)Nr)   r*   Nr#   r   r   r   r   r(   Q   s    
ÿr(   N)Úboto.cloudfront.identityr   r	   Úobjectr
   r(   r   r   r   r   Ú<module>   s   2