%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/modules/libcloud_storage.pyo

�
���^c@@s�dZddlmZmZmZddlZddlZddlZddl	m
Zeje
�ZdZyuddlZddlmZeed�r�eej�ee�kr�e��nejd�jej�eZWnek
r�eZnXd	�Zd
�Zd�Zd�Zd
�Zd�Z d�Z!d�Z"eed�Z#dedd�Z%d�Z&d�Z'd�Z(dS(u
Apache Libcloud Storage Management
==================================

Connection module for Apache Libcloud Storage (object/blob) management for a full list
of supported clouds, see http://libcloud.readthedocs.io/en/latest/storage/supported_providers.html

Clouds include Amazon S3, Google Storage, Aliyun, Azure Blobs, Ceph, OpenStack swift

.. versionadded:: 2018.3.0

:configuration:
    This module uses a configuration profile for one or multiple Storage providers

    .. code-block:: yaml

        libcloud_storage:
            profile_test1:
              driver: google_storage
              key: GOOG0123456789ABCXYZ
              secret: mysecret
            profile_test2:
              driver: s3
              key: 12345
              secret: mysecret

:depends: apache-libcloud
i(tabsolute_importtunicode_literalstprint_functionN(tLooseVersionu1.5.0(t
get_driveru__version__ulibcloudcC@s#tsdjt�}t|fStS(u0
    Only load if libcloud libraries exist.
    uAA apache-libcloud library with version at least {0} was not found(tHAS_LIBCLOUDtformattREQUIRED_LIBCLOUD_VERSIONtFalsetTrue(tmsg((sA/usr/lib/python2.7/site-packages/salt/modules/libcloud_storage.pyt__virtual__<s
	
cC@stjjjt�dS(N(tsalttutilstcompattpack_dundert__name__(topts((sA/usr/lib/python2.7/site-packages/salt/modules/libcloud_storage.pyt__init__GscC@s�tdd�|}t|d�}|j�}|d=|jd�|d<|jdd�|d<|jdt�|d<|jdd�|d<|jdd�|d<||�S(	Nu
config.optionulibcloud_storageudriverukeyusecretusecureuhostuport(t__salt__RtcopytgettNoneR	(tprofiletconfigtclstargs((sA/usr/lib/python2.7/site-packages/salt/modules/libcloud_storage.pyt_get_driverKscK@sotd|�}tjjj|�}|j|�}g}x/|D]'}|ji|jd6|jd6�q@W|S(uN
    Return a list of containers.

    :param profile: The profile key
    :type  profile: ``str``

    :param libcloud_kwargs: Extra arguments for the driver's list_containers method
    :type  libcloud_kwargs: ``dict``

    CLI Example:

    .. code-block:: bash

        salt myminion libcloud_storage.list_containers profile1
    Runameuextra(	RRR
Rtclean_kwargstlist_containerstappendtnametextra(Rtlibcloud_kwargstconnt
containerstrett	container((sA/usr/lib/python2.7/site-packages/salt/modules/libcloud_storage.pyRXs
	
cK@s�td|�}|j|�}tjjj|�}|j||�}g}xZ|D]R}|ji|jd6|j	d6|j
d6|jjd6|jd6|j
d6�qRW|S(u�
    List container objects (e.g. files) for the given container_id on the given profile

    :param container_name: Container name
    :type  container_name: ``str``

    :param profile: The profile key
    :type  profile: ``str``

    :param libcloud_kwargs: Extra arguments for the driver's list_container_objects method
    :type  libcloud_kwargs: ``dict``

    CLI Example:

    .. code-block:: bash

        salt myminion libcloud_storage.list_container_objects MyFolder profile1
    Runameusizeuhashu	containeruextrau	meta_data(Rt
get_containerRR
RRtlist_container_objectsRRtsizethashR%R t	meta_data(tcontainer_nameRR!R"R%tobjectsR$tobj((sA/usr/lib/python2.7/site-packages/salt/modules/libcloud_storage.pyR'ts
	




cK@sNtd|�}tjjj|�}|j||�}i|jd6|jd6S(u�
    Create a container in the cloud

    :param container_name: Container name
    :type  container_name: ``str``

    :param profile: The profile key
    :type  profile: ``str``

    :param libcloud_kwargs: Extra arguments for the driver's create_container method
    :type  libcloud_kwargs: ``dict``

    CLI Example:

    .. code-block:: bash

        salt myminion libcloud_storage.create_container MyFolder profile1
    Runameuextra(RRR
RRtcreate_containerRR (R+RR!R"R%((sA/usr/lib/python2.7/site-packages/salt/modules/libcloud_storage.pyR.�s
cK@sNtd|�}tjjj|�}|j||�}i|jd6|jd6S(u�
    List container details for the given container_name on the given profile

    :param container_name: Container name
    :type  container_name: ``str``

    :param profile: The profile key
    :type  profile: ``str``

    :param libcloud_kwargs: Extra arguments for the driver's get_container method
    :type  libcloud_kwargs: ``dict``

    CLI Example:

    .. code-block:: bash

        salt myminion libcloud_storage.get_container MyFolder profile1
    Runameuextra(RRR
RRR&RR (R+RR!R"R%((sA/usr/lib/python2.7/site-packages/salt/modules/libcloud_storage.pyR&�s
cK@s|td|�}tjjj|�}|j|||�}i|jd6|jd6|jd6|j	jd6|j
d6|jd6S(u'
    Get the details for a container object (file or object in the cloud)

    :param container_name: Container name
    :type  container_name: ``str``

    :param object_name: Object name
    :type  object_name: ``str``

    :param profile: The profile key
    :type  profile: ``str``

    :param libcloud_kwargs: Extra arguments for the driver's get_container_object method
    :type  libcloud_kwargs: ``dict``

    CLI Example:

    .. code-block:: bash

        salt myminion libcloud_storage.get_container_object MyFolder MyFile.xyz profile1
    Runameusizeuhashu	containeruextrau	meta_data(RRR
RRtget_container_objectRR(R)R%R R*(R+tobject_nameRR!R"R-((sA/usr/lib/python2.7/site-packages/salt/modules/libcloud_storage.pyR/�s




c	K@sOtd|�}|j||�}tjjj|�}|j|||||�S(u�
    Download an object to the specified destination path.

    :param container_name: Container name
    :type  container_name: ``str``

    :param object_name: Object name
    :type  object_name: ``str``

    :param destination_path: Full path to a file or a directory where the
                                incoming file will be saved.
    :type destination_path: ``str``

    :param profile: The profile key
    :type  profile: ``str``

    :param overwrite_existing: True to overwrite an existing file,
                                defaults to False.
    :type overwrite_existing: ``bool``

    :param delete_on_failure: True to delete a partially downloaded file if
                                the download was not successful (hash
                                mismatch / file size).
    :type delete_on_failure: ``bool``

    :param libcloud_kwargs: Extra arguments for the driver's download_object method
    :type  libcloud_kwargs: ``dict``

    :return: True if an object has been successfully downloaded, False
                otherwise.
    :rtype: ``bool``

    CLI Example:

    .. code-block:: bash

        salt myminion libcloud_storage.download_object MyFolder me.jpg /tmp/me.jpg profile1

    R(Rt
get_objectRR
RRtdownload_object(	R+R0tdestination_pathRtoverwrite_existingtdelete_on_failureR!R"R-((sA/usr/lib/python2.7/site-packages/salt/modules/libcloud_storage.pyR2�s)cK@s[td|�}tjjj|�}|j|�}	|j||	|||||�}
|
jS(u
    Upload an object currently located on a disk.

    :param file_path: Path to the object on disk.
    :type file_path: ``str``

    :param container_name: Destination container.
    :type container_name: ``str``

    :param object_name: Object name.
    :type object_name: ``str``

    :param profile: The profile key
    :type  profile: ``str``

    :param verify_hash: Verify hash
    :type verify_hash: ``bool``

    :param extra: Extra attributes (driver specific). (optional)
    :type extra: ``dict``

    :param headers: (optional) Additional request headers,
        such as CORS headers. For example:
        headers = {'Access-Control-Allow-Origin': 'http://mozilla.com'}
    :type headers: ``dict``

    :param libcloud_kwargs: Extra arguments for the driver's upload_object method
    :type  libcloud_kwargs: ``dict``

    :return: The object name in the cloud
    :rtype: ``str``

    CLI Example:

    .. code-block:: bash

        salt myminion libcloud_storage.upload_object /file/to/me.jpg MyFolder me.jpg profile1

    R(RRR
RRR&t
upload_objectR(t	file_pathR+R0RR tverify_hashtheadersR!R"R%R-((sA/usr/lib/python2.7/site-packages/salt/modules/libcloud_storage.pyR6!s
)!cK@sFtd|�}tjjj|�}|j|||�}|j|�S(uc
    Delete an object in the cloud

    :param container_name: Container name
    :type  container_name: ``str``

    :param object_name: Object name
    :type  object_name: ``str``

    :param profile: The profile key
    :type  profile: ``str``

    :param libcloud_kwargs: Extra arguments for the driver's delete_object method
    :type  libcloud_kwargs: ``dict``

    :return: True if an object has been successfully deleted, False
                otherwise.
    :rtype: ``bool``

    CLI Example:

    .. code-block:: bash

        salt myminion libcloud_storage.delete_object MyFolder me.jpg profile1
    R(RRR
RRR1t
delete_object(R+R0RR!R"R-((sA/usr/lib/python2.7/site-packages/salt/modules/libcloud_storage.pyR:QscK@sCtd|�}tjjj|�}|j|�}|j||�S(u1
    Delete an object container in the cloud

    :param container_name: Container name
    :type  container_name: ``str``

    :param profile: The profile key
    :type  profile: ``str``

    :param libcloud_kwargs: Extra arguments for the driver's delete_container method
    :type  libcloud_kwargs: ``dict``

    :return: True if an object container has been successfully deleted, False
                otherwise.
    :rtype: ``bool``

    CLI Example:

    .. code-block:: bash

        salt myminion libcloud_storage.delete_container MyFolder profile1
    R(RRR
RRR&tdelete_container(R+RR!R"R%((sA/usr/lib/python2.7/site-packages/salt/modules/libcloud_storage.pyR;qscK@s=tjjj|�}td|�}t||�}||�S(u�
    Call an extended method on the driver

    :param method: Driver's method name
    :type  method: ``str``

    :param profile: The profile key
    :type  profile: ``str``

    :param libcloud_kwargs: Extra arguments for the driver's delete_container method
    :type  libcloud_kwargs: ``dict``

    CLI Example:

    .. code-block:: bash

        salt myminion libcloud_storage.extra ex_get_permissions google container_name=my_container object_name=me.jpg --out=yaml
    R(RR
RRRtgetattr(tmethodRR!R"tconnection_method((sA/usr/lib/python2.7/site-packages/salt/modules/libcloud_storage.pyR �s()t__doc__t
__future__RRRtloggingtsalt.utils.argsRtsalt.utils.compattsalt.utils.versionsRt
_LooseVersiont	getLoggerRtlogRtlibcloudtlibcloud.storage.providersRthasattrt__version__tImportErrortsetLeveltCRITICALR	RRRRRRR'R.R&R/R2RR6R:R;R (((sA/usr/lib/python2.7/site-packages/salt/modules/libcloud_storage.pyt<module>s<*


			
		$			#./	 	

Zerion Mini Shell 1.0