ó {r Qc@s†ddlZddlZddlZddlZddlZddlmZddlmZ ddl m Z de fd„ƒYZdS(iÿÿÿÿN(tBotoClientError(tKey(tKeyFileRc BsUeZdZdZdZd„Zd„Zed„Z dddedddd„Z d„Z d„Z d„Z dd „Zd „Zdeddddddedd „ Zdedddddddd „ Zdedddddd „Zd„Zddddd„Zddd„Zddd„Zddddd„Zddddd„ZRS(sm Represents a key (object) in a GS bucket. :ivar bucket: The parent :class:`boto.gs.bucket.Bucket`. :ivar name: The name of this Key object. :ivar metadata: A dictionary containing user metadata that you wish to store with the object or that has been retrieved from an existing object. :ivar cache_control: The value of the `Cache-Control` HTTP header. :ivar content_type: The value of the `Content-Type` HTTP header. :ivar content_encoding: The value of the `Content-Encoding` HTTP header. :ivar content_disposition: The value of the `Content-Disposition` HTTP header. :ivar content_language: The value of the `Content-Language` HTTP header. :ivar etag: The `etag` associated with this object. :ivar last_modified: The string timestamp representing the last time this object was modified in GS. :ivar owner: The ID of the owner of this object. :ivar storage_class: The storage class of the object. Currently, one of: STANDARD | DURABLE_REDUCED_AVAILABILITY. :ivar md5: The MD5 hash of the contents of the object. :ivar size: The size, in bytes, of the object. :ivar generation: The generation number of the object. :ivar meta_generation: The generation number of the object metadata. :ivar encrypted: Whether the object is encrypted while at rest on the server. cCsi|jr+|jr+d|j|jf}nd}|jrTd|jj|j|fSd|j|fSdS(Ns#%s.%stss(t generationtmeta_generationtbuckettname(tselftver_str((s./tmp/tmp.yUYbTOKr8o/gsutil/boto/boto/gs/key.pyt__repr__>s  cCs|dkr||_ný|dkr0||_nå|dkr`|dkrTt|_qt|_nµ|dkrx||_n|dkr–t|ƒ|_n|dkr®||_ng|dkr½nX|d krÕ||_ n@|d krí||_ n(|d kr||_ nt |||ƒdS( NRtETagtIsLatestttruet LastModifiedtSizet StorageClasstOwnert VersionIdt GenerationtMetaGeneration( RtetagtTruet is_latesttFalset last_modifiedtinttsizet storage_classt version_idRRtsetattr(RRtvaluet connection((s./tmp/tmp.yUYbTOKr8o/gsutil/boto/boto/gs/key.pyt endElementHs.                    cCs.|jddƒ|_|jddƒ|_dS(Nsx-goog-metagenerationsx-goog-generation(t getheadertNoneRR(Rtresptforce((s./tmp/tmp.yUYbTOKr8o/gsutil/boto/boto/gs/key.pythandle_version_headerscsi c CsWd} |jr"d|jg} n|j|d|d|d|d|d|d| ƒdS(Ns generation=%stheaderstcbtnum_cbtoverride_num_retriestresponse_headerst query_args(R#Rt_get_file_internal( RtfpR'R(R)ttorrentRR*R+R,((s./tmp/tmp.yUYbTOKr8o/gsutil/boto/boto/gs/key.pytget_filegs cCs%|jj|jd|jd|jƒS(NRR(Rt delete_keyRRR(R((s./tmp/tmp.yUYbTOKr8o/gsutil/boto/boto/gs/key.pytdeleterscCs-|jƒ}|j||ƒ|j|ƒdS(sê Convenience method that provides a quick way to add an email grant to a key. This method retrieves the current ACL, creates a new grant based on the parameters passed in, adds that grant to the ACL and then PUT's the new ACL back to GS. :type permission: string :param permission: The permission being granted. Should be one of: READ|FULL_CONTROL See http://code.google.com/apis/storage/docs/developer-guide.html#authorization for more details on permissions. :type email_address: string :param email_address: The email address associated with the Google account to which you are granting the permission. N(tget_acltadd_email_granttset_acl(Rt permissiont email_addresstacl((s./tmp/tmp.yUYbTOKr8o/gsutil/boto/boto/gs/key.pyR4vs cCs-|jƒ}|j||ƒ|j|ƒdS(sÕ Convenience method that provides a quick way to add a canonical user grant to a key. This method retrieves the current ACL, creates a new grant based on the parameters passed in, adds that grant to the ACL and then PUT's the new ACL back to GS. :type permission: string :param permission: The permission being granted. Should be one of: READ|FULL_CONTROL See http://code.google.com/apis/storage/docs/developer-guide.html#authorization for more details on permissions. :type user_id: string :param user_id: The canonical user id associated with the GS account to which you are granting the permission. N(R3tadd_user_grantR5(RR6tuser_idR8((s./tmp/tmp.yUYbTOKr8o/gsutil/boto/boto/gs/key.pyR9‹s cCs9|jd|ƒ}|j||ƒ|j|d|ƒdS(sÜ Convenience method that provides a quick way to add an email group grant to a key. This method retrieves the current ACL, creates a new grant based on the parameters passed in, adds that grant to the ACL and then PUT's the new ACL back to GS. :type permission: string :param permission: The permission being granted. Should be one of: READ|FULL_CONTROL See http://code.google.com/apis/storage/docs/developer-guide.html#authorization for more details on permissions. :type email_address: string :param email_address: The email address associated with the Google Group to which you are granting the permission. R'N(R3tadd_group_email_grantR5(RR6R7R'R8((s./tmp/tmp.yUYbTOKr8o/gsutil/boto/boto/gs/key.pyR; scCs-|jƒ}|j||ƒ|j|ƒdS(sÝ Convenience method that provides a quick way to add a canonical group grant to a key. This method retrieves the current ACL, creates a new grant based on the parameters passed in, adds that grant to the ACL and then PUT's the new ACL back to GS. :type permission: string :param permission: The permission being granted. Should be one of: READ|FULL_CONTROL See http://code.google.com/apis/storage/docs/developer-guide.html#authorization for more details on permissions. :type group_id: string :param group_id: The canonical group id associated with the Google Groups account you are granting the permission to. N(R3tadd_group_grantR5(RR6tgroup_idR8((s./tmp/tmp.yUYbTOKr8o/gsutil/boto/boto/gs/key.pyR<µs c  Csä|jjj} |r*| r*tdƒ‚n|p3i}|rL||| js