HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/boto_s3.cpython-310.pyc
o

�N�g��@s�dZddlZddlZe�e�ZzddlZddlZe�d��	ej
�dZWney/dZYnwdd�Z
dd	�Z					dd
d�Z					ddd
�ZdS)a�
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
�N�boto3TFcCstjjjdd�S)zg
    Only load if boto libraries exist and if boto libraries are greater than
    a given version.
    z1.2.1)Z	boto3_ver)�salt�utilsZversionsZcheck_boto_reqs�rr�H/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/boto_s3.py�__virtual__KsrcCstrtdtd�dSdS)Nzboto3.assign_funcsZs3)�HAS_BOTO�	__utils__�__name__)�optsrrr�__init__Ss�rc
Cs�|�d�\}}}|duri}t||||d�}	z|	jd||d�|��}
Wd|
iStjjyU}z!|jdddkrCddiWYd}~Sd	td
|�iWYd}~Sd}~ww)a�
    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 \
    �/N��region�key�keyid�profile)ZBucketZKey�Error�Messagez	Not Found�result�error�boto3.get_errorr)�	partition�	_get_connZhead_object�botocore�
exceptionsZClientError�responser	)�name�
extra_argsrrrr�bucket�_�s3_key�conn�metadata�errr�get_object_metadataXs���r%c
Cs�|�d�\}}}	t||||d�}
z|
j|||	|d�Wntjjy7}zdtd|�iWYd}~Sd}~wwt�d|�dd	iS)
a�
    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 \
    r
r)Z	ExtraArgsrrNzS3 object uploaded to %srT)	rr�upload_filerrZS3UploadFailedErrorr	�log�info)�sourcerrrrrrrr r!r"r$rrrr&�s��r&)NNNNN)�__doc__�loggingZsalt.utils.versionsr�	getLoggerr
r'rr�setLevel�CRITICALr�ImportErrorrrr%r&rrrr�<module>s45
�
�,�