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/utils/__pycache__/mattermost.cpython-310.pyc
o

�N�g
�@sHdZddlZddlZddlZddlZddlm	Z	e�
e�Zddd�Z
dS)ae
Library for interacting with Mattermost Incoming Webhooks
:configuration: This module can be used by specifying the name of a
    configuration profile in the minion config, minion pillar, or master
    config.
    For example:
    .. code-block:: yaml

        mattermost:
          hook: 3tdgo8restnxiykdx88wqtxryr
          api_url: https://example.com
�N)�__version__c	Cs�d}ddd�}tj�|d�}tj�|t|��}tjjj|||ddd�}|�dd�tj	j
kr7d	|�d
�|d<|S|�dd�tj	jkrCdSt�
|�t�
|�t�
|�d|vrp|d}d
|vrj|d
|d<d|d<|Sd|d<|Sd|d<d|d<|S)a3
    Mattermost object method function to construct and execute on the API URL.
    :param api_url:     The Mattermost API URL
    :param hook:        The Mattermost hook.
    :param data:        The data to be sent for POST method.
    :return:            The json response from the API call or False.
    �POST�T)�message�resz/hooks/)�data�decode�statusr	NzMessage posted z
 correctlyr�dict�errorFrzMessage not postedZinvalid_auth)�urllib�parse�urljoin�str�salt�utils�http�query�get�client�OK�
NO_CONTENT�log�debug)	�hookZapi_urlr�method�retZbase_url�url�resultZ_result�r�I/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/mattermost.pyrs0



�r)NNN)�__doc__�http.clientr�logging�urllib.parserZsalt.utils.httprZsalt.versionr�	getLogger�__name__rrrrrr �<module>s