o ckF[f@s`ddlmZddlmZddlmZddlmZddlmZGdddeZ Gdd d eZ d S) )Bucket) S3Connection)SubdomainCallingFormat)check_lowercase_bucketname)get_utf8_valuec@seZdZdZdZdS)LocationUSEUN)__name__ __module__ __qualname__DEFAULTr rr4/usr/lib/python3/dist-packages/boto/gs/connection.pyrsrcsbeZdZdZdZddddddddeddeddffdd Zdejdd fd d Z dd d Z Z S) GSConnectionzstorage.googleapis.comz)Signature=%s&Expires=%d&GoogleAccessId=%sNTr/cs4tt|j||||||||| | | | | dt|ddS)Ngoogle)suppress_consec_slashes)superr__init__r)selfgs_access_key_idgs_secret_access_key is_secureportproxy proxy_port proxy_user proxy_passhostdebughttps_connection_factorycalling_formatpathr __class__rrr%s    zGSConnection.__init__STANDARDc Cst||r|r|||jj<n|jj|i}|stj}d|}|r%d|}nd}d||f}|jdt||t|d} | } | jdkrM|j | j| j | | jdkrX| ||S|j | j| j | ) a Creates a new bucket. By default it's located in the USA. You can pass Location.EU to create bucket in the EU. You can also pass a LocationConstraint for where the bucket should be located, and a StorageClass describing how the data should be stored. :type bucket_name: string :param bucket_name: The name of the new bucket. :type headers: dict :param headers: Additional headers to pass along with the request to GCS. :type location: :class:`boto.gs.connection.Location` :param location: The location of the new bucket. :type policy: :class:`boto.gs.acl.CannedACLStrings` :param policy: A canned ACL policy that will be applied to the new key in GCS. :type storage_class: string :param storage_class: Either 'STANDARD' or 'DURABLE_REDUCED_AVAILABILITY'. z+%sz%sz;%s%sPUT)headersdatai) rprovider acl_headerrr make_requestrreadstatusstorage_create_errorreason bucket_classstorage_response_error) r bucket_namer)locationpolicy storage_class location_elemstorage_class_elemr*responsebodyrrr create_bucket1s@       zGSConnection.create_bucketcCs"|||}|r|j|dd|S)a Retrieves a bucket by name. If the bucket does not exist, an ``S3ResponseError`` will be raised. If you are unsure if the bucket exists or not, you can use the ``S3Connection.lookup`` method, which will either return a valid bucket or ``None``. :type bucket_name: string :param bucket_name: The name of the bucket :type headers: dict :param headers: Additional headers to pass along with the request to AWS. :type validate: boolean :param validate: If ``True``, it will try to fetch all keys within the given bucket. (Default: ``True``) r)maxkeys)r3 get_all_keys)rr5validater)bucketrrr get_bucketjs zGSConnection.get_bucket)TN) r r r DefaultHost QueryStringrrrr r=rB __classcell__rrr$rr s  9rN) boto.gs.bucketrboto.s3.connectionrrr boto.utilsrobjectrrrrrrs