B
    kF[                 @   s|  d dl mZmZ d dlmZmZ d dlZd dlZd dl	Z	d dl
Z
d dlZd dlZd dlZd dlZd dlmZ d dlmZ dZeZejdd dee
 e
 e
 f Ze Zed	Zed
ZedZedZe	j !e	j "e#dZ$dd Z%G dd dej&Z'e(da)e(dZ*t)+e'  e*+e'  e%  ej,dfddZ-ej.dfddZ/dddZ0dddZ1dddZ2dddZ3dd d!Z4dd"d#Z5dd$d%Z6dd&d'Z7dd(d)Z8dd*d+Z9dd,d-Z:dd.d/Z;dd0d1Z<dd2d3Z=dd4d5Z>dd6d7Z?dd8d9Z@dd:d;ZAdd<d=ZBddAdBZCddCdDZDddEdFZEddHdIZFddJdKZGddLdMZHddNdOZIddPdQZJddRdSZKddTdUZLddVdWZMddXdYZNddZd[ZOdd\d]ZPdd^d_ZQdd`daZRddbdcZSddddeZTddfdgZUddhdiZVddjdkZWddldmZXddndoZYddpdqZZddrdsZ[ddtduZ\ddvdwZ]ddxdyZ^ddzd{Z_dd|d}Z`dd~dZadd dedd@fddZbdd Zcejdee dS )    )ConfigBotoConfigLocations)BucketStorageUriFileStorageUriN)urlparse)InvalidUriErrorz2.49.0 zBoto/%s Python/%s %s/%sz.^[a-zA-Z0-9][a-zA-Z0-9\._-]{1,253}[a-zA-Z0-9]$z[-_a-z0-9]{64}z3(?P<versionless_uri_str>.+)#(?P<generation>[0-9]+)$z/(?P<versionless_uri_str>.+)#(?P<version_id>.+)$zendpoints.jsonc              C   s8   x2t D ]*} ytjtj|  W q   Y qX qW d S )N)r   loggingconfigZ
fileConfigospath
expanduser)file r   ,lib/python3.7/site-packages/boto/__init__.pyinit_loggingA   s
    
r   c               @   s   e Zd Zdd ZdS )NullHandlerc             C   s   d S )Nr   )selfrecordr   r   r   emitJ   s    zNullHandler.emitN)__name__
__module____qualname__r   r   r   r   r   r   I   s   r   botoz	boto.perfc             C   sV   |sd}t | }|| t |}|| t |}|| || |ad S )Nz0%(asctime)s %(name)s [%(levelname)s]:%(message)s)r	   	getLoggersetLevelZFileHandler	FormattersetFormatter
addHandlerlog)namefilepathlevelformat_stringloggerfh	formatterr   r   r   set_file_loggerV   s    






r'   c             C   sT   |sd}t | }|| t  }|| t |}|| || |ad S )Nz0%(asctime)s %(name)s [%(levelname)s]:%(message)s)r	   r   r   ZStreamHandlerr   r   r   r   )r    r"   r#   r$   r%   r&   r   r   r   set_stream_loggerd   s    





r(   c             K   s   ddl m} || |f|S )a&  
    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    :rtype: :class:`boto.sqs.connection.SQSConnection`
    :return: A connection to Amazon's SQS
    r   )SQSConnection)Zboto.sqs.connectionr)   )aws_access_key_idaws_secret_access_keykwargsr)   r   r   r   connect_sqsr   s    r-   c             K   s   ddl m} || |f|S )a#  
    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    :rtype: :class:`boto.s3.connection.S3Connection`
    :return: A connection to Amazon's S3
    r   )S3Connection)boto.s3.connectionr.   )r*   r+   r,   r.   r   r   r   
connect_s3   s    r0   c             K   s   ddl m} || |f|S )aV  
    @type gs_access_key_id: string
    @param gs_access_key_id: Your Google Cloud Storage Access Key ID

    @type gs_secret_access_key: string
    @param gs_secret_access_key: Your Google Cloud Storage Secret Access Key

    @rtype: L{GSConnection<boto.gs.connection.GSConnection>}
    @return: A connection to Google's Storage service
    r   )GSConnection)Zboto.gs.connectionr1   )Zgs_access_key_idZgs_secret_access_keyr,   r1   r   r   r   
connect_gs   s    r2   c             K   s   ddl m} || |f|S )a&  
    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    :rtype: :class:`boto.ec2.connection.EC2Connection`
    :return: A connection to Amazon's EC2
    r   )EC2Connection)Zboto.ec2.connectionr3   )r*   r+   r,   r3   r   r   r   connect_ec2   s    r4   c             K   s   ddl m} || |f|S )a2  
    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    :rtype: :class:`boto.ec2.elb.ELBConnection`
    :return: A connection to Amazon's Load Balancing Service
    r   )ELBConnection)Zboto.ec2.elbr5   )r*   r+   r,   r5   r   r   r   connect_elb   s    r6   c             K   s   ddl m} || |f|S )a  
    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    :rtype: :class:`boto.ec2.autoscale.AutoScaleConnection`
    :return: A connection to Amazon's Auto Scaling Service

    :type use_block_device_types bool
    :param use_block_device_types: Specifies whether to return described Launch Configs with block device mappings containing
        block device types, or a list of old style block device mappings (deprecated).  This defaults to false for compatability
        with the old incorrect style.
    r   )AutoScaleConnection)Zboto.ec2.autoscaler7   )r*   r+   r,   r7   r   r   r   connect_autoscale   s    r8   c             K   s   ddl m} || |f|S )a@  
    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    :rtype: :class:`boto.ec2.cloudwatch.CloudWatchConnection`
    :return: A connection to Amazon's EC2 Monitoring service
    r   )CloudWatchConnection)Zboto.ec2.cloudwatchr9   )r*   r+   r,   r9   r   r   r   connect_cloudwatch   s    r:   c             K   s   ddl m} || |f|S )a&  
    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    :rtype: :class:`boto.sdb.connection.SDBConnection`
    :return: A connection to Amazon's SDB
    r   )SDBConnection)Zboto.sdb.connectionr;   )r*   r+   r,   r;   r   r   r   connect_sdb   s    r<   c             K   s   ddl m} || |f|S )a  
    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    :rtype: :class:`boto.fps.connection.FPSConnection`
    :return: A connection to FPS
    r   )FPSConnection)Zboto.fps.connectionr=   )r*   r+   r,   r=   r   r   r   connect_fps   s    r>   c             K   s   ddl m} || |f|S )a#  
    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    :rtype: :class:`boto.mturk.connection.MTurkConnection`
    :return: A connection to MTurk
    r   )MTurkConnection)Zboto.mturk.connectionr?   )r*   r+   r,   r?   r   r   r   connect_mturk  s    r@   c             K   s   ddl m} || |f|S )a  
    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    :rtype: :class:`boto.fps.connection.FPSConnection`
    :return: A connection to FPS
    r   )CloudFrontConnection)Zboto.cloudfrontrA   )r*   r+   r,   rA   r   r   r   connect_cloudfront  s    rB   c             K   s   ddl m} || |f|S )a  
    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    :rtype: :class:`boto.vpc.VPCConnection`
    :return: A connection to VPC
    r   )VPCConnection)Zboto.vpcrC   )r*   r+   r,   rC   r   r   r   connect_vpc#  s    rD   c             K   s   ddl m} || |f|S )a  
    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    :rtype: :class:`boto.rds.RDSConnection`
    :return: A connection to RDS
    r   )RDSConnection)Zboto.rdsrE   )r*   r+   r,   rE   r   r   r   connect_rds2  s    rF   c             K   s    ddl m} |f | |d|S )a  
    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    :rtype: :class:`boto.rds2.layer1.RDSConnection`
    :return: A connection to RDS
    r   )rE   )r*   r+   )Zboto.rds2.layer1rE   )r*   r+   r,   rE   r   r   r   connect_rds2A  s
    rG   c             K   s   ddl m} || |f|S )a   
    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    :rtype: :class:`boto.emr.EmrConnection`
    :return: A connection to Elastic mapreduce
    r   )EmrConnection)Zboto.emrrH   )r*   r+   r,   rH   r   r   r   connect_emrT  s    rI   c             K   s   ddl m} || |f|S )a  
    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    :rtype: :class:`boto.sns.SNSConnection`
    :return: A connection to Amazon's SNS
    r   )SNSConnection)Zboto.snsrJ   )r*   r+   r,   rJ   r   r   r   connect_snsc  s    rK   c             K   s   ddl m} || |f|S )a  
    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    :rtype: :class:`boto.iam.IAMConnection`
    :return: A connection to Amazon's IAM
    r   )IAMConnection)Zboto.iamrL   )r*   r+   r,   rL   r   r   r   connect_iamr  s    rM   c             K   s   ddl m} || |f|S )a/  
    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    :rtype: :class:`boto.dns.Route53Connection`
    :return: A connection to Amazon's Route53 DNS Service
    r   )Route53Connection)Zboto.route53rN   )r*   r+   r,   rN   r   r   r   connect_route53  s    rO   c             K   s   ddl m} || |f|S )aD  
    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    :rtype: :class:`boto.cloudformation.CloudFormationConnection`
    :return: A connection to Amazon's CloudFormation Service
    r   )CloudFormationConnection)Zboto.cloudformationrP   )r*   r+   r,   rP   r   r   r   connect_cloudformation  s    rQ   E"  /services/EucalyptusFc       
      K   sv   ddl m} ddlm} |s*tddd}|s<tddd}| sNtdd	d} |d
| d}	|||f|	|||d|S )a  
    Connect to a Eucalyptus service.

    :type host: string
    :param host: the host name or ip address of the Eucalyptus server

    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    :rtype: :class:`boto.ec2.connection.EC2Connection`
    :return: A connection to Eucalyptus server
    r   )r3   )
RegionInfoCredentialseuca_access_key_idNeuca_secret_access_keyBotoZeucalyptus_hostZ
eucalyptus)r    endpoint)regionportr   	is_secure)Zboto.ec2r3   boto.ec2.regioninforT   r
   get)
hostr*   r+   r[   r   r\   r,   r3   rT   Zregr   r   r   connect_euca  s     r`   c             K   s   ddl m} || |f|S )a+  
    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    :rtype: :class:`boto.glacier.layer2.Layer2`
    :return: A connection to Amazon's Glacier Service
    r   )Layer2)Zboto.glacier.layer2ra   )r*   r+   r,   ra   r   r   r   connect_glacier  s    rb   c             K   sv   ddl m} t| }|j|d< |j|d< |j|d< d|krH|jdk|d< ||j|jd|d	< ||d
< ||d< tf |S )a  
    Connect to an EC2 Api endpoint.  Additional arguments are passed
    through to connect_ec2.

    :type url: string
    :param url: A url for the ec2 api endpoint to connect to

    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    :rtype: :class:`boto.ec2.connection.EC2Connection`
    :return: A connection to Eucalyptus server
    r   )rT   r[   r_   r   r\   Zhttps)r    rY   rZ   r*   r+   )r]   rT   r   r[   Zhostnamer   schemer4   )Zurlr*   r+   r,   rT   Zpurlr   r   r   connect_ec2_endpoint  s    


rd   /services/Walrusc       	      K   sn   ddl m} ddl m} |s*tddd}|s<tddd}| sNtdd	d} |||f| ||| |d
|S )a  
    Connect to a Walrus service.

    :type host: string
    :param host: the host name or ip address of the Walrus server

    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    :rtype: :class:`boto.s3.connection.S3Connection`
    :return: A connection to Walrus
    r   )r.   )OrdinaryCallingFormatrU   rV   NrW   rX   Zwalrus_host)r_   r[   r   calling_formatr\   )r/   r.   rf   r
   r^   )	r_   r*   r+   r[   r   r\   r,   r.   rf   r   r   r   connect_walrus  s     rh   c             K   s   ddl m} || |f|S )a  
    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    :rtype: :class:`boto.ses.SESConnection`
    :return: A connection to Amazon's SES
    r   )SESConnection)Zboto.sesri   )r*   r+   r,   ri   r   r   r   connect_ses'  s    rj   c             K   s   ddl m} || |f|S )a  
    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    :rtype: :class:`boto.sts.STSConnection`
    :return: A connection to Amazon's STS
    r   )STSConnection)Zboto.stsrk   )r*   r+   r,   rk   r   r   r   connect_sts6  s    rl   c             K   sP   ddl m} ddl m} tdd| }tdd|}|||fd| |d|S )	ah  
    Connect to the Internet Archive via their S3-like API.

    :type ia_access_key_id: string
    :param ia_access_key_id: Your IA Access Key ID.  This will also look
        in your boto config file for an entry in the Credentials
        section called "ia_access_key_id"

    :type ia_secret_access_key: string
    :param ia_secret_access_key: Your IA Secret Access Key.  This will also
        look in your boto config file for an entry in the Credentials
        section called "ia_secret_access_key"

    :rtype: :class:`boto.s3.connection.S3Connection`
    :return: A connection to the Internet Archive
    r   )r.   )rf   rU   ia_access_key_idia_secret_access_keyzs3.us.archive.org)r_   rg   r\   )r/   r.   rf   r
   r^   )rm   rn   r\   r,   r.   rf   Z
access_keyZ
secret_keyr   r   r   
connect_iaE  s    ro   c             K   s   ddl m} || |f|S )a6  
    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    :rtype: :class:`boto.dynamodb.layer2.Layer2`
    :return: A connection to the Layer2 interface for DynamoDB.
    r   )ra   )Zboto.dynamodb.layer2ra   )r*   r+   r,   ra   r   r   r   connect_dynamodbe  s    rp   c             K   s   ddl m} || |f|S )a,  
    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    :rtype: :class:`boto.swf.layer1.Layer1`
    :return: A connection to the Layer1 interface for SWF.
    r   )Layer1)Zboto.swf.layer1rq   )r*   r+   r,   rq   r   r   r   connect_swfv  s    rr   c             K   s   ddl m} || |f|S )a3  
    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    :rtype: :class:`boto.cloudsearch.layer2.Layer2`
    :return: A connection to Amazon's CloudSearch service
    r   )ra   )Zboto.cloudsearch.layer2ra   )r*   r+   r,   ra   r   r   r   connect_cloudsearch  s    rs   c             K   s"   ddl m} || |fd|i|S )a  
    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    :type sign_request: bool
    :param sign_request: whether or not to sign search and
        upload requests

    :rtype: :class:`boto.cloudsearch2.layer2.Layer2`
    :return: A connection to Amazon's CloudSearch2 service
    r   )ra   sign_request)Zboto.cloudsearch2.layer2ra   )r*   r+   rt   r,   ra   r   r   r   connect_cloudsearch2  s    
ru   c             K   s   ddl m} || |f|S )aU  
    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    :rtype: :class:`boto.cloudsearchdomain.layer1.CloudSearchDomainConnection`
    :return: A connection to Amazon's CloudSearch Domain service
    r   )CloudSearchDomainConnection)Zboto.cloudsearchdomain.layer1rv   )r*   r+   r,   rv   r   r   r   connect_cloudsearchdomain  s    rw   c             K   s   ddl m} || |f|S )a7  
    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    :rtype: :class:`boto.beanstalk.layer1.Layer1`
    :return: A connection to Amazon's Elastic Beanstalk service
    r   )rq   )Zboto.beanstalk.layer1rq   )r*   r+   r,   rq   r   r   r   connect_beanstalk  s    rx   c             K   s    ddl m} |f | |d|S )aG  
    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    :rtype: :class:`boto.ets.layer1.ElasticTranscoderConnection`
    :return: A connection to Amazon's Elastic Transcoder service
    r   )ElasticTranscoderConnection)r*   r+   )Zboto.elastictranscoder.layer1ry   )r*   r+   r,   ry   r   r   r   connect_elastictranscoder  s
    rz   c             K   s    ddl m} |f | |d|S )Nr   )OpsWorksConnection)r*   r+   )Zboto.opsworks.layer1r{   )r*   r+   r,   r{   r   r   r   connect_opsworks  s
    r|   c             K   s    ddl m} |f | |d|S )a9  
    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    :rtype: :class:`boto.redshift.layer1.RedshiftConnection`
    :return: A connection to Amazon's Redshift service
    r   )RedshiftConnection)r*   r+   )Zboto.redshift.layer1r}   )r*   r+   r,   r}   r   r   r   connect_redshift  s
    r~   c             K   s    ddl m} |f | |d|S )a6  
    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    :rtype: :class:`boto.support.layer1.SupportConnection`
    :return: A connection to Amazon's Support service
    r   )SupportConnection)r*   r+   )Zboto.support.layer1r   )r*   r+   r,   r   r   r   r   connect_support  s
    r   c             K   s    ddl m} |f | |d|S )a]  
    Connect to AWS CloudTrail

    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    :rtype: :class:`boto.cloudtrail.layer1.CloudtrailConnection`
    :return: A connection to the AWS Cloudtrail service
    r   )CloudTrailConnection)r*   r+   )Zboto.cloudtrail.layer1r   )r*   r+   r,   r   r   r   r   connect_cloudtrail  s
    r   c             K   s    ddl m} |f | |d|S )ai  
    Connect to AWS DirectConnect

    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    :rtype: :class:`boto.directconnect.layer1.DirectConnectConnection`
    :return: A connection to the AWS DirectConnect service
    r   )DirectConnectConnection)r*   r+   )Zboto.directconnect.layer1r   )r*   r+   r,   r   r   r   r   connect_directconnect3  s
    r   c             K   s    ddl m} |f | |d|S )aV  
    Connect to Amazon Kinesis

    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    rtype: :class:`boto.kinesis.layer1.KinesisConnection`
    :return: A connection to the Amazon Kinesis service
    r   )KinesisConnection)r*   r+   )Zboto.kinesis.layer1r   )r*   r+   r,   r   r   r   r   connect_kinesisI  s
    r   c             K   s    ddl m} |f | |d|S )am  
    Connect to Amazon CloudWatch Logs

    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    rtype: :class:`boto.kinesis.layer1.CloudWatchLogsConnection`
    :return: A connection to the Amazon CloudWatch Logs service
    r   )CloudWatchLogsConnection)r*   r+   )Zboto.logs.layer1r   )r*   r+   r,   r   r   r   r   connect_logs_  s
    r   c             K   s    ddl m} |f | |d|S )aw  
    Connect to Amazon Route 53 Domains

    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    rtype: :class:`boto.route53.domains.layer1.Route53DomainsConnection`
    :return: A connection to the Amazon Route 53 Domains service
    r   )Route53DomainsConnection)r*   r+   )Zboto.route53.domains.layer1r   )r*   r+   r,   r   r   r   r   connect_route53domainsv  s
    r   c             K   s    ddl m} |f | |d|S )ay  
    Connect to Amazon Cognito Identity

    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    rtype: :class:`boto.cognito.identity.layer1.CognitoIdentityConnection`
    :return: A connection to the Amazon Cognito Identity service
    r   )CognitoIdentityConnection)r*   r+   )Zboto.cognito.identity.layer1r   )r*   r+   r,   r   r   r   r   connect_cognito_identity  s
    r   c             K   s    ddl m} |f | |d|S )ai  
    Connect to Amazon Cognito Sync

    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    rtype: :class:`boto.cognito.sync.layer1.CognitoSyncConnection`
    :return: A connection to the Amazon Cognito Sync service
    r   )CognitoSyncConnection)r*   r+   )Zboto.cognito.sync.layer1r   )r*   r+   r,   r   r   r   r   connect_cognito_sync  s
    r   c             K   s    ddl m} |f | |d|S )a^  
    Connect to AWS Key Management Service

    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    rtype: :class:`boto.kms.layer1.KMSConnection`
    :return: A connection to the AWS Key Management Service
    r   )KMSConnection)r*   r+   )Zboto.kms.layer1r   )r*   r+   r,   r   r   r   r   connect_kms  s
    r   c             K   s    ddl m} |f | |d|S )aR  
    Connect to AWS Lambda

    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    rtype: :class:`boto.awslambda.layer1.AWSLambdaConnection`
    :return: A connection to the AWS Lambda service
    r   )AWSLambdaConnection)r*   r+   )Zboto.awslambda.layer1r   )r*   r+   r,   r   r   r   r   connect_awslambda  s
    r   c             K   s    ddl m} |f | |d|S )a^  
    Connect to AWS CodeDeploy

    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    rtype: :class:`boto.cognito.sync.layer1.CodeDeployConnection`
    :return: A connection to the AWS CodeDeploy service
    r   )CodeDeployConnection)r*   r+   )Zboto.codedeploy.layer1r   )r*   r+   r,   r   r   r   r   connect_codedeploy  s
    r   c             K   s    ddl m} |f | |d|S )aP  
    Connect to AWS Config

    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    rtype: :class:`boto.kms.layer1.ConfigServiceConnection`
    :return: A connection to the AWS Config service
    r   )ConfigServiceConnection)r*   r+   )Zboto.configservice.layer1r   )r*   r+   r,   r   r   r   r   connect_configservice   s
    r   c             K   s    ddl m} |f | |d|S )aT  
    Connect to AWS CloudHSM

    :type aws_access_key_id: string
    :param aws_access_key_id: Your AWS Access Key ID

    :type aws_secret_access_key: string
    :param aws_secret_access_key: Your AWS Secret Access Key

    rtype: :class:`boto.cloudhsm.layer1.CloudHSMConnection`
    :return: A connection to the AWS CloudHSM service
    r   )CloudHSMConnection)r*   r+   )Zboto.cloudhsm.layer1r   )r*   r+   r,   r   r   r   r   connect_cloudhsm  s
    r   c             K   s    ddl m} |f | |d|S )z
    Connect to Amazon EC2 Container Service
    rtype: :class:`boto.ec2containerservice.layer1.EC2ContainerServiceConnection`
    :return: A connection to the Amazon EC2 Container Service
    r   )EC2ContainerServiceConnection)r*   r+   )Zboto.ec2containerservice.layer1r   )r*   r+   r,   r   r   r   r   connect_ec2containerservice.  s
    r   c             K   s    ddl m} |f | |d|S )z
    Connect to Amazon Machine Learning service
    rtype: :class:`boto.machinelearning.layer1.MachineLearningConnection`
    :return: A connection to the Amazon Machine Learning service
    r   )MachineLearningConnection)r*   r+   )Zboto.machinelearning.layer1r   )r*   r+   r,   r   r   r   r   connect_machinelearning>  s
    r   r   Tc          
   C   s  d}d}|  d}	|	dkr(| }
| }n | d|	  }
| |	d d }|
dkr\td|
 |
dkrd	}|d
krtd}t|||S |dd}|d }d}|r|rt|rt|rtd|  |
dkrt	|}|rP|
 }|d }|dd}t|d }nL|
dkrDt|}|rP|
 }|d }|dd}|d }ntd|
 t|dkrf|d }||
|||||||dS dS )aR  
    Instantiate a StorageUri from a URI string.

    :type uri_str: string
    :param uri_str: URI naming bucket + optional object.
    :type default_scheme: string
    :param default_scheme: default scheme for scheme-less URIs.
    :type debug: int
    :param debug: debug level to pass in to boto connection (range 0..2).
    :type validate: bool
    :param validate: whether to check for bucket name validity.
    :type bucket_storage_uri_class: BucketStorageUri interface.
    :param bucket_storage_uri_class: Allows mocking for unit tests.
    :param suppress_consec_slashes: If provided, controls whether
        consecutive slashes will be suppressed in key paths.
    :type is_latest: bool
    :param is_latest: whether this versioned object represents the
        current version.

    We allow validate to be disabled to allow caller
    to implement bucket-level wildcarding (outside the boto library;
    see gsutil).

    :rtype: :class:`boto.StorageUri` subclass
    :return: StorageUri subclass for given URI.

    ``uri_str`` must be one of the following formats:

    * gs://bucket/name
    * gs://bucket/name#ver
    * s3://bucket/name
    * gs://bucket
    * s3://bucket
    * filename (which could be a Unix path like /a/b/c or a Windows path like
      C:\c)

    The last example uses the default scheme ('file', unless overridden).
    Nz://r      )r   s3gszUnrecognized scheme "%s"r   F-T/   r   zInvalid bucket name in URI "%s"r   versionless_uri_str
generationr   
version_id)suppress_consec_slashesr   r   	is_latest)findlowerr   r   splitBUCKET_NAME_REmatchTOO_LONG_DNS_NAME_COMPsearchGENERATION_RE	groupdictint
VERSION_RElen)uri_strZdefault_schemedebugZvalidateZbucket_storage_uri_classr   r   r   r   Zend_scheme_idxrc   r   Z	is_stream
path_partsZbucket_nameZobject_namer   Zmdr   r   r   r   storage_uriN  sV    )







r   c             C   sN   t | tjjjs$tdtt|  | jj	j
 }d|| jj| jf }t|S )zReturns a StorageUri for the given key.

    :type key: :class:`boto.s3.key.Key` or subclass
    :param key: URI naming bucket + optional object.
    z7Requested key (%s) is not a subclass of boto.s3.key.Keyz
%s://%s/%s)
isinstancer   r   keyZKeyr   strtypeZbucketZ
connectionZproviderZget_provider_namer    r   )r   Z	prov_namer   r   r   r   storage_uri_for_key  s    r   )NN)NN)NN)NN)NN)NN)NN)NN)NN)NN)NN)NN)NN)NN)NN)NN)NN)NN)NN)NNNrR   rS   F)NN)NN)NNNrR   re   F)NN)NN)NNF)NN)NN)NN)NNF)NN)NN)NN)NN)NN)NN)NN)NN)NN)NN)NN)NN)NN)NN)NN)NN)NN)NN)NN)NN)fZboto.pyami.configr   r   Zboto.storage_urir   r   Zboto.pluginr   Zdatetimer   platformresysr	   Zlogging.configZboto.compatr   Zboto.exceptionr   __version__ZVersionZstrptimeZpython_versionsystemreleaseZ	UserAgentr
   compiler   r   r   r   r   joindirname__file__ZENDPOINTS_PATHr   ZHandlerr   r   r   Zperflogr   INFOr'   DEBUGr(   r-   r0   r2   r4   r6   r8   r:   r<   r>   r@   rB   rD   rF   rG   rI   rK   rM   rO   rQ   r`   rb   rd   rh   rj   rl   ro   rp   rr   rs   ru   rw   rx   rz   r|   r~   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   ZpluginZload_pluginsr   r   r   r   <module>   s   
























 
&
 
#  
&

 
 
 
 
  
 
 
 
 
	 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c