%PDF- %PDF-
| Direktori : /lib/python2.7/site-packages/salt/modules/ |
| Current File : //lib/python2.7/site-packages/salt/modules/msteams.pyo |
�
���^c @@ s� d Z d d l m Z m Z m Z d d l Z d d l Z d d l m Z d d l
Z e j e � Z
d Z d � Z d � Z d d d d � Z d S( uU
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
i ( t absolute_importt print_functiont unicode_literalsN( t SaltInvocationErroru msteamsc C@ s t S( uY
Return virtual name of the module.
:return: The virtual name of the module.
( t __virtualname__( ( ( s8 /usr/lib/python2.7/site-packages/salt/modules/msteams.pyt __virtual__ s c C@ s9 t d d � p t d d � } | s5 t d � � n | S( uK
Return hook_url from minion/master config file
or from pillar
u
config.getu msteams.hook_urlu msteams:hook_urlu No MS Teams hook_url found.( t __salt__R ( t hook_url( ( s8 /usr/lib/python2.7/site-packages/salt/modules/msteams.pyt
_get_hook_url( s
c C@ s� | s t � } n | s( t j d � n i | d 6| d 6| d 6} t j j j | d d d t j j j | � d t �} | d d
k r� t Si t
d 6| j d | d � d
6Sd S( u�
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"
u message is a required option.u textu titleu
themeColort methodu POSTt datat statusu statusi� u resu bodyu messageN( R t logt errort saltt utilst httpt queryt jsont dumpst Truet Falset get( t messageR t titlet theme_colort payloadt result( ( s8 /usr/lib/python2.7/site-packages/salt/modules/msteams.pyt post_card6 s"