B
    ø±ô`„	  ã               @   sh   d dl mZmZmZ eZdZdZdZd dl	m
Z
 d dlmZ d dlmZ d dlmZ G d	d
„ d
e
ƒZdS )é    )Úabsolute_importÚdivisionÚprint_functionab  
lookup: skydive
short_description: Query Skydive objects
description:
- Uses the Skydive python REST client to return the queried object from Skydive network
  analyzer.
requirements:
- skydive-client
extends_documentation_fragment:
- community.skydive.skydive
options:
  filter:
    description: a dict object that is used to filter the return objects
aæ  
- name: return skydive metdata if present based on Name
  set_fact:
    skydive_meta: >-
        {{ lookup('community.skydive.skydive', filter={'query': "G.V().Has('Name', 'sumit-VirtualBox')"}) }}

- name: return all the skydive metdata having parameter Name
  set_fact:
    skydive: >-
        {{ lookup('community.skydive.skydive', filter={'query': "G.V().Has('Name')"},
                      provider={'endpoint': 'localhost:8082', 'username': 'admin', 'password': 'password'}) }}
za
_list:
  description:
    - The list of queried object metadata
  returned: always
  type: list
)Ú
LookupBase)Úskydive_lookup)Úto_text)ÚAnsibleErrorc               @   s   e Zd Zddd„ZdS )ÚLookupModuleNc       	   
   K   sd   |  di ¡}|  di ¡}yt|ƒ}| |¡}W n. tk
r\ } ztt|ƒƒ‚W d d }~X Y nX |gS )NÚproviderÚfilter)Úpopr   Zlookup_queryÚ	Exceptionr   r   )	ÚselfZtermsÚ	variablesÚkwargsr
   Zfilter_dataZskydive_objÚresultÚexc© r   úk/home/dcms/DCMS/lib/python3.7/site-packages/ansible_collections/community/skydive/plugins/lookup/skydive.pyÚrunE   s    zLookupModule.run)N)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r	   D   s   r	   N)Ú
__future__r   r   r   ÚtypeÚ__metaclass__ZDOCUMENTATIONZEXAMPLESZRETURNZansible.plugins.lookupr   ZNansible_collections.community.skydive.plugins.module_utils.network.skydive.apir   Zansible.module_utils._textr   Zansible.errorsr   r	   r   r   r   r   Ú<module>   s   