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__/restconf.cpython-310.pyc
o

�N�g��@sLdZddlZdgZdZe�e�Zdd�Zdd�Zdd	�Z	d
d�Z
dd
�ZdS)z�
Execution module for RESTCONF Proxy minions

:codeauthor: Jamie (Bear) Murphy <jamiemurphyit@gmail.com>
:maturity:   new
:platform:   any

�NZrestconfcCs(t�di��d�tkrddt��fSdS)N�proxyZ	proxytypeFzProxytype does not match: T)Z__opts__�get�__virtualname__�rr�I/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/restconf.py�__virtual__srcCstdd�S)z|
    Returns the RESTCONF capabilities PATH

    CLI Example:

    .. code-block:: bash

        salt '*' restconf.info
    �restconf.requestzMrestconf/data/ietf-restconf-monitoring:restconf-state/capabilities/capability�Z	__proxy__rrrr�infos
�r
cCstd|�S)a�
    Returns an object containing the content of the request path with a GET request.
    Data returned will contain a dict with at minimum a key of "status" containing the http status code
    Other keys that should be available error (if http error), body, dict (parsed json to dict)

    CLI Example:

    .. code-block:: bash

        salt '*' restconf.get_data restconf/yang-library-version
    rr	)�pathrrr�get_data'srcCstd|||�S)a
    Sends a post/patch/other type of rest method to a specified path with the specified method with specified payload

    CLI Example:

    .. code-block:: bash

        salt '*' restconf.set_data restconf/yang-library-version method=PATCH dict_payload=""
    rr	)r�methodZdict_payloadrrr�set_data6s
rcCs�ddi}t�d�td|�}|ddkr.t�d�|d}d	|d<d
|d<||d<||d
<|ds[|dur[td|�}|ddvr[t�d�|d}d	|d<d|d<||d<||d
<|dsht�d�d|d<|S)aI
    Used to check which path responds with a 200 status
    Returns an array of True/False and a dict with keys path + path_method + response data, used in states code.

    CLI Example:

    .. code-block:: bash

        salt '*' restconf.path_check restconf/yang-library-version/specifc_item restconf/yang-library-version
    �resultFzAmodules_restconf_path_check: about to attempt to get primary pathzrestconf.get_data�status��z?modules_restconf_path_check: found a valid path at primary_path�dictTZprimaryZ	path_usedZrequest_pathZrequest_restponseN)rz<modules_restconf_path_check: found a valid path at init_path�initzYmodules_restconf_path_check: restconf could not find a working path to get initial config)�log�debugZ__salt__)Zprimary_pathZ	init_path�retZexisting_raw�existingZexisting_raw_initrrr�
path_checkCs8

��r)�__doc__�loggingZ__proxyenabled__r�	getLogger�__file__rrr
rrrrrrr�<module>s