%PDF- %PDF-
Mini Shell

Mini Shell

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

�
���^c@@s�dZddlmZmZmZddlZddlZeje	�Z
d�Zd�Zd�Z
d�Zd�Zd	�Zd
�Zed�ZdS(u2
Apache Libcloud Storage State
=============================

Manage cloud storage using libcloud

:codeauthor: ``Anthony Shaw <anthonyshaw@apache.org>``

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

Examples
--------

Creating a container and uploading a file
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. code-block:: yaml

    web_things:
      libcloud_storage.container_present:
        name: my_container_name
        profile: profile1
      libcloud_storage.object_present:
        name: my_file.jpg
        container: my_container_name
        path: /path/to/local/file.jpg
        profile: profile1

Downloading a file
~~~~~~~~~~~~~~~~~~

This example will download the file from the remote cloud and keep it locally

.. code-block:: yaml

    web_things:
      libcloud_storage.file_present:
        name: my_file.jpg
        container: my_container_name
        path: /path/to/local/file.jpg
        profile: profile1

:depends: apache-libcloud
i(tabsolute_importtunicode_literalstprint_functionNcC@stS(N(tTrue(((s@/usr/lib/python2.7/site-packages/salt/states/libcloud_storage.pyt__virtual__MscC@stjjjt�dS(N(tsalttutilstcompattpack_dundert__name__(topts((s@/usr/lib/python2.7/site-packages/salt/states/libcloud_storage.pyt__init__QscC@s i|d6|d6|d6|d6S(Nuresultucommentunameuchanges((tresulttmessagetnametchanges((s@/usr/lib/python2.7/site-packages/salt/states/libcloud_storage.pytstate_resultUs
cC@s�td|�}g|D]}|d|kr|^q}t|�dkr^ttd|i�Std||�}ttd||�SdS(u�
    Ensures a container is present.

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

    :param profile: The profile key
    :type  profile: ``str``
    u libcloud_storage.list_containersunameiuContainer already existsu!libcloud_storage.create_containeruCreated new containerN(t__salt__tlenRR(Rtprofilet
containerstztmatchR((s@/usr/lib/python2.7/site-packages/salt/states/libcloud_storage.pytcontainer_present\s
)cC@s�td|�}g|D]}|d|kr|^q}t|�dkr^ttd|i�Std||�}t|d|i�SdS(u�
    Ensures a container is absent.

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

    :param profile: The profile key
    :type  profile: ``str``
    u libcloud_storage.list_containersunameiuContainer already absentu!libcloud_storage.delete_containeruDeleted containerN(RRRR(RRRRRR((s@/usr/lib/python2.7/site-packages/salt/states/libcloud_storage.pytcontainer_absentos
)cC@setd|||�}|dk	r5ttd|i�Std||||�}t|d|i�SdS(u(
    Ensures a object is presnt.

    :param container: Container name
    :type  container: ``str``

    :param name: Object name in cloud
    :type  name: ``str``

    :param path: Local path to file
    :type  path: ``str``

    :param profile: The profile key
    :type  profile: ``str``
    u%libcloud_storage.get_container_objectuObject already presentulibcloud_storage.upload_objectuUploaded objectN(RtNoneRR(t	containerRtpathRtexisting_objectR((s@/usr/lib/python2.7/site-packages/salt/states/libcloud_storage.pytobject_present�s
cC@sbtd|||�}|dkr5ttd|i�Std|||�}t|d|i�SdS(u�
    Ensures a object is absent.

    :param container: Container name
    :type  container: ``str``

    :param name: Object name in cloud
    :type  name: ``str``

    :param profile: The profile key
    :type  profile: ``str``
    u%libcloud_storage.get_container_objectuObject already absentulibcloud_storage.delete_objectuDeleted objectN(RRRR(RRRRR((s@/usr/lib/python2.7/site-packages/salt/states/libcloud_storage.pyt
object_absent�s

cC@s/td|||||�}t|d|i�S(u�
    Ensures a object is downloaded locally.

    :param container: Container name
    :type  container: ``str``

    :param name: Object name in cloud
    :type  name: ``str``

    :param path: Local path to file
    :type  path: ``str``

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

    :param overwrite_existing: Replace if already exists
    :type  overwrite_existing: ``bool``
    u libcloud_storage.download_objectuDownloaded object(RR(RRRRtoverwrite_existingR((s@/usr/lib/python2.7/site-packages/salt/states/libcloud_storage.pytfile_present�s(t__doc__t
__future__RRRtloggingtsalt.utils.compatRt	getLoggerR	tlogRRRRRRRtFalseR (((s@/usr/lib/python2.7/site-packages/salt/states/libcloud_storage.pyt<module>As							

Zerion Mini Shell 1.0