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

�N�gt�@sLdZddlZddlZddlmZe�e�ZdZ	dd�Z
dd�Zdd	d
�ZdS)aU
Module for sending messages to MS Teams

.. versionadded:: 2017.7.0

:configuration: This module can be used by either passing a hook_url
    directly or by specifying it in a configuration profile in the salt
    master/minion config. For example:

.. code-block:: yaml

    msteams:
      hook_url: https://outlook.office.com/webhook/837
�N)�SaltInvocationErrorZmsteamscCstS)zY
    Return virtual name of the module.
    :return: The virtual name of the module.
    )�__virtualname__�rr�H/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/msteams.py�__virtual__srcCs(tdd�ptdd�}|std��|S)zK
    Return hook_url from minion/master config file
    or from pillar
    z
config.getzmsteams.hook_urlzmsteams:hook_urlzNo MS Teams hook_url found.)Z__salt__r)�hook_urlrrr�
_get_hook_url"s�rcCst|st�}|st�d�|||d�}ddi}tjjj|d|tjj�|�dd�}|dd	kr/dSd
|�	d|d�d�S)
a�
    Send a message to an MS Teams channel.
    :param message:     The message to send to the MS Teams channel.
    :param hook_url:    The Teams webhook URL, if not specified in the configuration.
    :param title:       Optional title for the posted card
    :param theme_color:  Optional hex color highlight for the posted card
    :return:            Boolean if message was sent successfully.

    CLI Example:

    .. code-block:: bash

        salt '*' msteams.post_card message="Build is done"
    zmessage is a required option.)�text�titleZ
themeColorzContent-Typezapplication/json�POSTT)�methodZheader_dict�data�statusr��F�body)�res�message)
r�log�error�salt�utils�http�query�json�dumps�get)rrr
Ztheme_color�payload�headers�resultrrr�	post_card1s"
��r)NNN)
�__doc__�loggingZsalt.utils.jsonrZsalt.exceptionsr�	getLogger�__name__rrrrrrrrr�<module>s