diff --git a/changelogs/fragments/checkpoint-object-facts-type-param.yaml b/changelogs/fragments/checkpoint-object-facts-type-param.yaml new file mode 100644 index 0000000000..c501106788 --- /dev/null +++ b/changelogs/fragments/checkpoint-object-facts-type-param.yaml @@ -0,0 +1,3 @@ +--- +minor_changes: + - "add parameter to checkpoint_object_facts to filter out by object type" diff --git a/lib/ansible/modules/network/checkpoint/checkpoint_object_facts.py b/lib/ansible/modules/network/checkpoint/checkpoint_object_facts.py index 96bbd175b0..096f56f91e 100644 --- a/lib/ansible/modules/network/checkpoint/checkpoint_object_facts.py +++ b/lib/ansible/modules/network/checkpoint/checkpoint_object_facts.py @@ -50,6 +50,10 @@ options: - Filter only by IP address. type: bool default: false + object_type: + description: + - Type of the object to search. Must be a valid API resource name + type: str """ EXAMPLES = """ @@ -77,12 +81,13 @@ def get_object(module, connection): uid = module.params['uid'] object_filter = module.params['object_filter'] ip_only = module.params['ip_only'] + object_type = module.params['object_type'] if uid: payload = {'uid': uid} code, result = connection.send_request('/web_api/show-object', payload) 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) return code, result @@ -91,8 +96,9 @@ def get_object(module, connection): def main(): argument_spec = dict( uid=dict(type='str', default=None), - object_filter=dict(type='str'), - ip_only=dict(type='bool', default=False) + object_filter=dict(type='str', default=None), + ip_only=dict(type='bool', default=False), + object_type=dict(type='str', default=None) ) module = AnsibleModule(argument_spec=argument_spec)