@ -50,6 +50,10 @@ options:
- Filter only by IP address .
- Filter only by IP address .
type : bool
type : bool
default : false
default : false
object_type :
description :
- Type of the object to search . Must be a valid API resource name
type : str
"""
"""
EXAMPLES = """
EXAMPLES = """
@ -77,12 +81,13 @@ def get_object(module, connection):
uid = module . params [ ' uid ' ]
uid = module . params [ ' uid ' ]
object_filter = module . params [ ' object_filter ' ]
object_filter = module . params [ ' object_filter ' ]
ip_only = module . params [ ' ip_only ' ]
ip_only = module . params [ ' ip_only ' ]
object_type = module . params [ ' object_type ' ]
if uid :
if uid :
payload = { ' uid ' : uid }
payload = { ' uid ' : uid }
code , result = connection . send_request ( ' /web_api/show-object ' , payload )
code , result = connection . send_request ( ' /web_api/show-object ' , payload )
else :
else :
payload = { ' filter ' : object_filter , ' ip-only ' : ip_only }
payload = { ' filter ' : object_filter , ' ip-only ' : ip_only , ' type ' : object_type }
code , result = connection . send_request ( ' /web_api/show-objects ' , payload )
code , result = connection . send_request ( ' /web_api/show-objects ' , payload )
return code , result
return code , result
@ -91,8 +96,9 @@ def get_object(module, connection):
def main ( ) :
def main ( ) :
argument_spec = dict (
argument_spec = dict (
uid = dict ( type = ' str ' , default = None ) ,
uid = dict ( type = ' str ' , default = None ) ,
object_filter = dict ( type = ' str ' ) ,
object_filter = dict ( type = ' str ' , default = None ) ,
ip_only = dict ( type = ' bool ' , default = False )
ip_only = dict ( type = ' bool ' , default = False ) ,
object_type = dict ( type = ' str ' , default = None )
)
)
module = AnsibleModule ( argument_spec = argument_spec )
module = AnsibleModule ( argument_spec = argument_spec )