%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python2.7/site-packages/salt/sdb/
Upload File :
Create Path :
Current File : //lib/python2.7/site-packages/salt/sdb/rest.pyc

�
���^c@@s�dZddlmZmZmZddlZddlZddlj	j
Z
ddlmZej
e�Zidd6Zddd�Zddd�Zdddd	�ZdS(
uG
Generic REST API SDB Module

:maintainer:    SaltStack
:maturity:      New
:platform:      all

.. versionadded:: 2015.8.0

This module allows access to a REST interface using an ``sdb://`` URI.

Like all REST modules, the REST module requires a configuration profile to
be configured in either the minion or master configuration file. This profile
requires very little. In the example:

.. code-block:: yaml

    my-rest-api:
      driver: rest
      urls:
        url: https://api.github.com/
      keys:
        url: https://api.github.com/users/{{user}}/keys
        backend: requests

The ``driver`` refers to the REST module, and must be set to ``rest`` in order
to use this driver. Each of the other items inside this block refers to a
separate set of HTTP items, including a URL and any options associated with it.
The options used here should match the options available in
``salt.utils.http.query()``.

In order to call the ``urls`` item in the example, the following reference can
be made inside a configuration file:

.. code-block:: yaml

    github_urls: sdb://my-rest-api/urls

Key/Value pairs may also be used with this driver, and merged into the URL using
the configured renderer (``jinja``, by default). For instance, in order to use
the ``keys`` item in the example, the following reference can be made:

.. code-block:: yaml

    github_urls: sdb://my-rest-api/keys?user=myuser

This will cause the following URL to actually be called:

.. code-block:: yaml

    https://api.github.com/users/myuser/keys

Key/Value pairs will NOT be passed through as GET data. If GET data needs to be
sent to the URL, then it should be configured in the SDB configuration block.
For instance:

.. code-block:: yaml

    another-rest-api:
      driver: rest
      user_data:
        url: https://api.example.com/users/
        params:
          user: myuser
i(tabsolute_importtprint_functiontunicode_literalsN(tcompile_templateusetuset_cC@st||||�S(u4
    Set a key/value pair in the REST interface
    (tquery(tkeytvaluetservicetprofile((s1/usr/lib/python2.7/site-packages/salt/sdb/rest.pytset_SscC@st|d||�S(u-
    Get a value from the REST interface
    N(RtNone(RRR((s1/usr/lib/python2.7/site-packages/salt/sdb/rest.pytgetZsc	C@s&|jd�}|d}i}x:|djd�D]%}|jd�\}}|||<q3Wtjdd�}	tjjti�}
tjd�}tjd	�}td
|
|	||d||d|�}
i}x3||D]'}|dkr�|||||<q�q�Wtj|
dt	|�}|dS(u-
    Get a value from the REST interface
    u?iiu&u=urendereru
jinja|yamlurenderer_blacklisturenderer_whitelistu:string:t
input_datauurlubackendtdecodeudict(ubackenduurl(
tsplitt__opts__RtsalttloadertrenderRthttpRtTrue(RRRRtcompstkey_varstpairtpair_keytpair_valtrenderertrendt	blacklistt	whitelistturltextrastitemtresult((s1/usr/lib/python2.7/site-packages/salt/sdb/rest.pyRas6
		(t__doc__t
__future__RRRtloggingtsalt.loaderRtsalt.utils.httptutilsRt
salt.templateRt	getLoggert__name__tlogt__func_alias__R
R	RR(((s1/usr/lib/python2.7/site-packages/salt/sdb/rest.pyt<module>Bs


Zerion Mini Shell 1.0