Anons79 Mini Shell

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

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
mZddlm
Z
d
�Zd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontstableinterfacetstatust	communitytsupported_bys�
---
module: cisco_spark
short_description: Send a message to a Cisco Spark Room or Individual.
description:
    - Send a message to a Cisco Spark Room or Individual with options to control the formatting.
version_added: "2.3"
author: Drew Rusell (@drew-russell)
notes:
  - The C(recipient_id) type must be valid for the supplied C(recipient_id).
  - Full API documentation can be found at U(https://developer.ciscospark.com/endpoint-messages-post.html).

options:

  recipient_type:
    description:
       - The request parameter you would like to send the message to.
       - Messages can be sent to either a room or individual (by ID or E-Mail).
    required: True
    choices: ['roomId', 'toPersonEmail', 'toPersonId']

  recipient_id:
    description:
      - The unique identifier associated with the supplied C(recipient_type).
    required: true

  message_type:
    description:
       - Specifies how you would like the message formatted.
    required: False
    default: text
    choices: ['text', 'markdown']

  personal_token:
    description:
      - Your personal access token required to validate the Spark API.
    required: true
    aliases: ['token']

  message:
    description:
      - The message you would like to send.
    required: True
s�
# Note: The following examples assume a variable file has been imported
# that contains the appropriate information.

- name: Cisco Spark - Markdown Message to a Room
  cisco_spark:
    recipient_type: roomId
    recipient_id: "{{ room_id }}"
    message_type: markdown
    personal_token: "{{ token }}"
    message: "**Cisco Spark Ansible Module - Room Message in Markdown**"

- name: Cisco Spark - Text Message to a Room
  cisco_spark:
    recipient_type: roomId
    recipient_id: "{{ room_id }}"
    message_type: text
    personal_token: "{{ token }}"
    message: "Cisco Spark Ansible Module - Room Message in Text"

- name: Cisco Spark - Text Message by an Individuals ID
  cisco_spark:
    recipient_type: toPersonId
    recipient_id: "{{ person_id}}"
    message_type: text
    personal_token: "{{ token }}"
    message: "Cisco Spark Ansible Module - Text Message to Individual by ID"

- name: Cisco Spark - Text Message by an Individuals E-Mail Address
  cisco_spark:
    recipient_type: toPersonEmail
    recipient_id: "{{ person_email }}"
    message_type: text
    personal_token: "{{ token }}"
    message: "Cisco Spark Ansible Module - Text Message to Individual by E-Mail"

s�
status_code:
  description:
    - The Response Code returned by the Spark API.
    - Full Response Code explanations can be found at U(https://developer.ciscospark.com/endpoint-messages-post.html).
  returned: always
  type: int
  sample: 200

message:
    description:
      - The Response Message returned by the Spark API.
      - Full Response Code explanations can be found at U(https://developer.ciscospark.com/endpoint-messages-post.html).
    returned: always
    type: str
    sample: OK (585 bytes)
(t
AnsibleModule(t	fetch_urlc
C`si}|j}idj|d�d6dd6}|jrHd}d}n9d}i|d|d	6|d
|d6}|j|�}t||d|d
|�\}}|d}|d}	|dkr�t|d<||d<|	|d
<n4t|d<||d<|jr
d|d
<n
|	|d
<|S(s� When check mode is specified, establish a read only connection, that does not return any user specific
    data, to validate connectivity. In regular mode, send a message to a Cisco Spark Room or Individuals
Bearer {0}tpersonal_tokent
Authorizationsapplication/jsonscontent-types'https://api.ciscospark.com/v1/people/mes&https://api.ciscospark.com/v1/messagestrecipient_idtrecipient_typetmessagetmessage_typetdatatheadersRtmsgi�tfailedtstatus_codesAuthentication Successful.N(tparamstformatt
check_modetNonetjsonifyR	tTruetFalse(
tmoduletresultstansibleRturltpayloadtresponsetinfoRR((sL/usr/lib/python2.7/site-packages/ansible/modules/notification/cisco_spark.pyt
spark_messagexs4	
		!






	

cC`s�tdtdtdtddddg�dtdtd	t�d
tdtddgd
dgdddg�dtdtd	td
dg�dtdt��dt�}t|�}|j|�dS(sAnsible main. t
argument_specR
trequiredtchoicestroomIdt
toPersonEmailt
toPersonIdRtno_logRtdefaultttexttaliasesttypetmarkdownR
ttokenRtsupports_check_modeN(RtdictRRR#t	exit_json(RR((sL/usr/lib/python2.7/site-packages/ansible/modules/notification/cisco_spark.pytmain�s	t__main__N(t
__future__RRRR.t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNtansible.module_utils.basicRtansible.module_utils.urlsR	R#R4t__name__(((sL/usr/lib/python2.7/site-packages/ansible/modules/notification/cisco_spark.pyt<module>s


.&	1	

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