ó ¡ôXc@sÃddlZddlZddlZddlZddlZddlmZddlZddlm Z ddl Z ddl m Z ddl Zde e fd„ƒYZdefd„ƒYZdS( iÿÿÿÿN(tArg(tFileTransferProgressBarMixin(t S3Requestt PutObjectcBseZdZeddddd(ddƒeddddd(dd ƒed d edd(dd ƒed dd(dd)ƒeddd(ddƒeddddddddddd(dd ƒed!dejƒgZd"Z d#„Z d$„Z d%„Z d&„Z dd'„ZRS(*sÎUpload an object to the server Note that uploading a large file to a region other than the one the bucket is may result in "Broken pipe" errors or other connection problems that this program cannot detect.tsourcetmetavartFILEtroute_tothelpsfile to upload (required)tdests BUCKET/KEYs6bucket and key name to upload the object to (required)s--sizettypesPthe number of bytes to upload (required when reading from stdin)s--acltchoicestprivates public-readspublic-read-writesauthenticated-readsbucket-owner-readsbucket-owner-full-controls aws-exec-reads --mime-types%MIME type for the file being uploadeds--retrytretriestactiont store_consttconstitdefaultis'retry interrupted uploads up to 5 timess--progressbar-labeltPUTcKs,tj||d|_tjƒ|_dS(N(Rt__init__tNonetlast_upload_errort threadingtLockt_lock(tselftkwargs((sC/usr/lib/python2.7/site-packages/euca2ools/commands/s3/putobject.pyR@s cCs]tj|ƒ|jddkri|jjdƒdkrMtjjdƒ‚ntt j |jdƒ}nŽt |jdt j ƒr­tj|jdd|jjdƒƒ}nJ|jjdƒdkrÚtjjdƒ‚nt|jd|jdƒ}||jd<|jdjdƒ\}}}|s>tjjdƒ‚n|sYtjjd ƒ‚ndS( NRt-tsizes0argument --size is required when uploading stdins8argument --size is required when uploading a file objectR t/s)destination bucket name must be non-emptys&destination key name must be non-empty(Rt configuretargstgetRtrequestbuildert exceptionst ArgumentErrort_FileObjectExtenttsyststdint isinstancetsixt string_typest from_filenamet partition(RRtbuckett_tkey((sC/usr/lib/python2.7/site-packages/euca2ools/commands/s3/putobject.pyRFs*   %      cCsf|jd|_|jjdƒr9|jd|jds        }