Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/notification/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/notification/catapult.pyo

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlmZdd
l
mZd�Zd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys�
---
module: catapult
version_added: 2.4
short_description: Send a sms / mms using the catapult bandwidth api
description:
     - Allows notifications to be sent using sms / mms via the catapult bandwidth api.
options:
  src:
    description:
      - One of your catapult telephone numbers the message should come from (must be in E.164 format, like C(+19195551212)).
    required: true
  dest:
    description:
      - The phone number or numbers the message should be sent to (must be in E.164 format, like C(+19195551212)).
    required: true
  msg:
    description:
      - The contents of the text message (must be 2048 characters or less).
    required: true
  media:
    description:
      - For MMS messages, a media url to the location of the media to be sent with the message.
  user_id:
    description:
      - User Id from Api account page.
    required: true
  api_token:
    description:
      - Api Token from Api account page.
    required: true
  api_secret:
    description:
      - Api Secret from Api account page.
    required: true

author: "Jonathan Mainguy (@Jmainguy)"
notes:
    - Will return changed even if the media url is wrong.
    - Will return changed if the destination number is invalid.

s
- name: Send a mms to multiple users
  catapult:
    src: "+15035555555"
    dest:
      - "+12525089000"
      - "+12018994225"
    media: "http://example.com/foobar.jpg"
    msg: "Task is complete"
    user_id: "{{ user_id }}"
    api_token: "{{ api_token }}"
    api_secret: "{{ api_secret }}"

- name: Send a sms to a single user
  catapult:
    src: "+15035555555"
    dest: "+12018994225"
    msg: "Consider yourself notified"
    user_id: "{{ user_id }}"
    api_token: "{{ api_token }}"
    api_secret: "{{ api_secret }}"

sv
changed:
    description: Whether the api accepted the message.
    returned: always
    type: bool
    sample: True
N(t
AnsibleModule(t	fetch_urlc	C`s�d}d|}	i|d6|d6|d6}
|r>||
d<ni|d6dd	6}|jd
d�|jd<|jd
d�|jd
<t||	dtj|
�d|dd�S(s
    Send the message
    tAnsibles6https://api.catapult.inetwork.com/v1/users/%s/messagestfromttottexttmedias
User-Agentsapplication/jsonsContent-types
tturl_usernameturl_passwordtdatatheaderstmethodtpost(treplacetparamsR	tjsontdumps(tmoduletsrctdesttmsgRtuser_idt	api_tokent
api_secrettAGENTtURIRR((sI/usr/lib/python2.7/site-packages/ansible/modules/notification/catapult.pytsendds

cC`s�tdtdtdt�dtdtdd�dtdt�dtdt�d	tdtd
t�dtdtd
t�dtd
ddt���}|jd}|jd}|jd}|jd}|jd}|jd	}|jd}xu|D]m}t||||||||�\}	}
|
ddkr�tj|
d�}|d}|j	d|�q�q�Wt}
|j
d|
�dS(Nt
argument_specRtrequiredRttypetlistRRRtno_logR RtdefaultRi�tbodytmessagetchanged(RtdicttTruetNonetFalseRR#Rtloadst	fail_jsont	exit_json(RRRRRRRR tnumbertrctinfoR*tfail_msgR,((sI/usr/lib/python2.7/site-packages/ansible/modules/notification/catapult.pytmainws0







'
t__main__(t
__future__RRRR&t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNRtansible.module_utils.basicRtansible.module_utils.urlsR	R#R8t__name__(((sI/usr/lib/python2.7/site-packages/ansible/modules/notification/catapult.pyt<module>	s


,		 

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]