%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/modules/mandrill.pyc

�
���^c@@s�dZddlmZmZmZddlZddlZddlZyddl	Z	e
ZWnek
rue
ZnXdZeje�ZdZdZd�Zd�Zdddd	�Zd
�Zd�Zddd�Ze
dddddd
�ZdS(u&
Mandrill
========

Send out emails using the Mandrill_ API_.

.. _Mandrill: https://mandrillapp.com
.. _API: https://mandrillapp.com/api/docs/

In the minion configuration file, the following block is required:

.. code-block:: yaml

  mandrill:
    key: <API_KEY>

.. versionadded:: 2018.3.0
i(tabsolute_importtprint_functiontunicode_literalsNumandrilluhttps://mandrillapp.com/apiicC@sttkrtdfStS(u2
    Return the execution module virtualname.
    uIThe requests python package is required for the mandrill execution module(tHAS_REQUESTStFalset__virtualname__(((s9/usr/lib/python2.7/site-packages/salt/modules/mandrill.pyt__virtual__,s
cC@sitd6dd6dd6S(u&
    Default dictionary returned.
    uresultuucommentuoutN(RtNone(((s9/usr/lib/python2.7/site-packages/salt/modules/mandrill.pyt_default_ret5scC@sqtdd�}|si}ni|p:|jd�p:td6|pP|jd�d6|pl|jd�pltd6S(u7
    Retrieve the API params from the config file.
    uconfig.mergeumandrilluapi_urlukeyuapi_keyuapi_version(t__salt__tgettBASE_URLtDEFAULT_VERSION(tapi_urltapi_versiontapi_keytmandrill_cfg((s9/usr/lib/python2.7/site-packages/salt/modules/mandrill.pyt_get_api_params@s	cC@s"djd|dt|�d|�S(u
    Build the API URL.
    u{url}/{version}/{method}.jsonturltversiontmethod(tformattfloat(RR
R((s9/usr/lib/python2.7/site-packages/salt/modules/mandrill.pyt_get_urlPscC@sidd6dd6S(u<
    Return HTTP headers required for the Mandrill API.
    uapplication/jsonucontent-typeuMandrill-Python/1.0.57u
user-agent((((s9/usr/lib/python2.7/site-packages/salt/modules/mandrill.pyt_get_headers[scC@s%|st�}ntj�}tjd|�|j|d|dtjjj	|��}|j�}t
�}tjd|j�tjd�tj|�|jdkr|jdkr�|jdd	�|d
<||d<|S|j
i|jdd	�d
6�|S|j
itd
6|j�d6�|S(uE
    Make the HTTP request and return the body as python object.
    uQuerying %stheaderstdatauStatus code: %duResponse body:i�i�umessageuucommentuoutuerroruresult(RtrequeststsessiontlogtdebugtposttsalttutilstjsontdumpsRtstatus_codetpoptupdateR
tTrue(RRRRtreqtreq_bodytret((s9/usr/lib/python2.7/site-packages/salt/modules/mandrill.pyt
_http_requestes0	


		cK@s�d|kr5tjjjdd�t|d�}ntd|d|d|�}tdd|dd|d	�}	i|d
d6|d6|d6|d
6|d6}
t|	d|
�S(u�
    Send out the email using the details from the ``message`` argument.

    message
        The information on the message to send. This argument must be
        sent as dictionary with at fields as specified in the Mandrill API
        documentation.

    asynchronous: ``False``
        Enable a background sending mode that is optimized for bulk sending.
        In asynchronous mode, messages/send will immediately return a status of
        "queued" for every recipient. To handle rejections when sending in asynchronous
        mode, set up a webhook for the 'reject' event. Defaults to false for
        messages with no more than 10 recipients; messages with more than 10
        recipients are always sent asynchronously, regardless of the value of
        asynchronous.

    ip_pool
        The name of the dedicated ip pool that should be used to send the
        message. If you do not have any dedicated IPs, this parameter has no
        effect. If you specify a pool that does not exist, your default pool
        will be used instead.

    send_at
        When this message should be sent as a UTC timestamp in
        ``YYYY-MM-DD HH:MM:SS`` format. If you specify a time in the past,
        the message will be sent immediately. An additional fee applies for
        scheduled email, and this feature is only available to accounts with a
        positive balance.

    .. note::
        Fur further details please consult the `API documentation <https://mandrillapp.com/api/docs/messages.dart.html>`_.

    CLI Example:

    .. code-block:: bash

        $ salt '*' mandrill.send message="{'subject': 'Hi', 'from_email': 'test@example.com', 'to': [{'email': 'recv@example.com', 'type': 'to'}]}"

    ``message`` structure example (as YAML for readability):

    .. code-block:: yaml

        message:
            text: |
                This is the body of the email.
                This is the second line.
            subject: Email subject
            from_name: Test At Example Dot Com
            from_email: test@example.com
            to:
              - email: recv@example.com
                type: to
                name: Recv At Example Dot Com
              - email: cc@example.com
                type: cc
                name: CC At Example Dot Com
            important: true
            track_clicks: true
            track_opens: true
            attachments:
              - type: text/x-yaml
                name: yaml_file.yml
                content: aV9hbV9zdXBlcl9jdXJpb3VzOiB0cnVl

    Output example:

    .. code-block:: bash

        minion:
            ----------
            comment:
            out:
                |_
                  ----------
                  _id:
                      c4353540a3c123eca112bbdd704ab6
                  email:
                      recv@example.com
                  reject_reason:
                      None
                  status:
                      sent
            result:
                True
    uasyncuSodiumuXParameter "async" is renamed to "asynchronous" and will be removed in version {version}.R
RRu
messages/senduapi_urluapi_versionuapi_keyukeyumessageuip_poolusend_atR(R R!tversionst
warn_untiltboolRRR+(tmessagetasynchronoustip_pooltsend_atR
RRtkwargstparamsRR((s9/usr/lib/python2.7/site-packages/salt/modules/mandrill.pytsend�s ^		


(t__doc__t
__future__RRRtloggingtsalt.utils.jsonR tsalt.utils.versionsRR'RtImportErrorRRt	getLoggert__file__RRRRRRRRRR+R5(((s9/usr/lib/python2.7/site-packages/salt/modules/mandrill.pyt<module>s8


					&

Zerion Mini Shell 1.0