%PDF- %PDF-
Direktori : /usr/lib/python2.7/site-packages/salt/modules/ |
Current File : //usr/lib/python2.7/site-packages/salt/modules/s3.pyc |
� ���^c @@ s d Z d d l m Z m Z m Z d d l Z e j e � Z d � Z d d d d d d d d d d d d � Z d d e d d d d d d d d d d d d � Z d d d d d d d d d d d � Z d e d d d d d d d d d d d d � Z d � Z d S( u< Connection module for Amazon S3 :configuration: This module accepts explicit s3 credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtained from AWS API and no further configuration is necessary. More Information available at:: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html If IAM roles are not used you need to specify them either in a pillar or in the minion's config file:: s3.keyid: GKTADJGHEIQSXMKKRBJ08H s3.key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs (Note: this is literally the pillar key 's3.keyid' or the config option 's3.keyid', not "s3:\n keyid: blah".) A service_url may also be specified in the configuration:: s3.service_url: s3.amazonaws.com A role_arn may also be specified in the configuration:: s3.role_arn: arn:aws:iam::111111111111:role/my-role-to-assume If a service_url is not specified, the default is s3.amazonaws.com. This may appear in various documentation as an "endpoint". A comprehensive list for Amazon S3 may be found at:: http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region The service_url will form the basis for the final endpoint that is used to query the service. Path style can be enabled: s3.path_style: True This can be useful if you need to use salt with a proxy for an s3 compatible storage You can use either https protocol or http protocol: s3.https_enable: True SSL verification may also be turned off in the configuration: s3.verify_ssl: False This is required if using S3 bucket names that contain a period, as these will not match Amazon's S3 wildcard certificates. Certificate verification is enabled by default. AWS region may be specified in the configuration: s3.location: eu-central-1 Default is us-east-1. This module should be usable to query other S3-like services, such as Eucalyptus. :depends: requests i ( t absolute_importt unicode_literalst print_functionNc C@ s t S( u7 Should work on any modern Python installation ( t True( ( ( s3 /usr/lib/python2.7/site-packages/salt/modules/s3.pyt __virtual__K s c C@ s� t | | | | | | | | | � \ } } } } } } } } } t d d d d | d | d | d | d | d | d | d | d | d | d | d | � S( u� Delete a bucket, or delete an object from a bucket. CLI Example to delete a bucket:: salt myminion s3.delete mybucket CLI Example to delete an object from a bucket:: salt myminion s3.delete mybucket remoteobject u s3.queryt methodu DELETEt buckett patht actiont keyt keyidt kms_keyidt service_urlt verify_sslt locationt role_arnt path_stylet https_enable( t _get_keyt __utils__( R R R R R R R R R R R R ( ( s3 /usr/lib/python2.7/site-packages/salt/modules/s3.pyt deleteR s. $u c C@ s� t | | | | | | | | | � \ } } } } } } } } } t d d d d | d | d | d | d | d | d | d | d | d | d | d | d | d | � S( u� List the contents of a bucket, or return an object from a bucket. Set return_bin to True in order to retrieve an object wholesale. Otherwise, Salt will attempt to parse an XML response. CLI Example to list buckets: .. code-block:: bash salt myminion s3.get CLI Example to list the contents of a bucket: .. code-block:: bash salt myminion s3.get mybucket CLI Example to return the binary contents of an object: .. code-block:: bash salt myminion s3.get mybucket myfile.png return_bin=True CLI Example to save the binary contents of an object to a local file: .. code-block:: bash salt myminion s3.get mybucket myfile.png local_file=/tmp/myfile.png It is also possible to perform an action on a bucket. Currently, S3 supports the following actions:: acl cors lifecycle policy location logging notification tagging versions requestPayment versioning website To perform an action on a bucket: .. code-block:: bash salt myminion s3.get mybucket myfile.png action=acl u s3.queryR u GETR R t return_bint local_fileR 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 ( ( s3 /usr/lib/python2.7/site-packages/salt/modules/s3.pyt get{ s2 7$c C@ s� t | | | | | | | | | � \ } } } } } } } } } t d d d d | d | d | d | d | d | d | d | d t d | d | d | � S( u� Return the metadata for a bucket, or an object in a bucket. CLI Examples: .. code-block:: bash salt myminion s3.head mybucket salt myminion s3.head mybucket myfile.png u s3.queryR u HEADR R R R R R R R t full_headersR R R ( R R R ( R R R R R R R R R R R ( ( s3 /usr/lib/python2.7/site-packages/salt/modules/s3.pyt head� s. $c C@ s� t | | | | | | | | | � \ } } } } } } } } } t d d d d | d | d | d | d | d | d | d | d | d | d | d | d | d | � S( u< Create a new bucket, or upload an object to a bucket. CLI Example to create a bucket: .. code-block:: bash salt myminion s3.put mybucket CLI Example to upload an object to a bucket: .. code-block:: bash salt myminion s3.put mybucket remotepath local_file=/path/to/file u s3.queryR u PUTR 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 ( ( s3 /usr/lib/python2.7/site-packages/salt/modules/s3.pyt put� s2 $c C@ s | r* t d d � r* t d d � } n | rT t d d � rT t d d � } n | r~ t d d � r~ t d d � } n | r� t d d � r� t d d � } n | s� d } n | d k r� t d d � d k r� t d d � } n | d k rt } n | d k r6t d d � d k r6t d d � } n | d k ret d d � ret d d � } n | d k r�t d d � d k r�t d d � } n | d k r�t } n | d k r�t d d � d k r�t d d � } n | d k r�t } n | | | | | | | | | f S( u5 Examine the keys, and populate as necessary u config.optionu s3.keyu s3.keyidu aws.kms.keyidu s3.service_urlu s3.amazonaws.comu s3.verify_sslu s3.locationu s3.role_arnu s3.path_styleu s3.https_enableN( t __salt__t NoneR t False( R R R R R R R R R ( ( s3 /usr/lib/python2.7/site-packages/salt/modules/s3.pyR ' s6 " "" " ( t __doc__t __future__R R R t loggingt getLoggert __name__t logR R R R R R R R ( ( ( s3 /usr/lib/python2.7/site-packages/salt/modules/s3.pyt <module>B s&