%PDF- %PDF-
Direktori : /usr/lib/python2.7/site-packages/salt/modules/ |
Current File : //usr/lib/python2.7/site-packages/salt/modules/boto_s3.pyc |
� ���^c @@ s� d Z d d l m Z m Z m Z d d l Z d d l Z e j e � Z y; d d l Z d d l Z e j d � j e j � e Z Wn e k r� e Z n Xd � Z d � Z d d d d d d � Z d d d d d d � Z d S( u� Connection module for Amazon S3 using boto3 .. versionadded:: 2018.3.0 :configuration: This module accepts explicit AWS credentials but can also utilize IAM roles assigned to the instance through Instance Profiles or it can read them from the ~/.aws/credentials file or from these environment variables: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY. Dynamic credentials are then automatically obtained from AWS API and no further configuration is necessary. More information available at: .. code-block:: text http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ iam-roles-for-amazon-ec2.html http://boto3.readthedocs.io/en/latest/guide/ configuration.html#guide-configuration If IAM roles are not used you need to specify them either in a pillar or in the minion's config file: .. code-block:: yaml s3.keyid: GKTADJGHEIQSXMKKRBJ08H s3.key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs A region may also be specified in the configuration: .. code-block:: yaml s3.region: us-east-1 If a region is not specified, the default is us-east-1. It's also possible to specify key, keyid and region via a profile, either as a passed in dict, or as a string to pull from pillars or minion config: .. code-block:: yaml myprofile: keyid: GKTADJGHEIQSXMKKRBJ08H key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs region: us-east-1 :depends: boto3 i ( t absolute_importt print_functiont unicode_literalsNu boto3c C@ s t j j j d d � S( ug Only load if boto libraries exist and if boto libraries are greater than a given version. t boto3_veru 1.2.1( t saltt utilst versionst check_boto_reqs( ( ( s8 /usr/lib/python2.7/site-packages/salt/modules/boto_s3.pyt __virtual__K s c C@ s t r t d t d � n d S( Nu boto3.assign_funcsu s3( t HAS_BOTOt __utils__t __name__( t opts( ( s8 /usr/lib/python2.7/site-packages/salt/modules/boto_s3.pyt __init__U s c C@ s� | j d � \ } } } | d k r- i } n t d | d | d | d | � } y | j d | d | | � } WnM t j j k r� } | j d d d k r� i d d 6Si t d | � d 6SXi | d 6S( u� Get metadata about an S3 object. Returns None if the object does not exist. You can pass AWS SSE-C related args and/or RequestPayer in extra_args. CLI Example: .. code-block:: bash salt myminion boto_s3.get_object_metadata \ my_bucket/path/to/object \ region=us-east-1 \ key=key \ keyid=keyid \ profile=profile \ u /t regiont keyt keyidt profilet Buckett Keyu Erroru Messageu Not Foundu resultu boto3.get_erroru errorN( t partitiont Nonet _get_connt head_objectt botocoret exceptionst ClientErrort responseR ( t namet extra_argsR R R R t buckett _t s3_keyt connt metadatat e( ( s8 /usr/lib/python2.7/site-packages/salt/modules/boto_s3.pyt get_object_metadataZ s ! c C@ s� | j d � \ } } } t d | d | d | d | � } y | j | | | d | �Wn+ t j j k r� } i t d | � d 6SXt j d | � i t d 6S( u� Upload a local file as an S3 object. CLI Example: .. code-block:: bash salt myminion boto_s3.upload_file \ /path/to/local/file \ my_bucket/path/to/object \ region=us-east-1 \ key=key \ keyid=keyid \ profile=profile \ u /R R R R t ExtraArgsu boto3.get_erroru erroru S3 object uploaded to %su result( R R t upload_filet boto3R t S3UploadFailedErrorR t logt infot True( t sourceR R R R R R R R R R! R# ( ( s8 /usr/lib/python2.7/site-packages/salt/modules/boto_s3.pyR&