Anons79 Mini Shell

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

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
mZddlm
Z
dd
lmZyddlZWnek
r�nXdefd��YZd�Zd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bysr
---
module: snow_record_find
short_description: Search for multiple records from ServiceNow
version_added: "2.9"
description:
    - Gets multiple records from a specified table from ServiceNow based on a query dictionary.
options:
    table:
      description:
      - Table to query for records.
      type: str
      required: false
      default: incident
    query:
      description:
      - Dict to query for records.
      type: dict
      required: true
    max_records:
      description:
      - Maximum number of records to return.
      type: int
      required: false
      default: 20
    order_by:
      description:
      - Field to sort the results on.
      - Can prefix with "-" or "+" to change descending or ascending sort order.
      type: str
      default: "-created_on"
      required: false
    return_fields:
      description:
      - Fields of the record to return in the json.
      - By default, all fields will be returned.
      type: list
      required: false
requirements:
    - python pysnow (pysnow)
author:
    - Tim Rightnour (@garbled1)
extends_documentation_fragment: service_now.documentation
s

- name: Search for incident assigned to group, return specific fields
  snow_record_find:
    username: ansible_test
    password: my_password
    instance: dev99999
    table: incident
    query:
      assignment_group: d625dccec0a8016700a222a0f7900d06
    return_fields:
      - number
      - opened_at

- name: Using OAuth, search for incident assigned to group, return specific fields
  snow_record_find:
    username: ansible_test
    password: my_password
    client_id: "1234567890abcdef1234567890abcdef"
    client_secret: "Password1!"
    instance: dev99999
    table: incident
    query:
      assignment_group: d625dccec0a8016700a222a0f7900d06
    return_fields:
      - number
      - opened_at

- name: Find open standard changes with my template
  snow_record_find:
    username: ansible_test
    password: my_password
    instance: dev99999
    table: change_request
    query:
      AND:
        equals:
          active: "True"
          type: "standard"
          u_change_stage: "80"
        contains:
          u_template: "MY-Template"
    return_fields:
      - sys_id
      - number
      - sys_created_on
      - sys_updated_on
      - u_template
      - active
      - type
      - u_change_stage
      - sys_created_by
      - description
      - short_description
s�
record:
    description: The full contents of the matching ServiceNow records as a list of records.
    type: dict
    returned: always
(t
AnsibleModule(tServiceNowClient(t	to_nativeNt
BuildQuerycB`sDeZdZd�Zd�Zd�Zd�Zd�Zd�ZRS(sw
    This is a BuildQuery manipulation class that constructs
    a pysnow.QueryBuilder object based on data input.
    cC`s�||_dddg|_i|jd6|jd6|jd6|jd6|jd6|jd	6|jd
6|jd6|_|jj�|_t|_t|_	|j
d|_dS(
NtANDtORtNQtequalst
not_equalstcontainstnot_containststarts_witht	ends_withtgreater_thant	less_thantquery(tmoduletlogic_operatorst_condition_closuretcondition_operatortkeystaccepted_cond_opstFalsetappend_operatortTruetsimple_querytparamstdata(tselfR((sQ/usr/lib/python2.7/site-packages/ansible/modules/notification/snow_record_find.pyt__init__�s	






		cC`s*|jj|�t|j|�|�dS(N(tqbtfieldtgetattr(R$tcondtquery_fieldtquery_value((sQ/usr/lib/python2.7/site-packages/ansible/modules/notification/snow_record_find.pyR�scC`s�t|t�rnxo|j�D]K\}}|jrGt|j|��n|j||||�t|_qWn|jj	dd�dS(Ntmsgs"Query is not in a supported format(
t
isinstancetdicttitemsRR(R&RR Rt	fail_json(R$R#tlogic_optcond_opR*R+((sQ/usr/lib/python2.7/site-packages/ansible/modules/notification/snow_record_find.pyt_iterate_fields�s	cC`s�t|t�rx�|j�D]\\}}||jkrM|j|||�q|jjddjt|j	j
����qWn+|jjddjt|j	j
����dS(NR,sSupported conditions: {0}(R-R.R/RR3RR0tformattstrRR(R$R#R1R2tfields((sQ/usr/lib/python2.7/site-packages/ansible/modules/notification/snow_record_find.pyt_iterate_conditions�s2cC`s�t|t�r�x�|j�D]n\}}||jkrSt|_|j||�q|jrw|jdd||�Pq|jj	dd�qWn%|jj	ddj
t|j���dS(NRR,s"Query is not in a supported formatsSupported operators: {0}(R-R.R/RRR!R7RRR0R4R5(R$R#R1R2((sQ/usr/lib/python2.7/site-packages/ansible/modules/notification/snow_record_find.pyt_iterate_operators�s		cC`s&tj�|_|j|j�|jS(N(tpysnowtQueryBuilderR&R8R#(R$((sQ/usr/lib/python2.7/site-packages/ansible/modules/notification/snow_record_find.pytbuild_query�s(	t__name__t
__module__t__doc__R%RR3R7R8R;(((sQ/usr/lib/python2.7/site-packages/ansible/modules/notification/snow_record_find.pyR�s			
	
	cC`sytj�}|jdtdddtdd�dtdddt�d	tdd
dddt�dtdd
dddt�dtdddddt��ddgg}td|dtd|�}t|�}|j�|j	}|j
}|d}|d}|d}|d	}	|d}
tdtd|d|d|d	|	d|
�}y�t|�}|j�}
|j
d|j
dd|
�}|j
ddk	r�|jd|j
dd|j
d	d|j
dg�}n)|jd|j
d	d|j
dg�}Wn5tk
r/}|jddjt|��|�nXyt|�|d<Wn!tjjk
rgg|d<nX|j|�dS(NttablettypeR5trequiredtdefaulttincidentRR.tmax_recordsitinttorder_bys-created_ont
return_fieldstlistt	client_idt
client_secrett
argument_spectsupports_check_modetrequired_togethertinstancetchangedR6tlimitR,sFailed to find record: {0}trecord(R	tsnow_argument_spectupdateR.RR tNoneRtlogintconnR"RR;Rtget_multiplet	ExceptionR0R4R
RHR9t
exceptionst	NoResultst	exit_json(tmodule_argstmodule_required_togetherRtservice_now_clientRVR"RNR?RRDRGtresulttbqR&RQtrestdetail((sQ/usr/lib/python2.7/site-packages/ansible/modules/notification/snow_record_find.pyt
run_module�s\		
		




		
&cC`st�dS(N(Rc(((sQ/usr/lib/python2.7/site-packages/ansible/modules/notification/snow_record_find.pytmainst__main__(t
__future__RRRR@t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNtansible.module_utils.basicRt ansible.module_utils.service_nowR	tansible.module_utils._textR
R9tImportErrortobjectRRcRdR<(((sQ/usr/lib/python2.7/site-packages/ansible/modules/notification/snow_record_find.pyt<module>s(

.7
D	B	

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