U
    W+d                     @   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   s4   t D ]*} ztjtj|  W q   Y qX qd S N)r   loggingconfig
fileConfigospath
expanduser)file r   1/tmp/pip-unpacked-wheel-dlxw5sjy/boto/__init__.pyinit_loggingA   s
    r   c                   @   s   e Zd Zdd ZdS )NullHandlerc                 C   s   d S r	   r   )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setLevel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 r   )r
   r   r   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    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.s3.connection.S3Connection`
    :return: A connection to Amazon's S3
    r   S3Connection)boto.s3.connectionr4   )r/   r0   r1   r4   r   r   r   
connect_s3   s    r6   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.connectionr7   )Zgs_access_key_idZgs_secret_access_keyr1   r7   r   r   r   
connect_gs   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.connection.EC2Connection`
    :return: A connection to Amazon's EC2
    r   EC2Connection)Zboto.ec2.connectionr:   )r/   r0   r1   r:   r   r   r   connect_ec2   s    r;   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.elbr<   )r/   r0   r1   r<   r   r   r   connect_elb   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.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.autoscaler>   )r/   r0   r1   r>   r   r   r   connect_autoscale   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.ec2.cloudwatch.CloudWatchConnection`
    :return: A connection to Amazon's EC2 Monitoring service
    r   )CloudWatchConnection)Zboto.ec2.cloudwatchr@   )r/   r0   r1   r@   r   r   r   connect_cloudwatch   s    rA   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.connectionrB   )r/   r0   r1   rB   r   r   r   connect_sdb   s    rC   c                 K   s   ddl m} || |f|S )  
    :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.connectionrE   )r/   r0   r1   rE   r   r   r   connect_fps   s    rF   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.connectionrG   )r/   r0   r1   rG   r   r   r   connect_mturk  s    rH   c                 K   s   ddl m} || |f|S )rD   r   )CloudFrontConnection)Zboto.cloudfrontrI   )r/   r0   r1   rI   r   r   r   connect_cloudfront  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.vpc.VPCConnection`
    :return: A connection to VPC
    r   )VPCConnection)Zboto.vpcrK   )r/   r0   r1   rK   r   r   r   connect_vpc#  s    rL   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.rdsrN   r/   r0   r1   rN   r   r   r   connect_rds2  s    rP   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   rM   r/   r0   )Zboto.rds2.layer1rN   rO   r   r   r   connect_rds2A  s    rR   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.emrrS   )r/   r0   r1   rS   r   r   r   connect_emrT  s    rT   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.snsrU   )r/   r0   r1   rU   r   r   r   connect_snsc  s    rV   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.iamrW   )r/   r0   r1   rW   r   r   r   connect_iamr  s    rX   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.route53rY   )r/   r0   r1   rY   r   r   r   connect_route53  s    rZ   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.cloudformationr[   )r/   r0   r1   r[   r   r   r   connect_cloudformation  s    r\   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   r9   
RegionInfoCredentialseuca_access_key_idNeuca_secret_access_keyBotoZeucalyptus_hostZ
eucalyptusr$   Zendpoint)regionportr   	is_secure)Zboto.ec2r:   boto.ec2.regioninfor`   r   get)
hostr/   r0   rg   r   rh   r1   r:   r`   regr   r   r   connect_euca  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.glacier.layer2.Layer2`
    :return: A connection to Amazon's Glacier Service
    r   Layer2)Zboto.glacier.layer2ro   r/   r0   r1   ro   r   r   r   connect_glacier  s    rq   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   r_   rg   rk   r   rh   httpsre   rf   r/   r0   )ri   r`   r   rg   hostnamer   schemer;   )urlr/   r0   r1   r`   purlr   r   r   connect_ec2_endpoint  s    



rw   /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   r3   OrdinaryCallingFormatra   rb   Nrc   rd   Zwalrus_host)rk   rg   r   calling_formatrh   r5   r4   rz   r   rj   )	rk   r/   r0   rg   r   rh   r1   r4   rz   r   r   r   connect_walrus  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.ses.SESConnection`
    :return: A connection to Amazon's SES
    r   )SESConnection)Zboto.sesr~   )r/   r0   r1   r~   r   r   r   connect_ses'  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.sts.STSConnection`
    :return: A connection to Amazon's STS
    r   )STSConnection)Zboto.stsr   )r/   r0   r1   r   r   r   r   connect_sts6  s    r   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   r3   ry   ra   ia_access_key_idia_secret_access_keyzs3.us.archive.org)rk   r{   rh   r|   )r   r   rh   r1   r4   rz   Z
access_keyZ
secret_keyr   r   r   
connect_iaE  s    r   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   rn   )Zboto.dynamodb.layer2ro   rp   r   r   r   connect_dynamodbe  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.swf.layer1.Layer1`
    :return: A connection to the Layer1 interface for SWF.
    r   Layer1)Zboto.swf.layer1r   r/   r0   r1   r   r   r   r   connect_swfv  s    r   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   rn   )Zboto.cloudsearch.layer2ro   rp   r   r   r   connect_cloudsearch  s    r   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   rn   sign_request)Zboto.cloudsearch2.layer2ro   )r/   r0   r   r1   ro   r   r   r   connect_cloudsearch2  s    
r   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.layer1r   )r/   r0   r1   r   r   r   r   connect_cloudsearchdomain  s    r   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   r   )Zboto.beanstalk.layer1r   r   r   r   r   connect_beanstalk  s    r   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   )ElasticTranscoderConnectionrQ   )Zboto.elastictranscoder.layer1r   )r/   r0   r1   r   r   r   r   connect_elastictranscoder  s    r   c                 K   s    ddl m} |f | |d|S )Nr   )OpsWorksConnectionrQ   )Zboto.opsworks.layer1r   )r/   r0   r1   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   )RedshiftConnectionrQ   )Zboto.redshift.layer1r   )r/   r0   r1   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   )SupportConnectionrQ   )Zboto.support.layer1r   )r/   r0   r1   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   )CloudTrailConnectionrQ   )Zboto.cloudtrail.layer1r   )r/   r0   r1   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   )DirectConnectConnectionrQ   )Zboto.directconnect.layer1r   )r/   r0   r1   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   )KinesisConnectionrQ   )Zboto.kinesis.layer1r   )r/   r0   r1   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   )CloudWatchLogsConnectionrQ   )Zboto.logs.layer1r   )r/   r0   r1   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   )Route53DomainsConnectionrQ   )Zboto.route53.domains.layer1r   )r/   r0   r1   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   )CognitoIdentityConnectionrQ   )Zboto.cognito.identity.layer1r   )r/   r0   r1   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   )CognitoSyncConnectionrQ   )Zboto.cognito.sync.layer1r   )r/   r0   r1   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   )KMSConnectionrQ   )Zboto.kms.layer1r   )r/   r0   r1   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   )AWSLambdaConnectionrQ   )Zboto.awslambda.layer1r   )r/   r0   r1   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   )CodeDeployConnectionrQ   )Zboto.codedeploy.layer1r   )r/   r0   r1   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   )ConfigServiceConnectionrQ   )Zboto.configservice.layer1r   )r/   r0   r1   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   )CloudHSMConnectionrQ   )Zboto.cloudhsm.layer1r   )r/   r0   r1   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   )EC2ContainerServiceConnectionrQ   )Zboto.ec2containerservice.layer1r   )r/   r0   r1   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   )MachineLearningConnectionrQ   )Zboto.machinelearning.layer1r   )r/   r0   r1   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debugvalidateZbucket_storage_uri_classr   r   r   r   Zend_scheme_idxrt   r   	is_stream
path_partsZbucket_nameZobject_namer   Zmdr   r   r   r   storage_uriN  sf    )





     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bucket
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)NNNr]   r^   F)NN)NN)NNNr]   rx   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   datetimer   platformresysr
   logging.configZboto.compatr   Zboto.exceptionr   __version__Versionstrptimepython_versionsystemreleaseZ	UserAgentr   compiler   r   r   r   r   joindirname__file__ZENDPOINTS_PATHr   Handlerr   r   r#   Zperflogr"   INFOr+   DEBUGr-   r2   r6   r8   r;   r=   r?   rA   rC   rF   rH   rJ   rL   rP   rR   rT   rV   rX   rZ   r\   rm   rq   rw   r}   r   r   r   r   r   r   r   r   r   r   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>   s4  
























      
'
  
$       
(

  
   
  
  
   
  
  
  
  

  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
 
e