diff options
Diffstat (limited to 'ansible_collections/check_point/mgmt')
436 files changed, 32822 insertions, 8597 deletions
diff --git a/ansible_collections/check_point/mgmt/CHANGELOG.rst b/ansible_collections/check_point/mgmt/CHANGELOG.rst index f81db85a4..62bd9645d 100644 --- a/ansible_collections/check_point/mgmt/CHANGELOG.rst +++ b/ansible_collections/check_point/mgmt/CHANGELOG.rst @@ -4,6 +4,214 @@ Check_Point.Mgmt Release Notes .. contents:: Topics +v5.2.3 +====== + +Release Summary +--------------- + +This is release 5.2.3 of ``check_point.mgmt``, released on 2024-03-04. + +v5.2.2 +====== + +Release Summary +--------------- + +This is release 5.2.2 of ``check_point.mgmt``, released on 2024-01-28. + +v5.2.1 +====== + +Release Summary +--------------- + +This is release 5.2.1 of ``check_point.mgmt``, released on 2024-01-16 + +v5.2.0 +====== + +Release Summary +--------------- + +This is release 5.2.0 of ``check_point.mgmt``, released on 2024-01-10. + +Minor Changes +------------- + +- New resource modules for R81.20 JHF Take 43 + +New Modules +----------- + +- check_point.mgmt.cp_mgmt_add_central_license - Add central license. +- check_point.mgmt.cp_mgmt_central_license_facts - Get central-license objects facts on Checkpoint over Web Services API. +- check_point.mgmt.cp_mgmt_delete_central_license - Delete central license. +- check_point.mgmt.cp_mgmt_distribute_cloud_licenses - Distribute licenses to target CloudGuard gateways. +- check_point.mgmt.cp_mgmt_show_cloud_licenses_usage - Show attached licenses usage. +- check_point.mgmt.cp_mgmt_show_ha_status - Retrieve domain high availability status. + +v5.1.3 +====== + +Release Summary +--------------- + +This is release 5.1.3 of ``check_point.mgmt``, released on 2023-12-13. + +Bugfixes +-------- + +- httpapi/checkpoint.py - Raise a fatal error if login wasn't successful. + +v5.1.2 +====== + +Release Summary +--------------- + +This is release 5.1.2 of ``check_point.mgmt``, released on 2023-12-12. + +Minor Changes +------------- + +- meta/runtime.yml - update minimum Ansible version required to 2.14.0. + +v5.1.1 +====== + +Release Summary +--------------- + +This is release 5.1.1 of ``check_point.mgmt``, released on 2023-05-25. + +Bugfixes +-------- + +- module_utils/checkpoint.py - fixed compile issue (Syntax Error) on python 2.7 + +v5.1.0 +====== + +Release Summary +--------------- + +This is release 5.1.0 of ``check_point.mgmt``, released on 2023-05-18. + +Minor Changes +------------- + +- cp_mgmt_vpn_community_star - new fields added. +- show command modules - no longer return result of changed=True. + +Bugfixes +-------- + +- cp_mgmt_access_rules - split vpn param that can accept either a String or list of objects to two + +v5.0.0 +====== + +Release Summary +--------------- + +This is release 5.0.0 of ``check_point.mgmt``, released on 2023-04-17. + +Deprecated Features +------------------- + +- add/set/delete nat-rule modules - will be replaced by the single cp_mgmt_nat_rule module. +- cp_mgmt_show_task/s modules - will be replaced by the by the single cp_mgmt_task_facts module. + +New Modules +----------- + +- check_point.mgmt.cp_mgmt_abort_get_interfaces - Attempt to abort an on-going "get-interfaces" operation. +- check_point.mgmt.cp_mgmt_access_layers - Manages ACCESS LAYERS resource module +- check_point.mgmt.cp_mgmt_access_point_name - Manages access-point-name objects on Checkpoint over Web Services API +- check_point.mgmt.cp_mgmt_access_point_name_facts - Get access-point-name objects facts on Checkpoint over Web Services API +- check_point.mgmt.cp_mgmt_add_repository_package - Add the software package to the central repository. +- check_point.mgmt.cp_mgmt_add_updatable_object - Import an updatable object from the repository to the management server. +- check_point.mgmt.cp_mgmt_checkpoint_host - Manages checkpoint-host objects on Checkpoint over Web Services API +- check_point.mgmt.cp_mgmt_checkpoint_host_facts - Get checkpoint-host objects facts on Checkpoint over Web Services API +- check_point.mgmt.cp_mgmt_delete_repository_package - Delete the repository software package from the central repository. +- check_point.mgmt.cp_mgmt_delete_updatable_object - Delete existing object using object name or uid. +- check_point.mgmt.cp_mgmt_dynamic_global_network_object - Manages dynamic-global-network-object objects on Checkpoint over Web Services API +- check_point.mgmt.cp_mgmt_dynamic_global_network_object_facts - Get dynamic-global-network-object objects facts on Checkpoint over Web Services API +- check_point.mgmt.cp_mgmt_export_management - Export the primary Security Management Server database or the primary Multi-Domain Server database or the single Domain database and the applicable Check Point configuration. + +- check_point.mgmt.cp_mgmt_export_smart_task - Export SmartTask to a file. +- check_point.mgmt.cp_mgmt_get_attachment - Retrieves a packet capture or blob data, according to the attributes of a log record. +- check_point.mgmt.cp_mgmt_get_interfaces - Get physical interfaces with or without their topology from a Gaia Security Gateway or Cluster. +- check_point.mgmt.cp_mgmt_gsn_handover_group - Manages gsn-handover-group objects on Checkpoint over Web Services API +- check_point.mgmt.cp_mgmt_gsn_handover_group_facts - Get gsn-handover-group objects facts on Checkpoint over Web Services API +- check_point.mgmt.cp_mgmt_ha_full_sync - Perform full sync from active server to standby peer. +- check_point.mgmt.cp_mgmt_hosts - Manages HOSTS resource module +- check_point.mgmt.cp_mgmt_https_layer - Manages https-layer objects on Checkpoint over Web Services API +- check_point.mgmt.cp_mgmt_https_layer_facts - Get https-layer objects facts on Checkpoint over Web Services API +- check_point.mgmt.cp_mgmt_import_management - Import the primary Security Management Server database or the primary Multi-Domain Server database or the single Domain database and the applicable Check Point configuration. + +- check_point.mgmt.cp_mgmt_import_smart_task - Import SmartTask from a file. +- check_point.mgmt.cp_mgmt_ips_protection_extended_attribute_facts - Get ips-protection-extended-attribute objects facts on Checkpoint over Web Services API +- check_point.mgmt.cp_mgmt_lock_object - Lock object using uid or {name and type}. +- check_point.mgmt.cp_mgmt_lsv_profile - Manages lsv-profile objects on Checkpoint over Web Services API +- check_point.mgmt.cp_mgmt_lsv_profile_facts - Get lsv-profile objects facts on Checkpoint over Web Services API +- check_point.mgmt.cp_mgmt_nat_rule - Manages nat-rule objects on Checkpoint over Web Services API. +- check_point.mgmt.cp_mgmt_radius_group - Manages radius-group objects on Checkpoint over Web Services API +- check_point.mgmt.cp_mgmt_radius_group_facts - Get radius-group objects facts on Checkpoint over Web Services API +- check_point.mgmt.cp_mgmt_radius_server - Manages radius-server objects on Checkpoint over Web Services API +- check_point.mgmt.cp_mgmt_radius_server_facts - Get radius-server objects facts on Checkpoint over Web Services API +- check_point.mgmt.cp_mgmt_repository_package_facts - Get repository-package objects facts on Checkpoint over Web Services API +- check_point.mgmt.cp_mgmt_service_citrix_tcp - Manages service-citrix-tcp objects on Checkpoint over Web Services API +- check_point.mgmt.cp_mgmt_service_citrix_tcp_facts - Get service-citrix-tcp objects facts on Checkpoint over Web Services API +- check_point.mgmt.cp_mgmt_service_compound_tcp - Manages service-compound-tcp objects on Checkpoint over Web Services API +- check_point.mgmt.cp_mgmt_service_compound_tcp_facts - Get service-compound-tcp objects facts on Checkpoint over Web Services API +- check_point.mgmt.cp_mgmt_set_api_settings - Edit API settings, the changes will be applied after publish followed by running 'api restart' command. +- check_point.mgmt.cp_mgmt_set_cloud_services - Set the connection settings between the Management Server and Check Point's Infinity Portal. +- check_point.mgmt.cp_mgmt_set_global_domain - Edit Global domain object using domain name or UID. +- check_point.mgmt.cp_mgmt_set_ha_state - Switch domain server high availability state. +- check_point.mgmt.cp_mgmt_set_ips_update_schedule - Edit IPS Update Schedule. +- check_point.mgmt.cp_mgmt_set_login_message - Edit Login message. +- check_point.mgmt.cp_mgmt_set_policy_settings - Edit Policy settings, the changes will be applied after publish. +- check_point.mgmt.cp_mgmt_set_vpn_community_remote_access - Edit existing Remote Access object. Using object name or uid is optional. +- check_point.mgmt.cp_mgmt_show_api_settings - Retrieve API Settings. +- check_point.mgmt.cp_mgmt_show_api_versions - Shows all supported API versions and current API version (the latest one). +- check_point.mgmt.cp_mgmt_show_azure_ad_content - Retrieve AzureAD Objects from Azure AD Server. +- check_point.mgmt.cp_mgmt_show_changes - Show changes between two sessions. +- check_point.mgmt.cp_mgmt_show_commands - Retrieve all of the supported Management API commands with their description. +- check_point.mgmt.cp_mgmt_show_gateways_and_servers - Shows list of Gateways & Servers sorted by name. +- check_point.mgmt.cp_mgmt_show_global_domain - Retrieve existing object using object name or uid. +- check_point.mgmt.cp_mgmt_show_ha_state - Retrieve domain high availability state. +- check_point.mgmt.cp_mgmt_show_ips_status - show ips status on Checkpoint over Web Services API +- check_point.mgmt.cp_mgmt_show_ips_update_schedule - Retrieve IPS Update Schedule. +- check_point.mgmt.cp_mgmt_show_layer_structure - Shows the entire layer structure. +- check_point.mgmt.cp_mgmt_show_login_message - Retrieve Login message. +- check_point.mgmt.cp_mgmt_show_place_holder - Retrieve existing object using object uid. +- check_point.mgmt.cp_mgmt_show_policy_settings - Show Policy settings. +- check_point.mgmt.cp_mgmt_show_software_packages_per_targets - Shows software packages on targets. +- check_point.mgmt.cp_mgmt_show_unused_objects - Retrieve all unused objects. +- check_point.mgmt.cp_mgmt_show_updatable_objects_repository_content - Shows the content of the available updatable objects from the Check Point User Center. +- check_point.mgmt.cp_mgmt_show_validations - Show all validation incidents limited to 500. +- check_point.mgmt.cp_mgmt_smart_task - Manages smart-task objects on Checkpoint over Web Services API +- check_point.mgmt.cp_mgmt_smart_task_facts - Get smart-task objects facts on Checkpoint over Web Services API +- check_point.mgmt.cp_mgmt_smart_task_trigger_facts - Get smart-task-trigger objects facts on Checkpoint over Web Services API +- check_point.mgmt.cp_mgmt_tacacs_group - Manages tacacs-group objects on Checkpoint over Web Services API +- check_point.mgmt.cp_mgmt_tacacs_group_facts - Get tacacs-group objects facts on Checkpoint over Web Services API +- check_point.mgmt.cp_mgmt_tacacs_server - Manages tacacs-server objects on Checkpoint over Web Services API +- check_point.mgmt.cp_mgmt_tacacs_server_facts - Get tacacs-server objects facts on Checkpoint over Web Services API +- check_point.mgmt.cp_mgmt_task_facts - Get task objects facts on Checkpoint over Web Services API +- check_point.mgmt.cp_mgmt_threat_layers - Manages THREAT LAYERS resource module +- check_point.mgmt.cp_mgmt_time_group - Manages time-group objects on Checkpoint over Web Services API +- check_point.mgmt.cp_mgmt_time_group_facts - Get time-group objects facts on Checkpoint over Web Services API +- check_point.mgmt.cp_mgmt_unlock_administrator - Unlock administrator. +- check_point.mgmt.cp_mgmt_unlock_object - Unlock object using uid or {name and type}. +- check_point.mgmt.cp_mgmt_updatable_object_facts - Get updatable-object objects facts on Checkpoint over Web Services API +- check_point.mgmt.cp_mgmt_update_updatable_objects_repository_content - Updates the content of the Updatable Objects repository from the Check Point User Center. +- check_point.mgmt.cp_mgmt_user_group - Manages user-group objects on Checkpoint over Web Services API +- check_point.mgmt.cp_mgmt_user_group_facts - Get user-group objects facts on Checkpoint over Web Services API +- check_point.mgmt.cp_mgmt_vpn_community_remote_access_facts - Get vpn-community-remote-access objects facts on Checkpoint over Web Services API +- check_point.mgmt.cp_mgmt_vsx_run_operation - Run the VSX operation by its name and parameters. +- check_point.mgmt.cp_mgmt_where_used - Searches for usage of the target object in other objects and rules. v4.0.0 ====== @@ -21,16 +229,16 @@ Major Changes Breaking Changes / Porting Guide -------------------------------- -- cp_mgmt_access_role - the 'machines' parameter now accepts a single str and a new parameter 'machines_list' of type dict has been added. the 'users' parameter now accepts a single str and a new parameter 'users_list' of type dict has been added. -- cp_mgmt_access_rule - the 'vpn' parameter now accepts a single str and a new parameter 'vpn_list' of type dict has been added. the 'position_by_rule' parameter has been changed to 'relative_position' with support of positioning above/below a section (and not just a rule). the 'relative_position' parameter has also 'top' and 'bottom' suboptions which allows positioning a rule at the top and bottom of a section respectively. a new parameter 'search_entire_rulebase' has been added to allow the relative positioning to be unlimited (was previously limited to 50 rules) -- cp_mgmt_administrator - the 'permissions_profile' parameter now accepts a single str and a new parameter 'permissions_profile_list' of type dict has been added. +- cp_mgmt_access_role- > The 'machines' parameter now accepts a single str and a new parameter 'machines_list' of type dict has been added. The 'users' parameter now accepts a single str and a new parameter 'users_list' of type dict has been added. +- cp_mgmt_access_rule- > The 'vpn' parameter now accepts a single str and a new parameter 'vpn_list' of type dict has been added. The 'position_by_rule' parameter has been changed to 'relative_position' with support of positioning above/below a section (and not just a rule). the 'relative_position' parameter has also 'top' and 'bottom' suboptions which allows positioning a rule at the top and bottom of a section respectively. A new parameter 'search_entire_rulebase' has been added to allow the relative positioning to be unlimited (was previously limited to 50 rules). +- cp_mgmt_administrator- > The 'permissions_profile' parameter now accepts a single str and a new parameter 'permissions_profile_list' of type dict has been added. - cp_mgmt_publish - the 'uid' parameter has been removed. Bugfixes -------- -- cp_mgmt_access_rule - support for relative positioning for rulebase with more than 50 rules (https://github.com/CheckPointSW/CheckPointAnsibleMgmtCollection/issues/69) -- cp_mgmt_administrator - specifying the administartor's permissions profile now works for both SMC and MDS (https://github.com/CheckPointSW/CheckPointAnsibleMgmtCollection/issues/83) +- cp_mgmt_access_rule- > support for relative positioning for rulebase with more than 50 rules (https://github.com/CheckPointSW/CheckPointAnsibleMgmtCollection/issues/69) +- cp_mgmt_administrator- > specifying the administartor's permissions profile now works for both SMC and MDS (https://github.com/CheckPointSW/CheckPointAnsibleMgmtCollection/issues/83) - meta/runtime.yml - update value of minimum ansible version and remove redirect (https://github.com/CheckPointSW/CheckPointAnsibleMgmtCollection/issues/84) v3.2.0 @@ -63,9 +271,12 @@ New Modules - check_point.mgmt.cp_mgmt_add_rules_batch - Creates new rules in batch. Use this API to achieve optimum performance when adding more than one rule. - check_point.mgmt.cp_mgmt_approve_session - Workflow feature - Approve and Publish the session. - check_point.mgmt.cp_mgmt_check_network_feed - Check if a target can reach or parse a network feed; can work with an existing feed object or with a new one (by providing all relevant feed parameters). + - check_point.mgmt.cp_mgmt_check_threat_ioc_feed - Check if a target can reach or parse a threat IOC feed; can work with an existing feed object or with a new one (by providing all relevant feed parameters). + - check_point.mgmt.cp_mgmt_cluster_members_facts - Retrieve all existing cluster members in domain. -- check_point.mgmt.cp_mgmt_connect_cloud_services - Securely connect the Management Server to Check Point's Infinity Portal. <br>This is a preliminary operation so that the management server can use various Check Point cloud-based security services hosted in the Infinity Portal. +- check_point.mgmt.cp_mgmt_connect_cloud_services - Securely connect the Management Server to Check Point's Infinity Portal. This is a preliminary operation so that the management server can use various Check Point cloud-based security services hosted in the Infinity Portal. + - check_point.mgmt.cp_mgmt_delete_rules_batch - Delete rules in batch from the same layer. Use this API to achieve optimum performance when removing more than one rule. - check_point.mgmt.cp_mgmt_disconnect_cloud_services - Disconnect the Management Server from Check Point's Infinity Portal. - check_point.mgmt.cp_mgmt_domain_permissions_profile - Manages domain-permissions-profile objects on Checkpoint over Web Services API @@ -74,9 +285,10 @@ New Modules - check_point.mgmt.cp_mgmt_idp_administrator_group - Manages idp-administrator-group objects on Checkpoint over Web Services API - check_point.mgmt.cp_mgmt_idp_administrator_group_facts - Get idp-administrator-group objects facts on Checkpoint over Web Services API - check_point.mgmt.cp_mgmt_idp_to_domain_assignment_facts - Get idp-to-domain-assignment objects facts on Checkpoint over Web Services API -- check_point.mgmt.cp_mgmt_import_outbound_inspection_certificate - Import Outbound Inspection certificate for HTTPS inspection. - check_point.mgmt.cp_mgmt_install_lsm_policy - Executes the lsm-install-policy on a given list of targets. Install the LSM policy that defined on the attached LSM profile on the targets devices. + - check_point.mgmt.cp_mgmt_install_lsm_settings - Executes the lsm-install-settings on a given list of targets. Install the provisioning settings that defined on the object on the targets devices. + - check_point.mgmt.cp_mgmt_interoperable_device - Manages interoperable-device objects on Checkpoint over Web Services API - check_point.mgmt.cp_mgmt_interoperable_device_facts - Get interoperable-device objects facts on Checkpoint over Web Services API - check_point.mgmt.cp_mgmt_lsm_cluster_profile_facts - Get lsm-cluster-profile objects facts on Checkpoint over Web Services API @@ -92,16 +304,18 @@ New Modules - check_point.mgmt.cp_mgmt_repository_script - Manages repository-script objects on Checkpoint over Web Services API - check_point.mgmt.cp_mgmt_repository_script_facts - Get repository-script objects facts on Checkpoint over Web Services API - check_point.mgmt.cp_mgmt_reset_sic - Reset Secure Internal Communication (SIC). To complete the reset operation need also to reset the device in the Check Point Configuration Tool (by running cpconfig in Clish or Expert mode). Communication will not be possible until you reset and re-initialize the device properly. + - check_point.mgmt.cp_mgmt_set_global_properties - Edit Global Properties. - check_point.mgmt.cp_mgmt_set_idp_default_assignment - Set default Identity Provider assignment to be use for Management server administrator access. - check_point.mgmt.cp_mgmt_set_idp_to_domain_assignment - Set Identity Provider assignment to domain, to allow administrator login to that domain using that identity provider, if there is no Identity Provider assigned to the domain the 'idp-default-assignment' will be used. This command only available for Multi-Domain server. -- check_point.mgmt.cp_mgmt_set_outbound_inspection_certificate - Create or update a certificate to be used as outbound certificate for HTTPS inspection. <br>The outbound CA certificate will be used by the Gateway to inspect SSL traffic. + + - check_point.mgmt.cp_mgmt_set_threat_advanced_settings - Edit Threat Prevention's Blades' Settings. - check_point.mgmt.cp_mgmt_show_cloud_services - Show the connection status of the Management Server to Check Point's Infinity Portal. - check_point.mgmt.cp_mgmt_show_global_properties - Retrieve Global Properties. - check_point.mgmt.cp_mgmt_show_idp_default_assignment - Retrieve default Identity Provider assignment that used for Management server administrator access. -- check_point.mgmt.cp_mgmt_show_outbound_inspection_certificate - Show outbound inspection certificate. -- check_point.mgmt.cp_mgmt_show_servers_and_processes - Shows the status of all processes in the current machine (Multi-Domain Server and all Domain Management / Log Servers). <br>This command is available only on Multi-Domain Server. +- check_point.mgmt.cp_mgmt_show_servers_and_processes - Shows the status of all processes in the current machine (Multi-Domain Server and all Domain Management / Log Servers). This command is available only on Multi-Domain Server. + - check_point.mgmt.cp_mgmt_show_threat_advanced_settings - Show Threat Prevention's Blades' Settings. - check_point.mgmt.cp_mgmt_simple_cluster - Manages simple-cluster objects on Checkpoint over Web Services API - check_point.mgmt.cp_mgmt_simple_cluster_facts - Get simple-cluster objects facts on Checkpoint over Web Services API @@ -109,6 +323,7 @@ New Modules - check_point.mgmt.cp_mgmt_smtp_server_facts - Get smtp-server objects facts on Checkpoint over Web Services API - check_point.mgmt.cp_mgmt_submit_session - Workflow feature - Submit the session for approval. - check_point.mgmt.cp_mgmt_test_sic_status - Test SIC Status reflects the state of the gateway after it has received the certificate issued by the ICA. If the SIC status is Unknown then there is no connection between the gateway and the Security Management Server. If the SIC status is No Communication, an error message will appear. It may contain specific instructions on how to fix the situation. + - check_point.mgmt.cp_mgmt_update_provisioned_satellites - Executes the update-provisioned-satellites on center gateways of VPN communities. v2.3.0 diff --git a/ansible_collections/check_point/mgmt/FILES.json b/ansible_collections/check_point/mgmt/FILES.json index d4ea0af09..c29af3161 100644 --- a/ansible_collections/check_point/mgmt/FILES.json +++ b/ansible_collections/check_point/mgmt/FILES.json @@ -39,7 +39,7 @@ "name": "tests/units/plugins/httpapi/test_checkpoint.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "9d981290944de8e187b9925cdbb43d1373a870242c418606d4e14b6d65f68e26", + "chksum_sha256": "d15f7287d093521de5e1c04abb80193b006ffc372f8c6b9eb8b2037f9e3efdb4", "format": 1 }, { @@ -53,182 +53,182 @@ "name": "tests/units/modules/test_cp_mgmt_wildcard.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "96eb81fd4a4e7bd94c6b570ef68c9313912aac8f82cb67cdaa19cf8a1491012c", + "chksum_sha256": "9fdf797904c55ac158c6b4fa41552b75d2e29ad5c6449d1342b4f2bd5693f21f", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_administrator_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "a9231807f991a461cbd31f65a46460230bb2201b1a47c4cfbb94427d91af32be", + "chksum_sha256": "26564fe909cc1a6ddb887c44e972cea0d9fdc0d7713202d3e934b23eaaa96499", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_publish.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "e0fa6b28dd8308afeb9e5bc0d518597720ab5c7076ef34ec0c7fedc86abe555b", + "chksum_sha256": "513d26868c39ab9a5b4c62ca40a889e3a92b068f72520e1532b75a9cdfcf569a", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_global_assignment.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "9f7d954edf7974880e1e804169a4b72737f7e9beeff4907eb891ea5b9b1870cf", + "chksum_sha256": "33241af0781efacead5ed66e942544dbfa5e075abf197771353e689c859497f5", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_dns_domain.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "e34d6da7d0cdc35a52a7b4f8319d2f03eefc43864290b2c0817fcac0b23704b9", + "chksum_sha256": "00aadee64c49535650a33e887660c9fd75fe018a76f3946445c2adff3e3f775b", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_assign_global_assignment.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "4430102bfa5445973e58af32efc0cffc60ab601d39525fa61b11808e78492462", + "chksum_sha256": "0568eaa5bc2fb7e0ed92b979c582ddbfcfeda3100bc6f59c77b6e75f158f221b", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_application_site_group.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "64c40213f8e9b3f11ee3d796cebf174c88917dcbe6485da368a1ff2a246bd814", + "chksum_sha256": "38e53e938cb1d86170f371164fd202be716cc33bc342e89d14d2fbe60213a196", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_host_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "e01ce4559932f611cb5f549e1ccd3c308aa3405705f46435ef432202109895ea", + "chksum_sha256": "eafad8d565eddc74793c9c7a0b3dcfa26df60b11ecad446acdee35fdd892c57a", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_verify_software_package.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "d74c8b4e8ef2fc36a16fd4a4ad4942fa02fde1ae9746e354fa0a16f50332ee46", + "chksum_sha256": "2bf07223360a3de6b7a16f258576e5f5419df6fc88b4cd7132301ae763b504af", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_security_zone_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "520795aa3ad4a70e589f04c19d14851b872899888d4b5d37fc10502ad52d346f", + "chksum_sha256": "40202583bc30d2359dc2f4635f823b3e813a8efa4d0d2ea4eb531efecd4aa3fb", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_uninstall_software_package.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "59986dd3a1667bb8086341c9d8a08b5119215d93c761aa7db5caa64344629791", + "chksum_sha256": "39bb818436b980b0772b07730db9e5a9d311c4d8b2b372a3a683a50c8774be38", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_group_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "e5cb39a06e81e52d98b509a463e352fd9215f94ad26f84d568a0aec4debc2ef2", + "chksum_sha256": "465c4a27c6e98f1aeaeed01b593966c451068bbb16383dfabfaa5a13905069ae", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_application_site_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "f1158d9aeed4aa7070106dcdcbb4f3e10a3380a75b814dc7fb7918f88fd12915", + "chksum_sha256": "68703e7bf3843ce67a02d0e9f424f38072061fcf27bab99909366e2569e0d5e8", "format": 1 }, { "name": "tests/units/modules/test_checkpoint_host.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "0defe75da109c1b68f8e7dfede9ee223ffafb6ef16eea7591b4ce4947e697d0b", + "chksum_sha256": "797609ea227f3c9ee9404fb6d45df84900d9f5fc393ba005faf8c6a1a22d5893", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_threat_profile_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "cd487926b42abc6f78ced447846e49e18f9c12a58c61504fd9c34e148cd9f523", + "chksum_sha256": "3ed7dfcb6c247f634a47b3c784d02575ce5b23399b5f7ce9f8a9010c240260c5", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_application_site.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "db9e5d214da32046310500e2e5c53fa9f22961403a24bff1775b3c5989be0df5", + "chksum_sha256": "7a313d52c3388a4b2a136543cfd1c448c228ef0c308a6911d86c222ce8527f21", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_access_layer.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "068c1590cd6ca7721c889cbb51c9038875190354a7dfcfc65974ebf33f7d3f10", + "chksum_sha256": "75269aca4c276149c70afa7b6f91e2f278db250650f4f67b684f365eef8d1bef", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_service_icmp_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "2e99a97ca39c3d496bb07130583e4ce851f89a374614c1e4a60cbbebfa96520d", + "chksum_sha256": "46f22fc393c092627f743cf6820e2034383835779713dbe3ad036cde62c29423", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_vpn_community_star.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "a5c934382e013b02d862e6ca41b40520a860bdb3435ac4225b349e84f0cd5502", + "chksum_sha256": "22f531d595ae9a08c888d63a30ff1bbc15dc122e0ed7f0f8d47f04b8a1b3e2d6", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_threat_indicator.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "d6f6891ec4c80bf907ca777525bf2eedfc0ebade770d40f634213bbcd91adb1e", + "chksum_sha256": "52e6f04fd99336cc69f1cf68538937ea7573fd81ae429a29cf8e6034c9036b12", "format": 1 }, { "name": "tests/units/modules/test_checkpoint_task_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "0defe75da109c1b68f8e7dfede9ee223ffafb6ef16eea7591b4ce4947e697d0b", + "chksum_sha256": "797609ea227f3c9ee9404fb6d45df84900d9f5fc393ba005faf8c6a1a22d5893", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_service_udp.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "40c0ae507ced4abe95526b3bc579106563dabf6a4780456e2d4a8063e6248f05", + "chksum_sha256": "5ddad042f9be1fa58c246f1ddcfc66293d65b0cceff3ea89f36cd9995462ff63", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_session_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "4843417f873b63efd2748eec3287e6300d56aa824869d46c027d877cfb304057", + "chksum_sha256": "202a8958954ae929a6bbd04b5008bc701108a1df16765ae62ea6a92af1baed3b", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_service_icmp6.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "48caf7f6e4332dd89b6e5b975591b2abdd7741bf15e852aea9f2d0a07102662a", + "chksum_sha256": "7d4d29185c6f1ec4be5a4fdf6932cfcecba35316e51de18023e758897dc540d8", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_access_role_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "da6c7d554758a05fcefe60129ef8b3065d1eef1bf41105b759c13518deea238a", + "chksum_sha256": "ef65769d826ce4628dc9473660c22181db0292029ecb71eca5b4e51e79e615d4", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_add_data_center_object.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "4b54eb105d9690dcd5c6db7ab8494fcf755643fc81f43bc4bf63f26c22e47257", + "chksum_sha256": "bd1297944933d1f0415ddf8a1018141029f26e9cf8cabe006a5088b490a19133", "format": 1 }, { @@ -242,518 +242,518 @@ "name": "tests/units/modules/test_cp_mgmt_show_https_section.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "21d8d4df3d2786737a25441ca85dad8ddffbd47242bff03c6fad3ca682593b00", + "chksum_sha256": "71c90ae28001336b65b0bba14078e3a1db9fe2a25bedc4d06e66435b32b7c280", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_simple_gateway_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "8c8e5758620daef40a5d496cd7590fc4d5ae4bf6ab543037f867b9b2d532de34", + "chksum_sha256": "e41b2f0eeb3ca7f7e81ea0a81bb870b8f78cdc42743d87e90e517d29021f00fd", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_service_sctp_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "1a1e89bf0059dc5895e8cb129ba49e4b2a30d643d861937a0ae470256c773825", + "chksum_sha256": "a6ecd430aa0be853f14d63190598df28fc70d1d822ba909adbe74cc08e0d44c6", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_threat_rule_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "65c6f41255267a579f38318110536a5bf1e681081ce8d884349b54741eb71411", + "chksum_sha256": "6ae372ff77561683dffc6155fa4b186b6e9484ef0f7eef9c3977ed1225c173e2", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_service_group.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "c75216ed17dec454be7b1eb16f79faef177140c8a14406ccafee80351d6496ed", + "chksum_sha256": "0d5fe718a11d2dd188217a0adde8d3ad08e2d904dcf6e5284ff25d20488dfd3c", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_host.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "75ed1b841d3b6220170715e2a584e03f935a3715eb13d435086cfeb58370065b", + "chksum_sha256": "8c3833d08d0f94eef62939b7df25346d151f9e75405ae1a329442db901e8956f", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_access_layer_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "2e3b4731b4f63d81cbe6faf70b8ff3f12d6314e40a17b240656c3675b763c0a7", + "chksum_sha256": "ce33fb3a158572d9fb8c8db307fdf57e6ffb623db463a3a5d8a0d86611a811d3", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_mds_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "ef54911d3cf6acce025de758e403a0ce8ad527d906128f6fa542b9f7caaff14d", + "chksum_sha256": "495395c8402ee4e714db5e40f67d03e560830508ed9b9ea4136359aa9a25ba35", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_application_site_group_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "2a0cabcec0ba0636cee32bfb9ab6998592229c341a33a691ecedef4edefa7f96", + "chksum_sha256": "052e4eae98956d4eeaa7f5e4d61c18c10b048957b04e36cf14825686896c36b7", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_service_rpc.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "ed91f508b2ccfd02d1e32eb610fa3f8363ebe131f2c14f7859a301415e363b59", + "chksum_sha256": "096e583bc98cb56033b957eac3d8bb6813bf32e13e82c979e531e426f624e3bf", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_network.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "3adf34f93d4caaa9fe51a8430a4933b4a198a982f3eb0c2c993d02ed324044c7", + "chksum_sha256": "79470f8da1e3db72a9cf2132dda18b0ee613a7ab07e8db1f41f7650cda0018b0", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_vpn_community_meshed_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "ac1bb8819f21fc45c6549ce81db5b7c4cd52d5f6bcd2697516a287f672fc6a94", + "chksum_sha256": "99a17fe253a218baeb2a70263d644503aeaec20217cee30b29b0ad41b47c76b8", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_discard.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "0f9ccfc11b4e4b0915748c9ac22bdef9d81a34d45bb595f18b344f5f2810a96e", + "chksum_sha256": "d97bb5afab8f50edb789a540d8610e6df74ed67687a7fc81dd58a0064a71ccee", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_network_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "5a488220df3d23305ff88f3793eb5962d655d8e4e65d1ca0e55047541c0e398c", + "chksum_sha256": "9d40f00108a5af289bb896d0c37536f690b9dac0e5f6152e8d50f6837896bc1d", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_service_dce_rpc.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "9afdffbdc1371928f649857f8adc30c129e65304154e4e40b75d1f1472e15522", + "chksum_sha256": "4bba036b5e15b8b42244a9856bdecf7004836618862f744b8a9804d2aa846737", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_delete_nat_rule.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "87d7f8a5c4080b1d0079f52659ab04ef7ebb5cebf3dc797b781ff4598ca2c414", + "chksum_sha256": "8c1df36cc3f3f07fb167978a0a0c041c59f9be6966f3bb54c0bd62ea540f9bc6", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_nat_section.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "717df66aabecf9096e09c99c6f099335758222d0b9e4c44cbe8da9e6e0a7fa40", + "chksum_sha256": "2ea410a206fd7f10566dc51f2193d7d98ea3a479db6b7af0c2012457786f028e", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_simple_gateway.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "6b1a432e9367ced489918799411d243906f72214ee843c6a97ca168d674444ab", + "chksum_sha256": "552d80d1e5ae15b39596a45a3c928bae667bd69442674230813c51149e4e3908", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_service_udp_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "8eb00e3b48b5f559ce223c7fffb332164621ebb76e5281255cb23c2dd247733f", + "chksum_sha256": "a98d6e7cd18a2c3a8f6b7de57230559e83035801a44cc223d6c5552c380e81fa", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_service_icmp.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "92759d20c19223d9f496ca0ef2823b27f7bede8f46bf6a77128efba4368bdcd2", + "chksum_sha256": "7c8052122f842190745708f2346563a1a7b24c6eec63150cb58de2b8f56d056c", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_exception_group.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "18a7350ad42e193fab24fdf4501fefae04a87dc702ef9c2ba5a96be0c9b45cd5", + "chksum_sha256": "4d074371f3a85b3156ed3f05c49149688c26b9dceb90e1aadf6fe9eff3c61317", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_https_section.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "200b553690c44dacdbf6a4ace5049f1427f4226ce5d8f7f797629640a13f9b63", + "chksum_sha256": "c56e30ab16ce775f7df5d25b0c7e7db230ca1e4ba143a2fcbae7edb29e3afe8a", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_global_assignment_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "ef4fadacc4a896dfc81bc870fd7298fba3d4f6007a93e2d0a129d9c13b2651ef", + "chksum_sha256": "451ff41a0f617ed289569c9c3d54e44cc09f965d6d78d912eebc0d8916f2002f", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_delete_api_key.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "3f16dcc30d79476a959870d7e9e476fc9a7e2ecbe38153f11b2cf1f40865b2a1", + "chksum_sha256": "a1f9ed2814c1f0da293b120af20a618c562a500fec6e8fb71e23959f78018f52", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_time.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "80dd3a4635ee333c2ad50c1382a884a90d0dea6d1c8ddeaf3598eea4305a1df6", + "chksum_sha256": "dee3f469f79ac5ca759adc1d96b30cc5fc2f3b78ff759c91a9a0068a01537b45", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_multicast_address_range_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "b124c26770a7c980d937afc7c5bd660c4795c6ddbdf5f547b0522dbbbc6a3aae", + "chksum_sha256": "149a1f13adb1abe0c3b2e00282fd8178656e1cb5286dbd029802e9cd94831122", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_service_other_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "069588c702d7bea017fd511f42495dad9dfca24da44e78d654baaf4c49c2fb90", + "chksum_sha256": "0402c74836c1d1acb2665d6f25c190dba0d559439e11a35a67991fa880e827fe", "format": 1 }, { "name": "tests/units/modules/test_checkpoint_access_rule.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "f0bf1522c73ee4c935dbe2d060f3d01a924d01d68dbaf7e3bba1a1ea3cac9105", + "chksum_sha256": "6749242d7c51d5fcb0ce713832ac00fdd5a10b5ec4ef1655f0787fb2ab8e970f", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_time_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "a67fd09f696dd5b6970e6d450bcda75410d8d4f55b73b1a4c3dd27c63961d09d", + "chksum_sha256": "53455e06e7c8bf2fdffd961f28f88e119578e36a8b25b6332a3874c6f09684cc", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_run_script.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "162ddb7ed025aadededafba936658bf3d63ec15c1dc69109320dbb1c7ad06961", + "chksum_sha256": "8b67b12ce67cec4ebcdab0d15a425704586eaa03257d0452d82b53295acb1a3f", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_threat_exception.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "245c066ec06f608db240bc0036e7699147cef10d0ceb8374836c906827dcc889", + "chksum_sha256": "e45e5f9bb7d0f5680a70ef48a55b410f410395a9c79d06b13c1197502aa817b3", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_delete_data_center_object.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "8a5f61be541d51f3d9514f0672787f7c6332b7b6d2ecdf62eecf31f5acc1ae3e", + "chksum_sha256": "6df3dbfdf63cf6536bd2a83fca6abf2a2f033f7b7a0da0c287a5b54e6565fadc", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_access_role.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "1098f3b942332481807ec91847b750993ae9129f31c657ca2fa37761e0fbbf25", + "chksum_sha256": "6f4190d5a5167eb8785d7a10bb6e6c021b73008486c76e98c2dc628424cfcd53", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_service_other.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "f09a4a88b7b4b6d3ef334cbd44cd2f33279670cb2579c28e3546cef95f111edd", + "chksum_sha256": "30ec68d3663ca3a099a5fcf79fd44777f85675ed1d94c7f5d0fa58b406a320d4", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_service_rpc_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "7c0a17572b2fdd30c9affe4c5ba35825bb6050a9b5dbfea5ccc9327234c3f82b", + "chksum_sha256": "57e7a4ea8c36f83edc62f90798b9fe6870abd55f83586927cba3c22fb208aa70", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_vpn_community_meshed.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "405a29342f78872d022b355e6f05db43861dd77e26cf8da288ed01ac43994ca2", + "chksum_sha256": "b34f33d71c9dc3d8e92c51266c8f3e05cddc4fceb5fd1c3a5fde7b7034357275", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_group_with_exclusion.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "3adb58c7044e4981326f4e71de40712966b66e92959439910299ecc25f21aaf8", + "chksum_sha256": "de4ff3b1f66b95f00160bc5c1a3d7e1cc34e581797ba8ce9b48d22d9a6943e87", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_service_group_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "c4c4a695d3872a75ffed983de9121405bc3544da6c35f6e5b0644de291aa1251", + "chksum_sha256": "57558bd782f3f0091ac212e192438d542d95f1155eb8145a524687d9ed8fe0ac", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_group_with_exclusion_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "bfe829ebc865e32628a6c0e3ef9789bc662e3d416acd989c51d2e5a71739ad63", + "chksum_sha256": "717036e0b0c30e22eacafe8d43ecab2f2ff1ede17ec26e98ff08efb4deb2efed", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_set_nat_rule.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "7c93ded0f03e9f11f49a34a5ad75abb58d9cc3b8ded956ffb9c2522f2f85199f", + "chksum_sha256": "c251ca0656637d8ea9799f70484ec691686c5c2e2d6ed4be4f3ec7e6d7e97672", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_vpn_community_star_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "d69f484bff5c827d08d044dfecbe739dc083a3168b76ca0c09d985804bff7fda", + "chksum_sha256": "eda3450d8c5a946b16b5ed036610f2ee2df9dd8fb5f66259b5dcfbafca58a205", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_show_access_section.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "7180520502b5bbede8a14f2c2521e1d5b0eb1146a47550b99cf4cc388e0a2dbd", + "chksum_sha256": "2b9243ca5705e8936da93749eb16dbf51e2c89de9ec2469dd3d9f418c8d18167", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_service_icmp6_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "83ac6d89a1b004dd527020e8ddcd295a1411818ab47c465407d17d88d98aefe1", + "chksum_sha256": "8e133b42fd2a4d14ba883490d072cb8e1e6e501ab67b1d47344192da12f6636b", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_threat_layer_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "7153d9ab9fa164d9977768888e50b8557cd78a82ef89e4c744a2c246f6a10ad8", + "chksum_sha256": "c639915fdf67f520d5580d25cbbf97f57b35f808ad1efbfedbd2aa0b9333cebf", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_show_nat_section.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "77f6179900d0ebd641e6e8488771efd914ba55ffc31614f268da2ecdc78baac4", + "chksum_sha256": "f46fc0f35aa62bf264cc87dc96a2e578cf5389bee43765e21159fe00421b3a5d", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_service_dce_rpc_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "c77d4695f5a9381ce03c2e22b14cd7b45fd8ce69a67657fd48a24758ea1b068b", + "chksum_sha256": "8577d7c7d3d6547b5d263b92e417660d0a01f0123b76a30e5233f1946ec99b7e", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_show_software_package_details.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "e154ff5aa62d14d4dadd1af860bb6c98a0e6bac57565104969a48719080d3387", + "chksum_sha256": "b815ec6067109966e561852d047d777e1da2ebfc8655dc51b524ef40f34b46d4", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_access_section.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "053ab71fa6b25ae7a209b58810c4cc885179ce883d3a0434708592993039482e", + "chksum_sha256": "10e034a33931334d0d23c7431dc0286994de3155225a4dc85cb3b509081c7f78", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_address_range.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "23a73381edc1497d0998c01fba4ff7e192c497a3cc876073b7195ab4a1a28919", + "chksum_sha256": "c81924889c82520f1d64075575051619ba6936d8320a11e52574ae3e27678da8", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_add_nat_rule.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "c00fe6d07d01e0f9e83461049e3a1c87201c9811b39c80ad24dd2f988a625795", + "chksum_sha256": "7af8051cc373721b37c8bf4cb4782b2ce169f8f8046a157f577f4508f9aadb37", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_tag.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "c106c27905c62edf3daf4c5f0484db755314b8f7ef98873eb32ca838b95d08d4", + "chksum_sha256": "72361b6ba9254c626428c13270830f5978811eef3ef2cf151fdb44219b545a3c", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_put_file.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "8bb70eefe9a9f68959ba3d19b450da60612cd8b43c382d05d78b7d5a9c678a49", + "chksum_sha256": "11a210da7dad09f06207164c7fdf7a720e207044a1ceea09a021fff4d97bc116", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_dns_domain_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "8db6362f60b09d870e5284fc55be4c60862a6686b0d12d9bf442cd6537e6d6b5", + "chksum_sha256": "c99e302081a9bf6e07262ecd97ebcde1b270498f0f411549dd45cb88b096e866", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_threat_indicator_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "f432265160fb643bbac5f4710deb80c99fa9f2438e080286dc9ffcbf03379531", + "chksum_sha256": "e87c549ad5f7c749c859fe07755bbc7427c903a86b94c2ae432a74a21a1cbde4", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_address_range_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "eefdbe1a87fec458d0aad4222957e03bfd7230fbf597f8dabe533248eb7a1490", + "chksum_sha256": "aea925588de8798cc09bfbce81b5b41b29f3b6321912782968680f66390d3681", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_service_tcp_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "76f8d81afb8d231b68ce75b6d0bedf8e4ebc24c972d78cd209ac7124823e180c", + "chksum_sha256": "8ba9acfd24036f535503bee387f8cdb31ef2f75259542cb6e4a1b03b1cd84262", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_exception_group_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "02500aba47b7bdbb230bfe763edfa96cab3d0e074162d5a0f28e3f69060751ab", + "chksum_sha256": "ece5601f9e03f3c92b84a010139d864764b489c439e0a3147bb88075d86616e1", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_package.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "1ccf35ad77b6a2e696bbdbb0179dfc0126e4dd81c22ee504e9e3ba8b12c1c382", + "chksum_sha256": "8f9389234dbef7d818a2252fcef8531611cf473e6e1dd2acfb663c13ac6dfe88", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_threat_rule.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "a3a2e8d3a00d1b1c6e3f35de7fa4429c564507c0579460270ccaf52bb40e498d", + "chksum_sha256": "37dbdf79c9c3b082d3c46a3410ed316b0aeb34f33fb7f15ee44e13924957b95b", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_data_center_object_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "4ecae15f5095db12e5359ac3ac3b3645a79ee6e680995d099c731c32da2a35bd", + "chksum_sha256": "0403907fef47f7807a743fbac0684a8e5cbdc7a9368fef32f08ec0b86ba07487", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_dynamic_object_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "ed7c096c6950ce9ce2427bbe87fe814bc3249571c57b6b7e3c14cc6cad374a9b", + "chksum_sha256": "7ec067312bd6713396ae57d20bacd76b963980e67d326c9af9ec0ca710eca01a", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_security_zone.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "be9529986d7679ad4d6ff9f08d0c30fb09258ebf155e5a09fff2a4e9f78303ae", + "chksum_sha256": "bb16dce85a1e1ed3b00d11894805aada6ef7b0dbf530650b9bafc8ff6fc36e98", "format": 1 }, { "name": "tests/units/modules/test_checkpoint_session.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "797ae7d20104b0c375d9bf92c8853738bc7af2f16fd56676092efdc4e19336e1", + "chksum_sha256": "68a08acdb3a8e03230289cc7ecf76959730fb6485518a8f001c64fe710c5ec24", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_multicast_address_range.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "3181a16700f16f0ba80f5e53a6a8be4c8a4c871531a0dfeef3fdead2b87c942c", + "chksum_sha256": "d32ebb8a331510bca57cd94aad015a5693a77dbca16ed8717f1ef8556efd8272", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_tag_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "83c42a3f0768045c007eb0a105465d70a8e5948b3b11b75a02d8ca62b0888d53", + "chksum_sha256": "ca8e36c5505c713a4edb5b0f848ee4640d31e719671685d208eae120ef733317", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_threat_profile.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "8dffb75f6f197924a8e8ad9bbc1772ff502397a52d4f79523c86c07fb2a62804", + "chksum_sha256": "d655b70262b2fca338a9a235e1342f7c1a020fddee01f8faa24e88c7221cdea0", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_wildcard_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "a3c769bd27f15eb7bfb88c2dbcf6f97c85fcc4656252404640d5cee8ae54f300", + "chksum_sha256": "3e7585db2961438bcf56bffa6a9edba47dbf8071e14278b18fc22ba324cc78db", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_application_site_category.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "83c76df7dd974023b094ed7db58f502f2fa2217fda3f6f870d679f4c67764e67", + "chksum_sha256": "579a94a67ac3fc17bbf299922817baa7932eeade25236581d1967b1ea1767804", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_administrator.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "3780c2ea79f38c29e9c35072fb7d44751f0adf208d7bfe1a6d4b2cb7ae34614b", + "chksum_sha256": "c378740d7856d939188333226da0fb809adbcaa6001abc34256e008efa63cbd1", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_package_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "c7be2f9616779d41b1220331ff5c2ac9bfc7e1c9f45a95d19db2b02417b7de3e", + "chksum_sha256": "90be7bce5657c3ab348e1ba7fc0fd9f8292d7edf8c5fb42dba680f2d2fddb59d", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_application_site_category_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "8de549b08b9e33864235fb28b3d77fd0389ceb61483c77899fd13a83bb77ea62", + "chksum_sha256": "6f1382dd12a59b9fd289248e2dc18b1962fdec86cbac10acfa2cf566f2fc9897", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_threat_layer.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "37d60a438848cb3410bcf3d9cd11b1723516ae2c622af2752d919ecab8089b3b", + "chksum_sha256": "4c4a768621714032a90ee39f18c9ab37920e690cc4e57480d16215ee9ca1167b", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_install_policy.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "eee9b103c215050cef25eddd0fea8de54abe40be02a06ee28c80888b4a26b0ea", + "chksum_sha256": "0692ed7d3beaa44318094fcba6dda2662086dac9d925c424819d2178afa5215b", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_access_rule.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "7fdbec735156a21036a6efdbeac5f739bb16f428966f4ad219d63628cccf1ceb", + "chksum_sha256": "0ce1a9c377e47c0f7a5c00cfa1b3181d74c5a40242c73c2269694d79fd0b8bc4", "format": 1 }, { @@ -767,84 +767,84 @@ "name": "tests/units/modules/test_cp_mgmt_run_ips_update.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "e63d017c4e434e00ad5a2aec67d79e62f25850f231a33632929c7dd0e4264eb4", + "chksum_sha256": "1cfd861c66879d6c1c93542b92ca8aba078797c0b565d84f834de8b13feb1b0f", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_threat_protection_override.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "020825ee4b7fb37c4f421391eaccffb8f3a8f53fb0eb5a2f4d1ae2849f57498f", + "chksum_sha256": "f92019743b9ac067ef8318881dda11029566fb6841e688f2843690a6a582921a", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_access_rule_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "b9bfbe5bd3dee964bb71094498d6c7cbfac7215b0c6777a889503ffa522129ff", + "chksum_sha256": "e68547d41ae49af5b81fcdc8aece37d4bd05523051911e37726d3b766003c18c", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_service_tcp.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "ee294d8627c0a636fa15e90f08616582e81cb2e30d98e72b4602086f267110a3", + "chksum_sha256": "7ae07481cf5539eac89e894165da82626b56074cd2badd41bd96ffd6dba0a08a", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_threat_exception_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "646d9e49be52cb3bf4697839b10e553a915971754dd32e7db19051428e99d6a2", + "chksum_sha256": "d1ff60a04d2b64f0530443a99624bda25abb472b41207057921165a72210e791", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_dynamic_object.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "9b4cb8301ccf0b9026a40df58f12629662ed589a80e57a4c354b22e985189c99", + "chksum_sha256": "e0276af7af74165e39bc85b65e086e8d3a3255fc7ff83331607f6a7d25824f03", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_verify_policy.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "24e9eb33ee2dc0c431d97186931ff98e51b4262b3952eb86e7205f638caf6378", + "chksum_sha256": "246b28bc11662a8f35f914f5e0cc282382c374070d3c1327f24b956247aafcbf", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_install_software_package.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "f6dde7f737e4efa372d1e3af3fca3b04c7cb20037581dd9fb2d7567b3124a309", + "chksum_sha256": "1b8fd759b8609fb5044ebb7986a79b42dd2a428c2e84f4a8ee1aea9f5d3c3e22", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_add_api_key.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "e1297d7ba1c62f880d52cf5d7bc2bf45e11f15a39baf293d563ccb71f1b17cc4", + "chksum_sha256": "c7a1bb33a110e59ae187f8244aae46d16973c35f139cada109ad44498126a549", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_nat_rule_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "ea95691323673cb5c61290c0e61175720ae7ccdf062e63f88bca65123f2cc96f", + "chksum_sha256": "fd1f001e5d4a7960682e23d6769147fbbb055c34998c5ed50b5d96aba9a8883a", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_service_sctp.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "5e7ce1866a5b956d4b0ec0cce00c059a1992c4dfa46f3266e1d624fb3d7d0c69", + "chksum_sha256": "b932b978548733b0b063a2116ef49e602f121d2d40550882fe18de231420bb29", "format": 1 }, { "name": "tests/units/modules/test_cp_mgmt_group.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "fb7bd5f23e514014f41130ef9355a23373afa54c856d79c3b3bde559ee6fd6d9", + "chksum_sha256": "49cf80d1c2a1d5d09a341d1a07b9d8800f5c330a4a5ad9adb864e5b1df0577e1", "format": 1 }, { @@ -855,10 +855,444 @@ "format": 1 }, { + "name": "tests/integration/targets", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_hosts", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_hosts/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_hosts/tests/cli", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_hosts/tests/cli/_remove_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "beeb4641b89ad0813bbb017c2c4c3797427c5dcd84061b0483be487676b8b0b7", + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_hosts/tests/cli/merged.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d4e46c7676e56b31a1a8c70057bb975df7bdce42251e95ab7669c503256312d8", + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_hosts/tests/cli/_populate_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "618a8f68133a5280f0921de2b46f752a2373c9a50256e93ab89dbd940bac45cf", + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_hosts/tests/cli/rtt.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e2f5661680a613a82de7a7a3d958356d15f8f6bb0162a6fb822b10f85118074e", + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_hosts/tests/cli/deleted.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a065d9b4ba62203c745c012d42e351bb5e1fbbe3a4e87fd0d93337f78ff89c60", + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_hosts/tests/cli/gathered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "bbadca656212d253e7e868f91f55f3fee2b2538e3b3cdf7c59246db40abca355", + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_hosts/tests/cli/replaced.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "43e3664592b42ac2cf612ef1f64d123c482924cf015ca7a32e384e3f4fbd9e1c", + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_hosts/vars", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_hosts/vars/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ac656266af0b221895049726bf836fb367dfb324a46ab54cff58bb4639a280d0", + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_hosts/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_hosts/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e7d7f58a1d24f52718c31cc560ba27eaf69da2df9e8b0d26516560b547d1d9da", + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_hosts/tasks/redirection.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5b071a65a98718e6fbc859cf577103adc6dd5700bc7263877936d391639e61f3", + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_hosts/tasks/cli.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9f6c838dbfabab9a13955c8980396720499a80a79a6a82103068e761882a013b", + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_hosts/default", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_hosts/default/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c8e82c716422654d049fd043bbf84d624ed532f96741e032f52f14c19e970d3e", + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_hosts/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_hosts/meta/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ec4fa30fc4a7b9e002d1c7b3932286ace72ba36e4f532e2cc79f49d07e0794c3", + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_threat_layers", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_threat_layers/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_threat_layers/tests/cli", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_threat_layers/tests/cli/_remove_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f0a21e5f2b2ea1c1db1972a973e7e5ee1498b353df28e55ae2a72d77104e7560", + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_threat_layers/tests/cli/merged.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "550b1fb453f83cc45cb08c74debda14bf8466c8326b409129002f8176318f4a8", + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_threat_layers/tests/cli/_populate_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "973b33087bc5b0fcccb302c1b7a88f8bcca9d7274c2b87525291b83e494f2b99", + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_threat_layers/tests/cli/rtt.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2185738ef515b37b22545feebcd7ce2e9c0fe6fab3d6b81a799736482e202f02", + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_threat_layers/tests/cli/deleted.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "51851a960681b925db886a323c4204d6bda5a8e6f183ffbb3cf5a80efebcb6c2", + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_threat_layers/tests/cli/gathered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "6928bc7a5dde228c2bab4519b0fccc308bc2b97608f087a9ca65bf907f4aaae1", + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_threat_layers/tests/cli/replaced.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2ffbb5fbe4a5c548c89cbe45a2bb27da6868fc06382294f2fe31d59c4288438b", + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_threat_layers/vars", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_threat_layers/vars/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b09825ef9b22df1e565f9ce4af591fb79218188c55f93c48d4af151a762963fe", + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_threat_layers/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_threat_layers/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e7d7f58a1d24f52718c31cc560ba27eaf69da2df9e8b0d26516560b547d1d9da", + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_threat_layers/tasks/redirection.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5b071a65a98718e6fbc859cf577103adc6dd5700bc7263877936d391639e61f3", + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_threat_layers/tasks/cli.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9f6c838dbfabab9a13955c8980396720499a80a79a6a82103068e761882a013b", + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_threat_layers/default", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_threat_layers/default/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c8e82c716422654d049fd043bbf84d624ed532f96741e032f52f14c19e970d3e", + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_threat_layers/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_threat_layers/meta/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ec4fa30fc4a7b9e002d1c7b3932286ace72ba36e4f532e2cc79f49d07e0794c3", + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_access_layers", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_access_layers/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_access_layers/tests/cli", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_access_layers/tests/cli/_remove_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "16c32ba35633c5bb2ea74ac226e4dabafd07995e853e819fab19a3187d497e2f", + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_access_layers/tests/cli/merged.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a386bd881cc541ae0aaa915830567e779cfbb1f759fd02af7407f20cd2411862", + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_access_layers/tests/cli/_populate_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3c5bddf381bcf4cd85d82854b3f92b468d41e261390c9ec0772fdb4ca29ae644", + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_access_layers/tests/cli/rtt.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "bdb81fc67354d19ce28d309dea4db7ed2df8671738768a025ba49d5ab74aeabf", + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_access_layers/tests/cli/deleted.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7afd12a5871410ac6299f31dd5991afc3082b8f4c2fe7fc1390da3b4016ee7eb", + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_access_layers/tests/cli/gathered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "84d2641c16ea01b2d74878cfb13de2ccf5ab5fcbd7ce4411afe1b1c41f4068a9", + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_access_layers/tests/cli/replaced.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8417bd729848f4d4fbaaa691916970a30432ed968171b34f894da012e0c7ef52", + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_access_layers/vars", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_access_layers/vars/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a7ce38445031d76134d0cd52780f5905abb1cffce74718fe61fefa1c8fbf2f9f", + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_access_layers/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_access_layers/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e7d7f58a1d24f52718c31cc560ba27eaf69da2df9e8b0d26516560b547d1d9da", + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_access_layers/tasks/redirection.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5b071a65a98718e6fbc859cf577103adc6dd5700bc7263877936d391639e61f3", + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_access_layers/tasks/cli.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9f6c838dbfabab9a13955c8980396720499a80a79a6a82103068e761882a013b", + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_access_layers/default", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_access_layers/default/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c8e82c716422654d049fd043bbf84d624ed532f96741e032f52f14c19e970d3e", + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_access_layers/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/cp_mgmt_access_layers/meta/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ec4fa30fc4a7b9e002d1c7b3932286ace72ba36e4f532e2cc79f49d07e0794c3", + "format": 1 + }, + { + "name": "tests/integration/target-prefixes_1.network", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "53fd85d0071b8d8efa952291fdbe92471e23d3f1682e48a11601c3b3026ff102", + "format": 1 + }, + { "name": "README.md", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "6c68d7a6ace4b5724523c6a5cdea22a235512b870cde9d9d735455e68c8e8fd5", + "chksum_sha256": "225c7284e8d203794ff907454c6a9d97eedbd72d9ccd591a72b9a295021a34f3", "format": 1 }, { @@ -876,10 +1310,31 @@ "format": 1 }, { + "name": "plugins/action/cp_mgmt_access_layers.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ef5e569fbdec1bd7cd1239cc8add24acdc4d34b55b3283a69155db7b04b9e327", + "format": 1 + }, + { + "name": "plugins/action/cp_mgmt_hosts.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ba303a07ea299224f35e956bfe49bef2c7cf648acf1bf6733b17a92c94bfdf1b", + "format": 1 + }, + { + "name": "plugins/action/cp_mgmt_threat_layers.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a61bd29c5bc980f71d52756e36c275aa1f29900e2b39781d4c2cf89461a8ab08", + "format": 1 + }, + { "name": "plugins/action/cp_mgmt_access_rules.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "b386b9c34c317f8b768dd14b38685f192193133eacbc697b438efcac7b010bc4", + "chksum_sha256": "57f906c3f108890c3ef6e5e3db760dbbe3bb3396990660f16fee35fc73e86d0d", "format": 1 }, { @@ -890,1221 +1345,1851 @@ "format": 1 }, { + "name": "plugins/modules/cp_mgmt_show_ha_status.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a8ff6082c5f431069ca3a40b3e775f53f6583fb96ccce8ddbb59938d6305aad3", + "format": 1 + }, + { "name": "plugins/modules/cp_mgmt_delete_rules_batch.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "a9d83471198cd03b7020e76694e954517f1c917ae232fadbf27a0b5a34e40832", + "chksum_sha256": "f03e787f3032f565564e7bf84a447a494ef0a5dec99b004889641b5f695d0506", "format": 1 }, { "name": "plugins/modules/cp_mgmt_access_layer_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "171fb23fb1f749e07026ca70e4fb09325da903bf304456bfd87de96546a95383", + "chksum_sha256": "9f78c122d97c050201bb39986ea46166ce43accc6adaa8521987559def7f81c8", "format": 1 }, { "name": "plugins/modules/cp_mgmt_submit_session.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "e36b0c9f11b584be7746a6ebdfee6621c50e690d24af9f849f55790e1d495862", + "chksum_sha256": "f2bd69b090222213a020b27755ab64ab4ff4e8e72598ba2e282761974cce5100", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_user_group.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9836b873add05b7d7856a4a2daf5538c0766788495647df06024a0e808777473", "format": 1 }, { "name": "plugins/modules/cp_mgmt_application_site_category.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "0a81499ee688826a7704465c0bb1b886baa28f6238a30e883b664808c7e5844d", + "chksum_sha256": "5a666da41a4c340dbd4edfe169efe574707312fcc877e483759d7010ec5b8a4e", "format": 1 }, { "name": "plugins/modules/cp_mgmt_lsm_gateway_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "13a319e643726327d88ae244f0b8972c5813d1d0e582e5d541eb4d77109252b0", + "chksum_sha256": "31017ef2cdd0279dad1ca5588be720b66141c493b3bcc075c774c6324d306a9c", "format": 1 }, { "name": "plugins/modules/cp_mgmt_check_network_feed.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "49d6701ba6a1169040083343ad5c54ead30cd4a734e7d603ff28b19da8841c1c", + "chksum_sha256": "cfb3e97e8f2bc74a918683046fe43e36ae0da5760fe1fe1437545f9bc2c69dff", "format": 1 }, { "name": "plugins/modules/cp_mgmt_delete_domain.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "fdc29f6ffc08f2391ecc2c5b9b659f31dc143dc130bfe365a61725c1d7b4d790", + "chksum_sha256": "3401e84ca50328dd0a43dc30d9aa36f379dcaf7117f25ec8a076c9f69a1c3185", "format": 1 }, { "name": "plugins/modules/cp_mgmt_threat_indicator.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "9f3c37894d82c804c315f34d1f7c93bfaf8b501db2020bdd4edee1b9418f255f", + "chksum_sha256": "caba98d856bde4f33195643556284c03a2280d19463748ce66ddb1f9e88e8ad1", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_show_login_message.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d7ac0f5332f6770d7582c6a23abf9848b14139384b04fd46904054b272b97672", "format": 1 }, { "name": "plugins/modules/cp_mgmt_lsm_cluster_profile_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "943b7657a6b4bd190609dcdf75b428a5745e969db504e185da983c40c0e77000", + "chksum_sha256": "ffffb15cfb822943a3721f14844f3abc599dae1a85d095c2f84d17e4af2e7880", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_show_validations.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "61a0a1e5e489cba91c5e8980df57f8eae165a02c1914bf86a63f0e5fe0ac6285", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_tacacs_group.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "cbc6c7b3ff121aeb58edf4eb71492593fb4207348e9bb9f2362f198f0d473468", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_lsv_profile_facts.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "051dcd0bb95cd9cc168ad8e62862bca79120ca7c237c567548c0e85b2fd5bcc9", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_show_cloud_licenses_usage.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2b0cfc6eeddb9e6e6b583bfb1db8048deb13ac36ce6e6044743c8ad4a39c8d3b", "format": 1 }, { "name": "plugins/modules/cp_mgmt_show_access_section.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "2aae40870d885035fcfb2ebfb86853374bb5e05bde0b6808275c10f3a188e443", + "chksum_sha256": "c619a61d9d0925202791b4d87f2cb20675ca0b789859a365b2b09b46270139d7", "format": 1 }, { "name": "plugins/modules/cp_mgmt_vpn_community_meshed.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "1cefd4b3ee98d390ec2098d144fe4931be0e2eb3474f3237303577dfad652b46", + "chksum_sha256": "a2aeaf43608b238b650e9617bd6774c28732573b3bb61e7fc2dcd05ea3598731", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_access_layers.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9d51fd895ad3c2a66c3ce5fbc0014301eeeac3fc43979cd32b8d99a817b72eed", "format": 1 }, { "name": "plugins/modules/cp_mgmt_add_data_center_object.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "3789b741b55996e79a35e2624afa414532c8c0d14a63c57679ad4c07cb488a9b", + "chksum_sha256": "98055d624aa80b6ebed10d49197aa0e782a5f749a1a3d57da517097779c5d73e", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_smart_task.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "706c253fdcf73da7a3adae1516d930a57d5eb3800adb01c0ee4e7d2ef369ee0f", "format": 1 }, { "name": "plugins/modules/cp_mgmt_simple_gateway.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "b429e06323dee772402e16a45d559c56fe305a35c0c11884b6d103a176677770", + "chksum_sha256": "ec708804d2ec8cfe6bc807ca55e2542cd7424153d216dcd97322644b8eabc63b", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_show_global_domain.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "74d07eb2a01ffb6dba1263917a2e87a8479a8334dd0e229f4efba0bb0a9387a6", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_show_place_holder.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "994e408a07567485cf528498353972d4c02c63f892b350cd065556d02ba1a969", "format": 1 }, { "name": "plugins/modules/cp_mgmt_vpn_community_star.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "db3208d4d7e744690cd05104387f054eb52f675f2d9780c224df1d5aeb55e4c4", + "chksum_sha256": "15e0dd737b01b086d577de29e18796c500a6274ddd74643de10143e1f3e80764", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_show_api_settings.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e742d18abd70dd69942a77eacf5b782ebe568707a8288dd6180a58ce12612981", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_radius_group_facts.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "732ea4aeb67fd858fe177bfdbe4124903bf72f65212da1d7f98c52d8ce012ae2", "format": 1 }, { "name": "plugins/modules/cp_mgmt_add_rules_batch.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "324163f65fa5213654e5d92a3d269888f7498a93ee6f0dc9ef9540157b2de9f0", + "chksum_sha256": "a3387fed0f3f07f1847a1b8c77932344a496b40a64030fe9d10ce171bc9441f7", "format": 1 }, { "name": "plugins/modules/cp_mgmt_show_task.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "887aef1feb38dcea3be44505478a08f74d8c1084e9af7d0aa140dcc620710f7f", + "chksum_sha256": "3ad8de709a7c41e2cfa8806f4c83072238fdbabe16bffb3efe964b380aa9e386", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_show_ips_status.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9089cd808ed3ca09804fbb3cb4f123ceccbf0fd54ee8f0d1107e7bfab58966c5", "format": 1 }, { "name": "plugins/modules/cp_mgmt_time.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "facd05735105a9ae3b42c400ad31e389a2d56d0624613a1c131a7ade64158686", + "chksum_sha256": "5dd520e8516e1ef63c0d917b70abb11d6ff51c1b9b0f7e66ba20eee4ffa9e38b", "format": 1 }, { "name": "plugins/modules/cp_mgmt_show_cloud_services.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "937630770fd80f547eb0b70152fb2bd2bff19cd7f4cb23c1b623d053d1524bb0", + "chksum_sha256": "7c9c1353e5b9b85b42c7810eccb11e640df1030359d9d386b2ba8c6fbc130de7", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_get_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5d82747bbf8bfec69c085c8c6f2f73e640969fbd511505f23c14efb3ed4f22f1", "format": 1 }, { "name": "plugins/modules/cp_mgmt_domain_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "f454659c5ffe5d2204df4621319e9c16f5eb8d3d1e30d73981056d1aaad6c790", + "chksum_sha256": "c44457a2cfcd4a2b95ff8240a8cf512979b9b82ae1a8a13bff12b30c57fc9e4b", "format": 1 }, { "name": "plugins/modules/cp_mgmt_access_rule_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "7d992bd6c92526d132ff6e35ec402cc4de2f29771d69f05a8d2c378b5985759f", + "chksum_sha256": "abe02ada5cbe0413c121bb1d11ba01b3b6369da805062da41f391c2be041713a", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_gsn_handover_group_facts.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e6cc21a9bfeae54648cb9fbaf3af5260ae129093acfb14a0482c7d07f99513e0", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_abort_get_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "59a6eee31e952ed355c4b5397f667087412ea2aa0f728363a495e77976d9996e", "format": 1 }, { "name": "plugins/modules/cp_mgmt_dns_domain.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "fcaa237d703eab5714df13f579fed1c046440fadfb32a2109a4c8feaf9b466f0", + "chksum_sha256": "33ce8abd508d4106895c6d9c1e94872289833af2709205058674b47b8b7f8d49", "format": 1 }, { "name": "plugins/modules/cp_mgmt_application_site_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "f3f6f3398649bb7f1583340dcd08fac981befd12fe02fe64a61d60bd9b004177", + "chksum_sha256": "0a31aab718f34207973ddd45f3f02825b240f7cb4b3cc7ff1bcc86cc549d7741", "format": 1 }, { "name": "plugins/modules/cp_mgmt_connect_cloud_services.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "ef415a624b9e1b0bcaa96b79dbe291c88482386a8bec0ec377bd52509b42c226", + "chksum_sha256": "8ab8dfaeb8d03bb9e3fee0e03f492c8751ce5afe6f78d22c9fac42db8ed1fe9e", "format": 1 }, { "name": "plugins/modules/cp_mgmt_trusted_client.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "7b0ebba6c2a135f1fff36f9d9fb111d4c38a5594d2cbbdd6e12796040dfec95c", + "chksum_sha256": "c16fdbbc17d3c4eda6a7c25e0f160fd7a5d49bd0c09c692ab9c42cc863a008e1", "format": 1 }, { "name": "plugins/modules/cp_mgmt_identity_tag.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "a8b06561ba01ff62197816937d060cc347ba7898143e3959da49870821ca24f5", + "chksum_sha256": "05dab07e914ac22513a13bbd6a62c353a64501f9e23cb7b3ead29389d610c8b7", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_service_compound_tcp_facts.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "190b412c62b4a54a03fab8cf1e0a6b1dc0efff201ec980e72bf2fdf544932a76", "format": 1 }, { "name": "plugins/modules/cp_mgmt_service_rpc_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "c53ad5563ec27506f8432578551ba5020063fa886ab3c88155cb3e97e5a2addc", + "chksum_sha256": "2097425be553f5cad6acc746adcb544626d09d8cb759674007ce2088b958c311", "format": 1 }, { "name": "plugins/modules/cp_mgmt_service_icmp_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "f373977a06b500b5f30a205f84fd0440516a627adeec24e0f2e26ae4f99d7b9e", + "chksum_sha256": "5a1544fd76441e2013f24493eaab19b04dcd612946e0107cbc38be5ad40bd0cb", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_set_api_settings.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8fc5e66741ebddfae59501bf6a5076fba72ddaa75e9f4bcdb1c9fd53f83f270f", "format": 1 }, { "name": "plugins/modules/cp_mgmt_interoperable_device.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "4509992188a282f02c8543b5594a818aa7182590a06575ebab3fa2115b3e70f7", + "chksum_sha256": "d333bcb84fc593f99c5aa9998c7a5f95e64d939d89e55fb019f5a875551616d0", "format": 1 }, { "name": "plugins/modules/cp_mgmt_mds.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "39000d01da0a99362adad5c0babe4e9d5d00d0aebab1eee22931cbd1a090d601", + "chksum_sha256": "b3b7b406a40186243a21e5186a8a69cac3c00367941d1e7b2080d6bb92f17e89", "format": 1 }, { "name": "plugins/modules/cp_mgmt_threat_protection_override.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "5f214163d14d8d23a16ac5aff7df1705dd35b8e14aa8bc31bf35fc0a9bee22fa", + "chksum_sha256": "714233e3071b4dd5e857755bc085868085227f051e9dba1b3ad2bc91f4d529d5", "format": 1 }, { "name": "plugins/modules/cp_mgmt_https_section.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "99e0d77cffcd9264e1ed40201a59d87de1cd69adeee1594b72af34ffb2873101", + "chksum_sha256": "c659ea53131d4aa59ea3ec8b3167eff0b905fc3137a7f93868ce208d2884abe2", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_smart_task_facts.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2e6e3fd6bbd168407c85c314f8076c7b8bb9bb11d1940ee8bb9ff7aa58e1733b", "format": 1 }, { "name": "plugins/modules/cp_mgmt_threat_layer_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "dc34062e8e99ee489e3b36486456c8ddb87aab04f4f2a4f1e3eae75af2a6f40b", + "chksum_sha256": "309c39753795c4c09b50cb2680dd5d2e35c299d4ac799fe416250a039086ed5a", "format": 1 }, { "name": "plugins/modules/cp_mgmt_show_software_package_details.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "1edd3b8bed16d1638ea941c5bc458ec57840a191839bd7b8fd17411c7aaba344", + "chksum_sha256": "32f21df29069764afb4334a96da92afa3b529c9fc97082fdb5571887d9f94ac1", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_lsv_profile.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "fa0761463df1aa0ee7ac20fcf7aa5d35ec0c4924a31b3b92d29321fb3fea7316", "format": 1 }, { "name": "plugins/modules/cp_mgmt_show_servers_and_processes.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "b3a973f93391605949875cabbbbda8e352e3c5e7e42023d917ccf12eb45b260a", + "chksum_sha256": "d2dec3e5522236e33d0874c03c35cda409c56e60eeab8eafd20fe95a7dac9bfb", "format": 1 }, { "name": "plugins/modules/cp_mgmt_access_role.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "d4bdefb6b276b657bd52568e90cb7e5a576fafe8cd227a38db3554dd78399f7f", + "chksum_sha256": "8c50879650bf7c18b29e5a39c1dfaaf7de4aac254cae8973f8465ee8bf38969f", "format": 1 }, { "name": "plugins/modules/cp_mgmt_application_site_group.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "90c780e061bd8ede6c2fb8e35507327de04db7400dcd973a79e1cab1a51c2470", + "chksum_sha256": "411f8397dd67a77695b911d4ba4a057277ce239de49794c14a9ea55f161f8c15", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_vpn_community_remote_access_facts.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d7751f6c1efaa3c01c76d899a6301a0f1cab5c6ff0ec225d3836dd8a939032ee", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_ips_protection_extended_attribute_facts.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9348bf971aaaffd6514eaba46203eba5c7fd62223671b80e9ffd236c82140feb", "format": 1 }, { "name": "plugins/modules/cp_mgmt_smtp_server_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "e27c103f2ff7e7f1d2fb57f9f4b88e5ad70f963a42ca59a9dcb0864b18d5e576", + "chksum_sha256": "530b1695da52180de31b45ce601da4bc5deca1d9b391aca68b93734be3f33b15", "format": 1 }, { "name": "plugins/modules/cp_mgmt_lsm_cluster_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "9a4dd3d63972084aa639317710269d59345fa0c73201434568016da392c2c485", + "chksum_sha256": "0d65154f9373ccfc9c09211461ea1ac3ea62d45d52d97270663ddde9d01a083e", "format": 1 }, { "name": "plugins/modules/cp_mgmt_update_provisioned_satellites.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "405b74f7329de41ee71b9a534a717b9ac05b333512ade3a86716ac915cf12d8f", + "chksum_sha256": "781d5a62ad3376ae7510db1021f178881a58cac032d8d97f51ff361dbc1a1aac", "format": 1 }, { "name": "plugins/modules/cp_mgmt_service_dce_rpc.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "2e7e9b8823fa8e88f375e710f95f5f61a7504f525eb21d1fc4852ae511ee2b8d", + "chksum_sha256": "a2ba15ea61eef8ec411a22115da36118884e25e96fb2ff324bb35c7d949fbac4", "format": 1 }, { "name": "plugins/modules/cp_mgmt_install_software_package.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "1181b5848be267ee218a0343b7ec3a94641bbf29c78e8deb073279a2d2e5b512", + "chksum_sha256": "ccf8f89516225aa84111d755b241bdcafc71ded8735cd92d4bdbd33fb81d03f5", "format": 1 }, { "name": "plugins/modules/cp_mgmt_put_file.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "d6b98967cecb76370f6b27474bd93512cb642552f466232c2932078cf430b41a", + "chksum_sha256": "24121621a821f1d5882fa4a2692c57fb9b07ced52118132cbee120e344e092a8", "format": 1 }, { "name": "plugins/modules/cp_mgmt_threat_layer.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "f6ccd6ebbfb487519f2b0fbdc436c739e8724bf5d2c71ae9af56668e0a7906f6", + "chksum_sha256": "5c8a35ede9726ad63563339f3f2cf27114f1a4355a3476ceda67cf6a0eb4e2a2", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_access_point_name.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3630d0efb52cb26991c90dc933baddf1d278e38174a1194bad22f3230a85e53", "format": 1 }, { "name": "plugins/modules/cp_mgmt_show_https_section.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "9e590c8c797522518ba099e4d78ebede56d8cb4dd62321ba954350ebe4fa66b7", + "chksum_sha256": "88d5cc801464b7450d8a797e6462eba2e3377c7adfe35cf7941a2847e6ef4b79", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_set_policy_settings.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "69d7c356dfdbc733d6a822e51f8cac5e66ddff3407237a0d6666c676e533ceb0", "format": 1 }, { "name": "plugins/modules/cp_mgmt_application_site_category_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "471733c95c7aa301b32a51f95ef1dff11ec1094435faf0ac8ad9b7aac2fa63a9", + "chksum_sha256": "ef5b561408c9c36700ae0a73206ac53c1eb057065f6b51b809121e1c75391d3b", "format": 1 }, { "name": "plugins/modules/cp_mgmt_vpn_community_star_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "ad9eb05411dbd700a29609ed58252e3ddb4d12b07f278b5ed88dfe71e76ab5bd", + "chksum_sha256": "e7eb86fdda4018f2f663894b217b6ef2cb1d1a2d2f361d919f31b3bb7aeaca3a", "format": 1 }, { "name": "plugins/modules/cp_mgmt_provisioning_profile_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "ea81e2e2f98cc359bd6762565b4f2ec953214e092b9598fcd57b4d5bb2188629", + "chksum_sha256": "cf82c04143137c39fe7a204bc1f4a28fa15f9034953cc70ac1401deb8bd982ea", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_show_ha_state.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b95ae11cefc7f27de2e03ea1f71b52a7da84128a531862210b1f1b8ff5fe825e", "format": 1 }, { "name": "plugins/modules/cp_mgmt_service_other.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "2371819d17334ff79681e6c733cdf4e20817e5c87cb738cbf0cbe1e10a0ef898", + "chksum_sha256": "8678c770e3e9e1d1e4e7ff6004adabfdb5ed63f62b506bf2d846cca7c9eadc71", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_delete_repository_package.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c2e69f34c6ac262e7f24207fccb174627841e77f68a3ff54c340ae3abd7ba384", "format": 1 }, { "name": "plugins/modules/cp_mgmt_service_dce_rpc_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "e22c1b3dc454955774796a0383bf90ee58935c492c7ee36444d9ce5c4c01a045", + "chksum_sha256": "0972be392b0020312996e68de3df5b703a9d0c7a42347adfaff33ee74520617d", "format": 1 }, { "name": "plugins/modules/cp_mgmt_wildcard.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "97f5782289fa3b6ee576f225d72709d0f20451d221156dfcffff835acee86519", + "chksum_sha256": "b6f635e7a6529bc824784d81b178eafb629569a3d0264c12f953134c2a5bf726", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_central_license_facts.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "cc9b90d60f13ac5eb1c7ab04dd7a142a6cefffa7b2dce0289875d6da4c9d0439", "format": 1 }, { "name": "plugins/modules/cp_mgmt_service_tcp.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "c69f230c24d4a1f19da1cb8464a4810caf7bdf8f8d10bfd1699d2ca29852f912", + "chksum_sha256": "88368e7675a68e627a40397ae596be1fef3b7528333e7fa8c4f91a6fad95470d", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_show_software_packages_per_targets.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "641588cb6df78888b8795454e82deb0e9f2a3a136b8189b42bfd6ccd4aae8757", "format": 1 }, { "name": "plugins/modules/cp_mgmt_nat_rule_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "9fc75780ee76dab171c8e4999c6c0db35cb618207885f7568cc0fab0132a5378", + "chksum_sha256": "1cf61287378860d2ac591200d12144df967d189e9253e6985b663c6a32bf2cbe", "format": 1 }, { "name": "plugins/modules/cp_mgmt_add_api_key.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "21f8715183dbe63307ae9463d9075599381f40f38b86823d456205610c4d1c45", + "chksum_sha256": "d2edef204dd0266f871ecda01139a1fcd2af2beb9e9799640b3e93bcd1b13d05", "format": 1 }, { "name": "plugins/modules/cp_mgmt_service_udp.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "73a4754e213ea6b36d420806b52e63e399a20142c655141415ea8d8364b87222", + "chksum_sha256": "d18e33877bb032fab5e102da6450ee635c6c234aecacbcb92a9a8f4dc99f6868", "format": 1 }, { "name": "plugins/modules/cp_mgmt_approve_session.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "26dd50335aef9167b738cbe532761d4fca92ac21ac10f93c1a5230d15adf033e", + "chksum_sha256": "3fd8b572461415c932d22394158b9c470e39ed1cd7c178ae8dc39a6569585941", "format": 1 }, { "name": "plugins/modules/cp_mgmt_add_domain.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "a90fa661a89fe72b6e83e9c7f76c619d791577076d63bb4f1e33bfadbee4d55f", + "chksum_sha256": "5c5a5b8ccb94f216fd10a4ca923c36050ead7e67670b16e18459a879336ab0ed", "format": 1 }, { "name": "plugins/modules/cp_mgmt_application_site.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "7de337599b184979c37915a4471949790cb6b5bbfe6a280fcdcfd1b223fcba1e", + "chksum_sha256": "84abaa6569ab48e7a670525ecc984d3f5abe51927bbf56b08a7ee9e73b5d2c09", "format": 1 }, { "name": "plugins/modules/cp_mgmt_threat_indicator_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "96f753e4b63adc4c23f49828ca30448f71d2fc88199b18139723f745d7a86c12", + "chksum_sha256": "8eb003d5e66d9ac2af55ee4a566454e7cba30993c1cf773f6462c73ee35210bb", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_add_central_license.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "68a28ad87963be96eb16b00b90d04b7089f98f9e70c2802d61148b843f458441", "format": 1 }, { "name": "plugins/modules/cp_mgmt_run_script.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "21e82c83f76dfb742a70e1cc7aade6480cbdd5ad581ca80782ad09922a724a26", + "chksum_sha256": "f723b72e01586e46390664aefac5a111448c7e0f68ad92db55dd1e04e58d4ccb", "format": 1 }, { "name": "plugins/modules/cp_mgmt_threat_profile_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "97e2bd74ed4d347eaf0c582e70477df8b21f623805487b5eecb895fbfeda3006", + "chksum_sha256": "65c7dbb4f76b7aa96a5f602ae16ffb96e6737824db8ac74f3cdf6e86af5b6582", "format": 1 }, { "name": "plugins/modules/cp_mgmt_set_idp_default_assignment.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "8f0811c34cfdf8ac6cf0c7778465a9b1de69a1848c68b3996f81c0c12dc21508", + "chksum_sha256": "9b661d4c3a09ca2472f034dd014a3fa183af647d2beff8c774ae73130a706714", "format": 1 }, { "name": "plugins/modules/cp_mgmt_service_rpc.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "60b84b152bc7dff5e532667f2e8a7fb658bc642b357b1a248334f3d24a08f85f", + "chksum_sha256": "4078e99c03a26b3deb2829db0f340df66f8d36a723416849aaa8b5c0f046191b", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_distribute_cloud_licenses.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "408087710a9184991fd7714aed7d653806f31454623bc679766b1b6d63e1c384", "format": 1 }, { "name": "plugins/modules/cp_mgmt_md_permissions_profile_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "a420f27c17fcc4c503db294f860d8c95b6eee217581e6f4e63213bfe89b08305", + "chksum_sha256": "e84a01e018145a334468f9b0b132710e2501f9704383bd6b812685de45dbaa80", "format": 1 }, { "name": "plugins/modules/cp_mgmt_exception_group.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "98e86f55c1fa6bb6a5ea6cde6ef6731e476798371782324b9d3416041b6da534", + "chksum_sha256": "1a03610fd31762401d44e31b20427beef256b035bc49374be3f0d7f7ee51b541", "format": 1 }, { "name": "plugins/modules/cp_mgmt_access_layer.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "b9ea2b1e98702a956b0eaf3e3de8148c9dd8720248ef1fefeff1870613cfbcb6", + "chksum_sha256": "ef7c75e8258c7761993293d59a2b4bcbadf6233c92b1022eb01df23ef59c98ed", "format": 1 }, { "name": "plugins/modules/cp_mgmt_application_site_group_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "3576fa51958dfbcf9de7eb6248a89c597dcd0138339d53c86c2a48ee1a17d7d2", + "chksum_sha256": "203b36b6312ece74ed1b358ec430eed1b63c744c43d80e6b2b8549f44e98cf71", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_delete_central_license.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a61927d39dfb5597bc11514217a9be961e334f45a0fdb46b05055cc6ac05e124", "format": 1 }, { "name": "plugins/modules/cp_mgmt_repository_script.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "7a2f78ab5e73756f71d1f80e262d90071b9aeface2aca37a27748e7e06fcfa96", + "chksum_sha256": "9eac332626a7c34a502146540b57ef8d93f4c73cedf62df7f630a291d99aa485", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_tacacs_group_facts.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "185f1d33ce07ee5e1ca5e481860d40bf48734d37397606ae369b4f4263f3b5bd", "format": 1 }, { "name": "plugins/modules/cp_mgmt_tag.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "45071e35d9a8672afa852a9964cda9a185623898adda4ce5401e5367ed78e788", + "chksum_sha256": "703ca5266350506c73e4bc756e74878cbaf665360a6731d659022b84eb56c108", "format": 1 }, { "name": "plugins/modules/cp_mgmt_show_global_properties.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "f1c04a6cfff4c4c89bf04157a523dd8659082ba8276a36741bf5a85e70065a53", + "chksum_sha256": "acae3129c7315cd37763eae8d2d716e4f33c16d22ab214a70e476361b6028836", "format": 1 }, { "name": "plugins/modules/cp_mgmt_mds_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "bd7aa7bafebf5b1e4d31982c54a9daf0116beafe49f10a66cbca2e0d456355b4", + "chksum_sha256": "824a15fda2d08ad097ae51eee3ebdd01b89f4ef1e0bcf9aeade74b7365c32769", "format": 1 }, { "name": "plugins/modules/cp_mgmt_multicast_address_range_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "bf8d2a039d275729920d7af312af3f6b3c9cf22b9b895d94307fd354b0625930", + "chksum_sha256": "46463266a0f2c4482a143c1ce21a665c4bdede21eab356b6917760ecdf2a531a", "format": 1 }, { "name": "plugins/modules/cp_mgmt_package.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "f578b392753fbec21c225ebf3ae56164b429536a5adda6da49ee33eaa28a202e", + "chksum_sha256": "1132e01729e341df1cd0762ea7b68f6c38be25e9839c7d6f869961d950d10de6", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_show_ips_update_schedule.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5e47de0978212cc7eb2cedf5e577593433c3daa01cce178cb1072afdc4287369", "format": 1 }, { "name": "plugins/modules/cp_mgmt_security_zone.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "048b79a48219d72258aced34a87ef8bc1b40a83d3f9b22466f5801a7362e6d86", + "chksum_sha256": "e20fa1928c36d88b4e9373311b9645f4e2e99e57f709a57d5228aa49f300bee3", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_show_api_versions.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "232da663391ad357d92c9bf1c37df5b64fcabcc60489e66af560b8f5257421b3", "format": 1 }, { "name": "plugins/modules/cp_mgmt_group_with_exclusion_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "ef23cdfad8413831010494cebd79674272db2c8296e2c7e361e38e8a23354296", + "chksum_sha256": "536efa39e51255addd9cf5e0cf05a517bf7d75fc602ff5bb653162ac77e100af", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_hosts.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "138049fe0e7517e3f22fdd7cd1e3e989501706d536bac34f34f7e514807fcdc0", "format": 1 }, { "name": "plugins/modules/cp_mgmt_nat_section.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "8cc60a79299e73274e9973ce90f3ac099f324417343e66eb1cfe92bc09b51597", + "chksum_sha256": "4b7683304fdb3072906d4563a4afe9a429bf928e23772a25908025a6110f4fd0", "format": 1 }, { "name": "plugins/modules/cp_mgmt_reject_session.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "2db9e2727025cacd6a9352aaa937a9b8c4f07f2743adda4fd6f6129164a2d3bb", + "chksum_sha256": "3b8cc95041a4867ec5ad575362760dc548cecdef82c718e81f67a9ee6e05531d", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_show_unused_objects.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3e831a75e07ae5ed1cb0b47e579baf4bea66cc8cf6e7e85f73a72f7c37601e30", "format": 1 }, { "name": "plugins/modules/cp_mgmt_disconnect_cloud_services.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "a84fa7756b95b80c7729f0d6a71d735889f4d72d36c7ec2e966144a625ec59be", + "chksum_sha256": "5f8f54e832799ff95b7d35c5fa26fd4513522891fb9bfe929aac2d9b3ed91262", "format": 1 }, { "name": "plugins/modules/cp_mgmt_service_udp_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "bfcb35e740e202460e81d3a93a67bcd68a4c8db8b77d24be59a4137f37eec05e", + "chksum_sha256": "b7f29fce230484acf715aaf46b28acc10210ac7f2312c3b4326422fc8e98aac5", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_time_group_facts.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9c51a41624b7afec29f47caefb72dda0312848295b354aeb2fb0ea0b2d68c68e", "format": 1 }, { "name": "plugins/modules/cp_mgmt_package_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "841bd096b54b76a0e0dd470292ea24c084fc152ceca370e9c415bc89fdb826db", + "chksum_sha256": "fcfbc1b024a9aaab67d5c88d89a1bad625622e260790bdc4388dbb85394bde9e", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_access_point_name_facts.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5b5fe22f5ff72a22900a2b10eece061f0b8e9622186c54a72a6e430fb71cf7f3", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_service_citrix_tcp_facts.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f5c43e67cc2c92c14911489eb75127ce5df263df562c05cc74ea79fc9e66c091", "format": 1 }, { "name": "plugins/modules/cp_mgmt_exception_group_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "2944e2f363609b4e6a90ce10be20badeb8552e3b6ad4382a8024c9a791e4a40c", + "chksum_sha256": "aa69bc43e9c53f77dfba5ad90eb9ccece4088c8f6e99931701c7c12c05e1cab3", "format": 1 }, { "name": "plugins/modules/cp_mgmt_simple_cluster.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "53b2a521b0348d4c606fdf27ef1fb5ba55fe83fec79dae8a35fedd5163576706", + "chksum_sha256": "391c782287769287318bd0f758316b687619c825d2c7bf5654ed7c8e41cca50e", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_update_updatable_objects_repository_content.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "fdcdd6b79a87f757303c4d41db8671e2ca1c198f5052c7b646f6a19638fb897d", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_set_login_message.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e166e998b06c48d3820441c2198f2bc2711d692ab18377be4825a669c620de34", "format": 1 }, { "name": "plugins/modules/cp_mgmt_access_section.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "72dd6cd6fc94f2fb3bfffb244bf3908d4d3737a4375bfd7f3f767769a89d002f", + "chksum_sha256": "ef7cb366e704a7f4852b960c1d36151d5a3b775e21b7f4a2faaea224d34d5890", "format": 1 }, { "name": "plugins/modules/cp_mgmt_service_icmp.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "94f13f1d8566386e3062c0264edd12f77bf4495b6df09411d61791ff477b43bf", + "chksum_sha256": "5ba533cd350c09c50c14e105ce324a59e491c45aed481c827ea7a32eaf4d7401", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_unlock_administrator.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c21ccd6d047782bcd32ec9bc5808e229e401ef67184c39920a6383e2042471ee", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_tacacs_server_facts.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "be1bae089485eb091ff72ebb021cb33359df037389774cf62dd38981bf37f429", "format": 1 }, { "name": "plugins/modules/cp_mgmt_set_idp_to_domain_assignment.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "7b63d509fb4d823dac6027016833e717bf984b9d5cf666c1a058bc46d7cf7438", + "chksum_sha256": "8ce79487ee64e7ed78998cabebfbd6b5150fc076f089b81edd658f52e9761e23", "format": 1 }, { "name": "plugins/modules/cp_mgmt_group.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "51c02c1f02895bbe4ae9293cd9e7866ce498d253fd1939f0d4b54ff387570520", + "chksum_sha256": "cc02d6d48ac75b8275b409ffa7e0bbf915f7267eebf11b684e85c3808274bf3f", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_tacacs_server.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "eba0d0952885b95137af824b893ee405f59120afd17954fde5f3521ab8cce86b", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_service_compound_tcp.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f6ed08c341cf8145134d8598bf4fb1c48a8a8a46fa11dd31b88e52c82c83f07a", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_get_attachment.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f245e9309ed966e927e003955b2a3fe9dac7a464b69c767b0f8722421a631fbf", "format": 1 }, { "name": "plugins/modules/cp_mgmt_set_threat_advanced_settings.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "7a98029951b04c0821dc14fd22c5c384754f62059a70e4402409ba0c880ce247", + "chksum_sha256": "bdc54d2f8ef6ef6e44da8f60d94e36e533a599e0d4a2cf16bc2f577bfcb2408a", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_service_citrix_tcp.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f2cd20c8bf41baf598b678d3eb4d23a8de472bf1fbac3033dbb18e7bf00927cc", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_add_updatable_object.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "62234006bd93b89b9f5dcf3343a6095189d4aab29e8b5797ab14a170e247ffef", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_smart_task_trigger_facts.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e22c0a3b8a7c204e51b9c38fa539d9a8352d471ac51219310e8f35f4303cdb22", "format": 1 }, { "name": "plugins/modules/cp_mgmt_interoperable_device_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "b39d497b2e1448fa4aa8efd17f8daa15342700531f25e71b2e17b1204f670f82", + "chksum_sha256": "552a9ad6d7f6e344198ae769847f0dcc63a20d2d30b0af375a19f26309c60149", "format": 1 }, { "name": "plugins/modules/cp_mgmt_group_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "b7f763c5f4927f038b6e25427412f97c358101b9a8352563a079a4f80374d264", + "chksum_sha256": "6e168ba300ac27da68c0312d942739404e2bbdb435eb9adec6ef298594be9855", "format": 1 }, { "name": "plugins/modules/cp_mgmt_group_with_exclusion.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "a0261b665775df84382da05f8be5dbd6f5d4b56409c27be01b40dc4c84650afb", + "chksum_sha256": "b8801699f77e2b928e3148d58d01a7b133be1f4ec8619bfdae57014e02734229", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_set_cloud_services.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "fd18fd8934e64e29ad846c27078ea35d80bb92432c7a19a2bcd00dcfc3621274", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_radius_server.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "08e84c024907fe78d1f97f478b2f8a0d02655287ad9c8394f8a673d024f9a6ec", "format": 1 }, { "name": "plugins/modules/cp_mgmt_dynamic_object.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "ee1a62e868ad7ba5df96680a7b57f93798fde3c81d9b79c11a1d52fd3426cde3", + "chksum_sha256": "30749a7428e3cde9cae9cd0a9c7f8ccaa307e35164ebd86a5ba5d56033c63f31", "format": 1 }, { "name": "plugins/modules/cp_mgmt_publish.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "ba82cdef88bb83faecf71c4dac7fe810db7a4ef473e6ae48adb61aea95daaf94", + "chksum_sha256": "a04f1ebab81fa379005c6ef59159b515132372ee5761e4ec16ae7109944f2357", "format": 1 }, { "name": "plugins/modules/cp_mgmt_host_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "9ae3bf5f65a631ede05fc0306138e4be4981bb803862f153351edbf2ba6d3ccc", + "chksum_sha256": "c309a62335a98d4de43104032d6566686424b12fb788fdd07273e625b832b8ed", "format": 1 }, { "name": "plugins/modules/cp_mgmt_lsm_gateway_profile_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "ea19f0f8f803339136d2988cada8619a2676dbc1a0da075394fe4233a02557de", + "chksum_sha256": "d4efd4fd7fe89ad2b88edaa6e934dcf29fc98f007bcd73d43f88129276901ac6", "format": 1 }, { "name": "plugins/modules/cp_mgmt_smtp_server.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "d5ab1fcfb0ba69384baafecfc3c1d222973fa70008a5df4f06b7e8e8a221bb19", + "chksum_sha256": "46cfaffdf70b0a4d2f46cf466655232cab3c00435d65c9c72eb848840f544685", "format": 1 }, { "name": "plugins/modules/cp_mgmt_discard.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "9a8e67f783b97b1274127b1ffa5bbf249ffaec2294fb2ba8ed2b8ff1c5099042", + "chksum_sha256": "523de7b306470202592d355e50ffe433854f78f2cb9962af0c82753d43d97765", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_https_layer.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "da1404ba720ee93c5f2c9d32bf1c4fa7f28281b060f4004ec47ca8f285ac1a32", "format": 1 }, { "name": "plugins/modules/cp_mgmt_simple_cluster_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "4260fe6b13a6616efe130eacb008bc45d36f115d42b3d74382d5ee5f958968a4", + "chksum_sha256": "9cd3d304a2392bcad06cec7aac557ef4981bf507432427f8f51d236276eb0edf", "format": 1 }, { "name": "plugins/modules/cp_mgmt_administrator_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "5ff399e430177d2d365e722f80057ab5cd27ec1835cff3fe747d9b6e991196c3", + "chksum_sha256": "a5abaa2388a63257a65c2f817482c61c4f8d919207ddb6ab8ffa91f116e4e85e", "format": 1 }, { "name": "plugins/modules/cp_mgmt_check_threat_ioc_feed.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "53541e0c6452fd38085273fd75904c778e03990f545c1f485d6648a9db43de24", + "chksum_sha256": "6c13cfad3375909ae3c49664e10aef50ed820d2fa031140ec848935639641f57", "format": 1 }, { "name": "plugins/modules/cp_mgmt_set_session.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "ab849840591afc7ffaf577ff153f19a732d36ed4014ded6ba3624e120a6798e6", + "chksum_sha256": "860805dd8af0278f4fa0c24c201d3ff7c0c03b02f591ca35daff5738d7b206db", "format": 1 }, { "name": "plugins/modules/cp_mgmt_threat_profile.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "f7a797ad2c11a6aef0cb07ade9c4584ff36f3a58cb5604ce2095e253eb122364", + "chksum_sha256": "5f730cc4936ac6835e48b60591cf1fa723f81ddc38830b54b6b3a5eccc55e50d", "format": 1 }, { "name": "plugins/modules/cp_mgmt_uninstall_software_package.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "fbbec07c3f792b3b0cd8eb02e824d3037371ce35200eb65019cf3e0aeace6329", + "chksum_sha256": "bbba2c9f3a1ee2ae83e66b739724617c38fb369cdfc32d10d59847b8bfa3c7cc", "format": 1 }, { "name": "plugins/modules/cp_mgmt_lsm_gateway.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "c18e23576612a2d0534188bb106c3abb1defc41b00bdef4898bf64abca492d4f", + "chksum_sha256": "b4283ddc28d7e9aef891e0508cf583b76127d9d52dfbd589c4e358f66db6aff1", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_radius_server_facts.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1f7f22f845fb2c7ea67b444215348b91a9fb3240d4aa9615667c9852757b4509", "format": 1 }, { "name": "plugins/modules/cp_mgmt_install_database.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "1bea96e1221b931ce21ded6e7fde15cb1ed4e0d0789e9df7a4bf2003d674c5d8", + "chksum_sha256": "140fd87e11c4c24410215f2da0665b824a63a9540478bd00b35166acf788bc4b", "format": 1 }, { "name": "plugins/modules/cp_mgmt_host.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "c41329540db77bc17576d17d1d9ab75fc2ae55af4f2a8a365fcc9660d922c78f", + "chksum_sha256": "715a1eb1652472cf97e3297714c531775e7bad2c7e0ff34cca239e80110232c2", "format": 1 }, { "name": "plugins/modules/cp_mgmt_administrator.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "f3895645e44528aa74ca07a5db3ba7b5de83aac65d6c200749ab486c2134fe59", + "chksum_sha256": "e8363842be576f9a32ab39d7a739cd6dbf7ca61d14519606a7a21a82b619dc8e", "format": 1 }, { "name": "plugins/modules/cp_mgmt_install_lsm_settings.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "16349ef732256500716ce5ff12519b245b29c63c991cb3dd114a644537dd28ad", + "chksum_sha256": "77861c3991a6a8aef6963a964755e94711f2e46509354ae3944a3a3e6c2b5da6", "format": 1 }, { "name": "plugins/modules/cp_mgmt_reset_sic.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "66dead32556ca9fa4c81eec169c9453b56713a2757e491fa1a073fcecc07b52b", + "chksum_sha256": "91db6a08e9b39ed3767a389486ce9a4b1e7bc505a6beea31a0e3f5177f83f797", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_add_repository_package.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0d86f1107072b419b3c1430ebfab1a63b7ba2c65cbedfb481268f0ce5a3d69d7", "format": 1 }, { "name": "plugins/modules/cp_mgmt_service_icmp6_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "ac9e3938a4e3ff4104295ea83eda76dd543934fd1d667b46d5907ae379f1119c", + "chksum_sha256": "8bba285e7d774f3717402c195ac8f0a696e5b3915f01b9d72effecf55df8c3d3", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_vsx_run_operation.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a2c14b582a8a36a7bee88c231ccc1e0e273c14abefbccace0cc42dd0ec868c81", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_set_ips_update_schedule.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "bf5b83eb7f92f186ab9f14a0be071f6b97b0e20ba723d0fb79f2a49502421220", "format": 1 }, { "name": "plugins/modules/cp_mgmt_address_range_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "e0caf28ac8be6724706b1de016aeda9cf12e6f136324eda258c170d73b8643bf", + "chksum_sha256": "c000c88c630e098284df0f6bc7cc1c49b62765503d4a48116bfd97b0e09b9a1e", "format": 1 }, { "name": "plugins/modules/cp_mgmt_objects_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "aa1e7f01027282e78ca79660680ce8974792a37e391cab2ef94b933649f02d88", + "chksum_sha256": "5ecfa99974bca52df9c5c12179981b6eec8e886b8e548c04e87f5a5c15ab9a29", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_where_used.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "21d31c943d10d8491aef7c5dfc1aead095dfadf23aa1544aa94a33f9ee9461fa", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_show_azure_ad_content.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "70d329815f38a847338b75945dceae0fb9c2cbb60fb23c743c36deffe80a2d8f", "format": 1 }, { "name": "plugins/modules/cp_mgmt_network.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "cf2afff948f871d2cffa288a4f559df867d5910679b63d17cd5f32c50ddd25d1", + "chksum_sha256": "88074fdc338c76e78968c56eddf884da147a7731a2c30e5706c49f8bf5e26ad1", "format": 1 }, { "name": "plugins/modules/cp_mgmt_threat_exception.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "88e016a715be2f1afa7e437561006144f3995a9f4ef32a57fe0e44232eddab71", + "chksum_sha256": "d9a8ac2be1a0e5b5fe59c291435db09293a2cd7b7045f8815afc7a67133cd42d", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_task_facts.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "770ff4aad0a36d2ceb826b0885f4cbc476f631fdac2a7b357383fafd3c67e98c", "format": 1 }, { "name": "plugins/modules/cp_mgmt_show_threat_advanced_settings.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "59b1ae0976426033fe8322e78c86ba4abd5bce2e497b5f55936a705437ecc55d", + "chksum_sha256": "0944521f4973825b4b46ed828d511081886eb6aad03e3725a407ade6928e8b19", "format": 1 }, { "name": "plugins/modules/cp_mgmt_simple_gateway_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "03084ad8d70f19219a10c4b2bcb315f410a55b568eb627148c3819568743354b", + "chksum_sha256": "d70b101cbcc243dad784010d3098bb38e40fb9e83bc2a3958094f05c0dd6e8da", "format": 1 }, { "name": "plugins/modules/cp_mgmt_delete_nat_rule.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "c4ccfeb4e6b4979e799038bbe2d10dbb6435cdb49f573004dc39e1b61d1c2172", + "chksum_sha256": "6c105755e08f79aef0a396d2a96dbd5aa70c02c37fea7669018fcd2329a4fab9", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_lock_object.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "50c6b8f821cc8d655aeae09cd721870f91b0bfb06cfef5880486d89425df79c3", "format": 1 }, { "name": "plugins/modules/cp_mgmt_service_sctp_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "6c36ba47121fb51f2f7801a3f19f30945ef689992b46cf1825fbcf329ab767bf", + "chksum_sha256": "95a54f9a9ff38b881b4339ec7995551c18889776787dd85e7230d8d88aa1477f", "format": 1 }, { "name": "plugins/modules/cp_mgmt_set_global_properties.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "b4821d269d27dc05ecbdd60e35f4fcf5d55f72c0ff9980309f90cfed03bcecc7", + "chksum_sha256": "d687fcf9fb850c0971a17f325d5e61b276d064f1ff6f5bba9b841b14c586388a", "format": 1 }, { "name": "plugins/modules/cp_mgmt_service_group.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "baabd9ca347233f669312f5e970641a84143ce40cc710f8fd1a01b9f86080f51", + "chksum_sha256": "ed72086739b78719fa2f75d61b4de0da9a6bf087b528620b9bdc874cc4f18de5", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_updatable_object_facts.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ba7904609b50808cd1c55e8c96ca20421de8784de3128461e94a164130adcd9a", "format": 1 }, { "name": "plugins/modules/cp_mgmt_verify_software_package.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "cba4e5708c365a4247150fdc19aaa927f6e57e9dd794db4192eacb9c984967ba", + "chksum_sha256": "fb4a15fec7dfdacf021b70dfd071196e8689bf7ce985ae56abd554b3d5a06874", "format": 1 }, { "name": "plugins/modules/cp_mgmt_service_other_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "78f53f2519b42994e3167b003880fa955a8fd80e4bf10c0df7965f4d1c4e693d", + "chksum_sha256": "3420bd871bc8d5cbd59b4ad332db7da8f0c606efbc414d86bd04530eb7cd6349", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_import_management.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "437076738642e77b5e35846a145d0790e0c02722556ee669017644e892f0488c", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_threat_layers.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ba56bfabbf9434b0def61161a25b056bc28bf4175b51bbba834976ddb9607565", "format": 1 }, { "name": "plugins/modules/cp_mgmt_service_group_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "03f768632d4aa85ff6dab26547272568b685af1cd39ade02e35eb25dcc6bfa49", + "chksum_sha256": "7bcaa71c79a640240587f18656c0a30738ced947a7cddddf040ad253f2390707", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_show_updatable_objects_repository_content.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f6f2ae3fd8f17b1e96800ee2e42ca032d96a02de93d072ae3a52ca759057cf8c", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_checkpoint_host_facts.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ce5d3c53ea10de8e05554826ce29528a7140f6b933afa78cb795cddf92dd3281", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_unlock_object.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "27fa6daeada885178c558204f0e5adf7f34f9a360bc537cb30c20d49d11c76f6", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_user_group_facts.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "11de6b7633645f215622a560309db6e38dbe43dfb11f2938cd0f2541edf680cc", "format": 1 }, { "name": "plugins/modules/cp_mgmt_show_tasks.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "7240e150287b5791a09af3551047b8034c4e6a69fb888c6cbb5e9008589ec9fa", + "chksum_sha256": "d9f9ebc90622c04d5cc942db07d3e4cb1c0c903d79a0f4370f40597eb2296eb5", "format": 1 }, { "name": "plugins/modules/cp_mgmt_add_nat_rule.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "cf758d48a1c074397015f83d1e9ada7617ea623007e09a750d9a5eca3f0d77a0", + "chksum_sha256": "ae8e94c98689a0ae36df6e80aa2deea4cb991ed3dfc7a4617fef6c8250b5dfef", "format": 1 }, { "name": "plugins/modules/cp_mgmt_tag_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "273dccfd755525d7950cc4258a388b43da0e2b27888b81e141a7c90195f06e63", + "chksum_sha256": "68c5d16dc776a79a4c54e6e22bd24911bf399b2d2d202f1c87e589b1c8b5f488", "format": 1 }, { "name": "plugins/modules/cp_mgmt_idp_to_domain_assignment_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "9abcbe1296760ffc0f506e7bf5a1e487cd25c80e42aa3217747f667ec973c2a6", + "chksum_sha256": "9ddfeb88eac810ea1cc1edb3028b56b6b88d74205e981a52620fe844a88d1203", "format": 1 }, { "name": "plugins/modules/cp_mgmt_dns_domain_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "5c06f5a95513dc459fb8a4f5c0afdb917d0e64e5ac974fd503c965cbfefd5848", + "chksum_sha256": "45029124471ba7d0598bd6aff8414bb15b2fef7ea13da2f3eed04bd18e57b2e8", "format": 1 }, { "name": "plugins/modules/cp_mgmt_test_sic_status.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "408f3ceef29304e05094aea5eccba41a5d7998b64537c5e9ae93e48d41727f3f", + "chksum_sha256": "5fa51a622d0d5019e6f484e887973f11da7dcfb5b4d3d646d86279e4c50f7430", "format": 1 }, { "name": "plugins/modules/cp_mgmt_security_zone_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "90733d338fe0ebdd9a649f074ea463f86e42ed3059adca6b6e6dbcc435d3ab9c", + "chksum_sha256": "0616b514b1624e7034f2180de46be558a9d454337e74be0cf09f9eef54aea01f", "format": 1 }, { "name": "plugins/modules/cp_mgmt_global_assignment_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "a9ae0807a77a6d34eaf1f16b9c3c77925915f41d8c704d7df1c6ce3820db0895", + "chksum_sha256": "de1ce6b48e2d4625010b7490745823b9bec3145bd028c97ea43ec7958c2305ea", "format": 1 }, { "name": "plugins/modules/cp_mgmt_cluster_members_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "fcf0d5bbc1fe22a3b5261b1eeb6ebac991f3458392e04c727542440ca9a37932", + "chksum_sha256": "018d398bd54defb93754e0ceab6c75740458a0dd3a8909c64939aaf7538b7a5d", "format": 1 }, { "name": "plugins/modules/cp_mgmt_set_domain.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "490075b99b71b9b71cc6b69043698fe1b26043037802fe3e3e7e081f8fe6bbd9", + "chksum_sha256": "ce340fb4ca4c4cdd402fc5eb71d83b1e555ece238755f6b5c41776a815ddb7d7", "format": 1 }, { "name": "plugins/modules/cp_mgmt_assign_global_assignment.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "3ae16d3eb7af55242ea7abe04efad06cae94efad912582b05d37fbc531fa46a7", + "chksum_sha256": "41c42743629fd9eff347b3690f00fdd36f87427cbcb51a4bf851501ca2753fc0", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_export_smart_task.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c1201a8558819ef9bcb149d7fa514631cc698ad18c1c9466f0836b9d028b46fe", "format": 1 }, { "name": "plugins/modules/cp_mgmt_multicast_address_range.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "b2df4111d8c376b8695890fe49e7894eb789ed701c5ba66d1c4c101a8fb7c2d6", + "chksum_sha256": "6aba11f07476bc260f79c4e80c7322135f8438630edcfd0fa60af2a4de7ec08b", "format": 1 }, { "name": "plugins/modules/cp_mgmt_show_nat_section.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "86587dbdc126e8ad016556c2d5aac427ebb90060006b46a0ee7f793df971d6af", + "chksum_sha256": "882a05818c455580e39d7b3ec57f36d4dfc484756bb0dad3443ae99d9480f346", "format": 1 }, { "name": "plugins/modules/cp_mgmt_idp_administrator_group_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "61c48850c8cf3de48b3661784288dbf1cde646d8120080f52fc1940ceb307013", + "chksum_sha256": "868517b320f1936b3e2c804424602ff8facb60cb0c095e392a04b3ad2ed02d59", "format": 1 }, { "name": "plugins/modules/cp_mgmt_lsm_run_script.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "7365251d4211be7ad3e8bd94efc61acb14456101e5d8734c84eb9d8395bf8161", + "chksum_sha256": "4afc1a4cdcf4ab00b693366d7f9150fac3bf771e9cadd465fdefe1f4dc6fc9ee", "format": 1 }, { "name": "plugins/modules/cp_mgmt_show_idp_default_assignment.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "b319a1df599ddaa23752898e60768b5dc7b6c238caf14e9a44c227cc96aee8bc", + "chksum_sha256": "3b44b44f3c8e16e8b414f17ee8868df100198245f4b2b30027f297f712e054b7", "format": 1 }, { "name": "plugins/modules/cp_mgmt_access_rule.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "9dfa89e622be7418f167b6b64d0e733363ddf36c5497f3a2a65644cf2fb8343b", + "chksum_sha256": "31f050a67767fe58f5964de26364e95e130ca4ee722e2c4f7e39b379ce09ebfb", "format": 1 }, { "name": "plugins/modules/cp_mgmt_data_center_object_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "c3c75bbab1199dc2e8a60ba78d607ea04429bc94bac517feb12ae345f235b7eb", + "chksum_sha256": "fc2f80c8439404bdcab99bdd6cda9327c0162d93c6a24c6d478669799bbf1548", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_nat_rule.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "95f1218aebb0ed6ee049f08ea933c7dd1415ec45010a77916154712c69f9c5a6", "format": 1 }, { "name": "plugins/modules/cp_mgmt_md_permissions_profile.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "ceee5ef6a93564e0e302156240a7a2eb1f8d6200716213ff9abfa6087c770381", + "chksum_sha256": "3d9c2a5ccfcc501dfca2bbd10bf761ccbdfd5b17bb1a618c98368ce77e013b3c", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_set_vpn_community_remote_access.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "727b6d5e9b24bfdca1c2079f78fbde6e626fc0d18b26f080219175d627ae5cc5", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_radius_group.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "468939ecb17de7cb95018cf689e9ba14ff7e9053ac912460b73e1beb063aa582", "format": 1 }, { "name": "plugins/modules/cp_mgmt_network_feed_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "936f5b155cfcd381d6c786219e1ae055e9d29393e062ebf170b79bf806568d46", + "chksum_sha256": "d9a955358a1a40ca643b005b24bd78ebd26d8cc465aaef83abe588203b17cfbb", "format": 1 }, { "name": "plugins/modules/cp_mgmt_wildcard_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "5008b06a930c36ef38da577915f1ed762b1acd5e5a45b895592c3ab086899a55", + "chksum_sha256": "8af94d47a31f0fb96c9616490bdc4f34806323263c08c1b6195d6b60d1495fc2", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_ha_full_sync.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "49d4cdaa0598e573621906ffe2b7e5816bc1f871ded89efd03a3f8c6d10f6853", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_show_layer_structure.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ea56651e20a9f71ae999283edf52b5ac68737e78a9ec7f0e50aa2516cfd5d925", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_set_ha_state.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ffadc15681142929306bd20eff520e5863889164323a4bbf66df9f786cc47ed1", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_set_global_domain.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d7eab16d44c6418990e3f05afca94e2b509eab0da192eb9fca22b007329f8c71", "format": 1 }, { "name": "plugins/modules/cp_mgmt_threat_rule.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "447a5aff781500736d020f53360356c8c17aff620ae1ffabe05ea457e12eb87b", + "chksum_sha256": "401780956965e1ee22f464682f0d2aaed373483b2c087ea9bdba3ba2daca7212", "format": 1 }, { "name": "plugins/modules/cp_mgmt_set_nat_rule.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "2863773d2b55242ff06f883011d469ceec6b425729e27f2dffc5013d7441a9e1", + "chksum_sha256": "04518f5526278760066cf26ba2714e2be910270e345f019a00dcfce0dd1e36dd", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_https_layer_facts.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b5224de60801573c791337d289b12d32ab5a59ead4d127f63d4dd5ee15d7e089", "format": 1 }, { "name": "plugins/modules/cp_mgmt_get_platform.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "1f5ac101d8c4cbd21600429fcb5967c3e02ef39bc7de2b0f94a1d5cbc222183e", + "chksum_sha256": "8ccaef0168f76c5152c97804e448ff8c7a0b5eb54cc0dc0f9dbb1ea8d8040c3e", "format": 1 }, { "name": "plugins/modules/cp_mgmt_delete_data_center_object.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "4e3cbdee4de6b34b6aec470ece5fbcfa51111087da5660cf3ae2eb27c1ce33ec", + "chksum_sha256": "c0cf0c481cb9847f1e1258756d1bf296acd440c37b9dfc751cf32ef5483c8f85", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_show_changes.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3d06818074268fd9ff46a38e1fb180b1668e977fff0aae140dd673d8f9a8cb97", "format": 1 }, { "name": "plugins/modules/cp_mgmt_threat_exception_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "6736ecbe1cdef972336fc133137f325995b14388094dcc4c90b2fd5f36718a9e", + "chksum_sha256": "0fb3d2d4801e68240454f13d47e69b74ec2dc5c46310b10374cc62a54af76c0b", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_import_smart_task.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7f2498654e9439ec728120fabb70375949d6a15f5a01e7ced69c5d24dbdfbb9c", "format": 1 }, { "name": "plugins/modules/cp_mgmt_global_assignment.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "175d1713c4d9e1a3ea5a5285341865e23b705084dc7e9b9573c974211dd344f5", + "chksum_sha256": "2ce0646c994560ada5effc29191e5c83f018d2808d1904f037055463907b0afa", "format": 1 }, { "name": "plugins/modules/cp_mgmt_identity_tag_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "f5177646186798331570ecad9525440d640dd70580dc4d34c8417d242cb1f314", + "chksum_sha256": "e9aa6758baa5d81386710612fa2238329e72003547622b3149e5745448b8eaaf", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_checkpoint_host.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4a40da66cdc2db9acaf29514fe1725380aab8b05942382936c180c585c4966b9", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_dynamic_global_network_object_facts.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f8d245702eff6f6a3396f874d60af3919cac5fdeb9a4d95daceda5bdd1703564", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_show_policy_settings.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1d8255659aea1d708e9844c62e3cb89ecb1c0bd19aa67c230c170f059c1c6f3d", "format": 1 }, { "name": "plugins/modules/cp_mgmt_install_lsm_policy.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "1bb3beeb03e0fa53ae64034e5fd953dde2abe3671fccdd2bc0b6a3b71daa70bf", + "chksum_sha256": "4463d1fc12e5118aa68cc4722894c96a27935963332faf2014ce376260eb9016", "format": 1 }, { "name": "plugins/modules/cp_mgmt_time_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "b1183b6f51322cc2ca8775b9a41899fa9a2ca3fce9fdee91fea1c222a5f43ae4", + "chksum_sha256": "dd4673b7c6ba523fb3c62166149da9927f1524c299ede6e2a435212957198075", "format": 1 }, { "name": "plugins/modules/cp_mgmt_trusted_client_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "1ab62179565f1dbb575020c1fbf8bf5d88d07adcf2632b3081e81c34fb48dbe6", + "chksum_sha256": "e3a18bb2416950fac30a104a9726bb2f82b8a2b8b7d99edd736047493af4418a", "format": 1 }, { "name": "plugins/modules/cp_mgmt_network_feed.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "d8a22dfef235dff512885e6ac51c5a162305c138e4ec91efdc7a0db873be344a", + "chksum_sha256": "dc68efc1f655d7f5a92414ef70f1a01873a3928515e31ae3dae547ee2cba6cc6", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_time_group.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f1cf0763edb754ddfa959f1cc6dc55dea4f67465c0be5a69bc3218754a3b35d0", "format": 1 }, { "name": "plugins/modules/cp_mgmt_delete_api_key.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "b48cc95c585bd5f45341ba27db65364eccc578e47ec257c7bae7e29a2918a50f", + "chksum_sha256": "c80ecf799be9f794e59f66415ba4b69481efb861d4092c8f9b5fdd0adbb985cc", "format": 1 }, { "name": "plugins/modules/cp_mgmt_service_tcp_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "a251d18bae7171a9703884ac201b6e8e3d2561367886123958d79743d108ffe4", + "chksum_sha256": "8a88d47278cf36912a05df4734b8f095e0e38dc3115bd156cfa84a192b6bd795", "format": 1 }, { "name": "plugins/modules/cp_mgmt_lsm_cluster.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "089e1ecc21fa7f28b917ff15a829dc3871a3e0aa459e85700032684000aa1b8f", + "chksum_sha256": "a9c4b3f307e68ea88c03d67bb841ffa422edcd6e7f8645427152bb3df7bcb293", "format": 1 }, { "name": "plugins/modules/cp_mgmt_access_role_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "f9f41fec5c6290f05916ac397817403bc77927ad6f279fc7069ed79e8a6c8734", + "chksum_sha256": "e475ecb4245955a769e212bd81d172deb9d423c1f49b34c79e670dcaf337f643", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_show_commands.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "42f7f29aaff7336fc6738688a421eb54f7ad4c7db7f73e0109276c9a15bb5ab1", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_export_management.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ae883ba7a90c3f12d3f821f92b500ed537f228193eb7add8bf3cb195bcf7bfb4", "format": 1 }, { "name": "plugins/modules/cp_mgmt_idp_administrator_group.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "1e4a6a4337380cb501ccf78f02339651fec9fd809440713678b2b8d83d9bb917", + "chksum_sha256": "da7fcd4910c070a37784c639178a20322787b79cdf663b264b133e8da0422349", "format": 1 }, { "name": "plugins/modules/cp_mgmt_access_rules.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "1c0984a03d59d9070480b9907aef3c17810685ce4d5f373ccb0bf1ca747f89db", + "chksum_sha256": "e6eb7f46b05f2ef5a788f205554b953b31f97aa495137f0775faf085303a565d", "format": 1 }, { "name": "plugins/modules/cp_mgmt_run_ips_update.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "df2897b279a396a9e7503055aff2e5e0e51cf210f879a290da5f63975c371f74", + "chksum_sha256": "6a4eb901298b3469314a0831bf9bec8072f0c948d5a9947267218ad145a12e5d", "format": 1 }, { "name": "plugins/modules/cp_mgmt_network_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "2b5294d0e55651df53bd19eec3ff842e3ecffdfc9422a5a2a083c27d70e8ba6a", + "chksum_sha256": "3164252cb8fcaa4b3c1ff24e7858c5ef84292ec043444da999c1041c9eb3f580", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_delete_updatable_object.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a727011fdbb43f5a20e6c02f6879b4fe05b056ef15cc72f9621151df33c5a7cd", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_repository_package_facts.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4540feebe46e284d6013aed523a4e01b18a3444323e168b368487ac7acaa5be5", "format": 1 }, { "name": "plugins/modules/cp_mgmt_vpn_community_meshed_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "f1a22cfbeaecaa3aabd58eb6e94b349d2026da7f72661d2946d1e8767b711878", + "chksum_sha256": "598f74d378af170ee2a2b38e77cfe13b63016128b790af216350b8278cf02386", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_show_gateways_and_servers.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7e0a6a4ed84d047d83b4efcca3dcffa43ef2ede66614588ffaea70066ee75679", "format": 1 }, { "name": "plugins/modules/cp_mgmt_domain_permissions_profile_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "e756f35bb731bb2fe905b441f8ef0f936d13e75eadb3a914ad0b9b9296c96cd7", + "chksum_sha256": "b759febd7b3687abada3711a51c9d340a728be209d81b6faca314954332e50fa", "format": 1 }, { "name": "plugins/modules/cp_mgmt_session_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "52d983273391e6bb9c27e9048689a849cbeba88a32d957ea78b072b38e807fe8", + "chksum_sha256": "148c62b23d2f3d4f7b48f0de5a9bbf861b552a4a5733e1d9f073a30c456cb815", "format": 1 }, { "name": "plugins/modules/cp_mgmt_threat_rule_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "289c42d6bdd3f1f89fb9322bec4ff01934c97120488824cd7bd4dce8ee22fa8b", + "chksum_sha256": "ed3868c1d61d6787bcc42e356ce127cfd5f0270f81606aa09f8ddd88979b012f", "format": 1 }, { "name": "plugins/modules/cp_mgmt_service_sctp.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "90c51821e4b8ee48ba76d1752b9c778d753543b51dedddad9de549a9c0c1e226", + "chksum_sha256": "fbf6d1975aa259ae02ff4f4408ef391b63cd82b31bbfbe020f8483855a385c9e", "format": 1 }, { "name": "plugins/modules/cp_mgmt_verify_policy.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "a36dc6811733d555ec1eabda7e14f47f9b8cf0fa3a61abcdbfdbe85720fd6845", + "chksum_sha256": "ed1e3094cbd79d6effc76f6ac30b56eb2db5c70b31b2584db98bddd99076b6e3", "format": 1 }, { "name": "plugins/modules/cp_mgmt_show_logs.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "e8e707e814732c2a0a65eb74c0f7930ec3aef16c848252c188e9e9ec7ededede", + "chksum_sha256": "5e047dd2cb8124511098ed16de65e7569a87a683cfc9ddb227c1d43fd94cfe64", "format": 1 }, { "name": "plugins/modules/cp_mgmt_repository_script_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "13c57263953e1701cde3a96f3144353614feeff74cd2b61249e87077927b9013", + "chksum_sha256": "bd66973b387bf16579f7396cf7227407087ad3571b3098256aa1b3dd252c955b", "format": 1 }, { "name": "plugins/modules/cp_mgmt_service_icmp6.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "2db1883cc9b10bcb8ddb1507f1a112e5889bc9bbf7f763e2c415c99a174d4508", + "chksum_sha256": "c28eef41c65b7158ebf64373b7ae13a52b1fb396548284cb128cd017fe562fad", "format": 1 }, { "name": "plugins/modules/cp_mgmt_dynamic_object_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "87d7513db087fbbc08381c5fdb1496e8636354ea46ee5548df4ac6a0a634d63d", + "chksum_sha256": "21e2f0b5b3059b8ba57f8b78e464ad2e039e684e9f13e3a003d953b9de001569", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_dynamic_global_network_object.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "54ee16e23c89795642df65c8a8a47b1da18e8d6b908c5d0a1a3f0793bcdcc224", "format": 1 }, { "name": "plugins/modules/cp_mgmt_domain_permissions_profile.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "3b5a225b0957326204eef01e23b1547fd07942860e31dc5df2ef8bb0668ad250", + "chksum_sha256": "62bb87439fc94bcf076a1ef11b421edb3fbdbfe06c70cdaa6185ce7a45b9a4c9", "format": 1 }, { "name": "plugins/modules/cp_mgmt_install_policy.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "59301e4f3270be713e931a2e5c68d9fa5bd7bbbadc04d9002cd0bfd609ec3764", + "chksum_sha256": "6230ed7ddff55524be64282183a5acb63763e490cee3a9ca9bc939ac31e5ffcd", "format": 1 }, { "name": "plugins/modules/cp_mgmt_address_range.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "3c3abddfba4299961b6f6dcc57d00201138d05618251c7afb132692d2c088e9a", + "chksum_sha256": "5c5e861f650b04a840969a35299eea02bb9dbda52944b7de45b3685eea83520c", + "format": 1 + }, + { + "name": "plugins/modules/cp_mgmt_gsn_handover_group.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4e77b9bbf217dfb6abc9bcd452b7b07698ff11cf076139c3a7717bfcb1ef364a", "format": 1 }, { @@ -2118,7 +3203,7 @@ "name": "plugins/module_utils/checkpoint.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "5ccdc4a20d4a68b269068cb2d97f9016c0d2919ef7c099105551f8641b9c6c80", + "chksum_sha256": "94bd2450bb7777d6ccabde36856d79d3089ec89c5ee42c0afe9d385e893b9c87", "format": 1 }, { @@ -2132,28 +3217,28 @@ "name": "plugins/doc_fragments/checkpoint_commands.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "1898e90c2a136d31c91a62bab1063323dd82890423ad0d703a947807c0ac1f02", + "chksum_sha256": "571591bddfb0da08324071465f1ab85bf314508c88eebcc185e3a34c87af082f", "format": 1 }, { "name": "plugins/doc_fragments/checkpoint_objects_action_module.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "12ddf56afb6239b7d9fdea8d36fea786ad1bbea10a907b95577f0717d6e6d440", + "chksum_sha256": "8567105a820eb2c0a76e40baaca859e5af441a9fbef960f2618873e22de28ee8", "format": 1 }, { "name": "plugins/doc_fragments/checkpoint_objects.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "5f473f8543cb465b06c45373a6d1df1accabdd5d601a582e096cc447cc4b17e9", + "chksum_sha256": "57cc85c7e186edc74d65a4895845704a1c8cfa3117c8d09cc10a169c2a688f8c", "format": 1 }, { "name": "plugins/doc_fragments/checkpoint_facts.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "5f569611d1e5b9b7a5de375b0f2de41c1537c39d4f6068a3cd4088b6c26a0da9", + "chksum_sha256": "673feb39c39f1bd236c3d89e70d499df4ef60998ff2d07a00fad65f535f177dc", "format": 1 }, { @@ -2167,7 +3252,7 @@ "name": "plugins/httpapi/checkpoint.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "56ac92bbb5ac2bf13d7cd8898f46a23d9738bf9f6022045a462dcaa6bc3177bd", + "chksum_sha256": "b83494cb44acc615bcac57326c2535bb0da6a63672f1ecdd2fd62f0a85acfd70", "format": 1 }, { @@ -2188,7 +3273,7 @@ "name": "changelogs/.plugin-cache.yaml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "a26bf0e084655d42f21faf5a600b85f62e792ef0f19e5d3c60e81872d7e27f20", + "chksum_sha256": "7089c9af2647f4639ba5bc87c06feac166519c1ec51238bf44b773d360240ba3", "format": 1 }, { @@ -2202,14 +3287,14 @@ "name": "changelogs/changelog.yaml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "9e147a0b5cd4ebdc583fedd2794bbdcfd157defcca7441b497dabcd5ec0f11b8", + "chksum_sha256": "b7865db159290169c5fb758da41f4e4e0a389e12d08b5e0b76f1e33586402b2b", "format": 1 }, { "name": "changelogs/config.yaml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "3feb24c62630d3fd948c56ef6383147d592dee262a7ee0a92733ba256b0ad261", + "chksum_sha256": "22348ce1eb0ac93c32d4e74becb93c2434b6cac8f1fb0c72d212a00d46051778", "format": 1 }, { @@ -2223,14 +3308,14 @@ "name": "meta/execution-environment.yml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "681641544005d9d504d94237ba485399d5de2fa39ed52c98f9e39f83612c90d9", + "chksum_sha256": "802299c6581ebd732cc173486c441f1c8047fc157118d7fe4ff8befe0189a176", "format": 1 }, { "name": "meta/runtime.yml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "860967add82d9c273d9d15780a0c1e58fe6fd17658464a704853249f84c0eecf", + "chksum_sha256": "fa108d2e771405a089e46362dcfe6c0e05a84d9c2dea3f2e11e5bb37cf7c6d72", "format": 1 }, { @@ -2244,7 +3329,7 @@ "name": "CHANGELOG.rst", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "b6c9947e9112a42ed69ff2f1880019f48520adc3162f7d4f767ab4ca44495991", + "chksum_sha256": "7960c59f2b1bf1422e1ec6eee51b078e501df344d835640845c264b4fce77d72", "format": 1 } ], diff --git a/ansible_collections/check_point/mgmt/MANIFEST.json b/ansible_collections/check_point/mgmt/MANIFEST.json index acdcba72f..53ebe9e67 100644 --- a/ansible_collections/check_point/mgmt/MANIFEST.json +++ b/ansible_collections/check_point/mgmt/MANIFEST.json @@ -2,7 +2,7 @@ "collection_info": { "namespace": "check_point", "name": "mgmt", - "version": "4.0.0", + "version": "5.2.3", "authors": [ "Or Soffer <orso@checkpoint.com>", "Shiran Golzar <shirango@checkpoint.com>", @@ -27,7 +27,7 @@ "name": "FILES.json", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "5f71b816bee0abfef6e2a291b00f28b42e32ca12cc7ec01812bc246644fad321", + "chksum_sha256": "6d8e68e518f029bf65960d7a5334dff03fd335918363e64dd12b469f494aa600", "format": 1 }, "format": 1 diff --git a/ansible_collections/check_point/mgmt/README.md b/ansible_collections/check_point/mgmt/README.md index 10373f5c0..3185eb988 100644 --- a/ansible_collections/check_point/mgmt/README.md +++ b/ansible_collections/check_point/mgmt/README.md @@ -83,106 +83,3 @@ Note - If you want to run against Ansible version 2.9 instead of the collection, b. In the task in the playbook replace the module `check_point.mgmt.cp_mgmt_*` with the module `cp_mgmt_*` 8. Starting from version 1.0.6, when running a command which returns a task-id, and the user chooses to wait for that task to finish (the default is to wait), then the output of the command will be the output of the show-task command (instead of the task-id). - -Modules -------- -* `cp_mgmt_access_layer` – Manages access-layer objects on Check Point over Web Services API -* `cp_mgmt_access_layer_facts` – Get access-layer objects facts on Check Point over Web Services API -* `cp_mgmt_access_role` – Manages access-role objects on Check Point over Web Services API -* `cp_mgmt_access_role_facts` – Get access-role objects facts on Check Point over Web Services API -* `cp_mgmt_access_rule` – Manages access-rule objects on Check Point over Web Services API -* `cp_mgmt_access_rules` – Manages a list of access rules objects on Check Point over Web Services API -* `cp_mgmt_access_rule_facts` – Get access-rule objects facts on Check Point over Web Services API -* `cp_mgmt_address_range` – Manages address-range objects on Check Point over Web Services API -* `cp_mgmt_address_range_facts` – Get address-range objects facts on Check Point over Web Services API -* `cp_mgmt_administrator` – Manages administrator objects on Check Point over Web Services API -* `cp_mgmt_administrator_facts` – Get administrator objects facts on Check Point over Web Services API -* `cp_mgmt_application_site` – Manages application-site objects on Check Point over Web Services API -* `cp_mgmt_application_site_category` – Manages application-site-category objects on Check Point over Web Services API -* `cp_mgmt_application_site_category_facts` – Get application-site-category objects facts on Check Point over Web Services API -* `cp_mgmt_application_site_facts` – Get application-site objects facts on Check Point over Web Services API -* `cp_mgmt_application_site_group` – Manages application-site-group objects on Check Point over Web Services API -* `cp_mgmt_application_site_group_facts` – Get application-site-group objects facts on Check Point over Web Services API -* `cp_mgmt_assign_global_assignment` – assign global assignment on Check Point over Web Services API -* `cp_mgmt_discard` – All changes done by user are discarded and removed from database -* `cp_mgmt_dns_domain` – Manages dns-domain objects on Check Point over Web Services API -* `cp_mgmt_dns_domain_facts` – Get dns-domain objects facts on Check Point over Web Services API -* `cp_mgmt_dynamic_object` – Manages dynamic-object objects on Check Point over Web Services API -* `cp_mgmt_dynamic_object_facts` – Get dynamic-object objects facts on Check Point over Web Services API -* `cp_mgmt_exception_group` – Manages exception-group objects on Check Point over Web Services API -* `cp_mgmt_exception_group_facts` – Get exception-group objects facts on Check Point over Web Services API -* `cp_mgmt_global_assignment` – Manages global-assignment objects on Check Point over Web Services API -* `cp_mgmt_global_assignment_facts` – Get global-assignment objects facts on Check Point over Web Services API -* `cp_mgmt_group` – Manages group objects on Check Point over Web Services API -* `cp_mgmt_group_facts` – Get group objects facts on Check Point over Web Services API -* `cp_mgmt_group_with_exclusion` – Manages group-with-exclusion objects on Check Point over Web Services API -* `cp_mgmt_group_with_exclusion_facts` – Get group-with-exclusion objects facts on Check Point over Web Services API -* `cp_mgmt_host` – Manages host objects on Check Point over Web Services API -* `cp_mgmt_host_facts` – Get host objects facts on Check Point over Web Services API -* `cp_mgmt_install_policy` – install policy on Check Point over Web Services API -* `cp_mgmt_install_database` – install database on Check Point over Web Services API -* `cp_mgmt_mds` – Multi-Domain Server (mds) objects on Check Point over Web Services API -* `cp_mgmt_mds_facts` – Get Multi-Domain Server (mds) objects facts on Check Point over Web Services API -* `cp_mgmt_multicast_address_range` – Manages multicast-address-range objects on Check Point over Web Services API -* `cp_mgmt_multicast_address_range_facts` – Get multicast-address-range objects facts on Check Point over Web Services API -* `cp_mgmt_network` – Manages network objects on Check Point over Web Services API -* `cp_mgmt_network_facts` – Get network objects facts on Check Point over Web Services API -* `cp_mgmt_package` – Manages package objects on Check Point over Web Services API -* `cp_mgmt_package_facts` – Get package objects facts on Check Point over Web Services API -* `cp_mgmt_publish` – All the changes done by this user will be seen by all users only after publish is called -* `cp_mgmt_put_file` – put file on Check Point over Web Services API -* `cp_mgmt_run_ips_update` – Runs IPS database update. If "package-path" is not provided server will try to get the latest package from the User Center -* `cp_mgmt_run_script` – Executes the script on a given list of targets -* `cp_mgmt_security_zone` – Manages security-zone objects on Check Point over Web Services API -* `cp_mgmt_security_zone_facts` – Get security-zone objects facts on Check Point over Web Services API -* `cp_mgmt_service_dce_rpc` – Manages service-dce-rpc objects on Check Point over Web Services API -* `cp_mgmt_service_dce_rpc_facts` – Get service-dce-rpc objects facts on Check Point over Web Services API -* `cp_mgmt_service_group` – Manages service-group objects on Check Point over Web Services API -* `cp_mgmt_service_group_facts` – Get service-group objects facts on Check Point over Web Services API -* `cp_mgmt_service_icmp` – Manages service-icmp objects on Check Point over Web Services API -* `cp_mgmt_service_icmp6` – Manages service-icmp6 objects on Check Point over Web Services API -* `cp_mgmt_service_icmp6_facts` – Get service-icmp6 objects facts on Check Point over Web Services API -* `cp_mgmt_service_icmp_facts` – Get service-icmp objects facts on Check Point over Web Services API -* `cp_mgmt_service_other` – Manages service-other objects on Check Point over Web Services API -* `cp_mgmt_service_other_facts` – Get service-other objects facts on Check Point over Web Services API -* `cp_mgmt_service_rpc` – Manages service-rpc objects on Check Point over Web Services API -* `cp_mgmt_service_rpc_facts` – Get service-rpc objects facts on Check Point over Web Services API -* `cp_mgmt_service_sctp` – Manages service-sctp objects on Check Point over Web Services API -* `cp_mgmt_service_sctp_facts` – Get service-sctp objects facts on Check Point over Web Services API -* `cp_mgmt_service_tcp` – Manages service-tcp objects on Check Point over Web Services API -* `cp_mgmt_service_tcp_facts` – Get service-tcp objects facts on Check Point over Web Services API -* `cp_mgmt_service_udp` – Manages service-udp objects on Check Point over Web Services API -* `cp_mgmt_service_udp_facts` – Get service-udp objects facts on Check Point over Web Services API -* `cp_mgmt_session_facts` – Get session objects facts on Check Point over Web Services API -* `cp_mgmt_simple_gateway` – Manages simple-gateway objects on Check Point over Web Services API -* `cp_mgmt_simple_gateway_facts` – Get simple-gateway objects facts on Check Point over Web Services API -* `cp_mgmt_tag` – Manages tag objects on Check Point over Web Services API -* `cp_mgmt_tag_facts` – Get tag objects facts on Check Point over Web Services API -* `cp_mgmt_threat_exception` – Manages threat-exception objects on Check Point over Web Services API -* `cp_mgmt_threat_exception_facts` – Get threat-exception objects facts on Check Point over Web Services API -* `cp_mgmt_threat_indicator` – Manages threat-indicator objects on Check Point over Web Services API -* `cp_mgmt_threat_indicator_facts` – Get threat-indicator objects facts on Check Point over Web Services API -* `cp_mgmt_threat_layer` – Manages threat-layer objects on Check Point over Web Services API -* `cp_mgmt_threat_layer_facts` – Get threat-layer objects facts on Check Point over Web Services API -* `cp_mgmt_threat_profile` – Manages threat-profile objects on Check Point over Web Services API -* `cp_mgmt_threat_profile_facts` – Get threat-profile objects facts on Check Point over Web Services API -* `cp_mgmt_threat_protection_override` – Edit existing object using object name or uid -* `cp_mgmt_threat_rule` – Manages threat-rule objects on Check Point over Web Services API -* `cp_mgmt_threat_rule_facts` – Get threat-rule objects facts on Check Point over Web Services API -* `cp_mgmt_time` – Manages time objects on Check Point over Web Services API -* `cp_mgmt_time_facts` – Get time objects facts on Check Point over Web Services API -* `cp_mgmt_verify_policy` – Verifies the policy of the selected package -* `cp_mgmt_vpn_community_meshed` – Manages vpn-community-meshed objects on Check Point over Web Services API -* `cp_mgmt_vpn_community_meshed_facts` – Get vpn-community-meshed objects facts on Check Point over Web Services API -* `cp_mgmt_vpn_community_star` – Manages vpn-community-star objects on Check Point over Web Services API -* `cp_mgmt_vpn_community_star_facts` – Get vpn-community-star objects facts on Check Point over Web Services API -* `cp_mgmt_wildcard` – Manages wildcard objects on Check Point over Web Services API -* `cp_mgmt_wildcard_facts` – Get wildcard objects facts on Check Point over Web Services API -* `cp_mgmt_add_domain` – Add new domain on Check Point over Web Services API -* `cp_mgmt_set_domain` – Edit existing domain on Check Point over Web Services API -* `cp_mgmt_delete_domain` – Delete existing domain on Check Point over Web Services API -* `cp_mgmt_domain_facts` – Get domain objects on Check Point over Web Services API -* `cp_mgmt_trusted_client` – Trusted client objects on Check Point over Web Services API -* `cp_mgmt_trusted_client_facts` – Get trusted client objects facts on Check Point over Web Services API -* `cp_mgmt_identity_tag` – Identity tag objects on Check Point over Web Services API -* `cp_mgmt_identity_tag_facts` – Get identity tag objects facts on Check Point over Web Services API diff --git a/ansible_collections/check_point/mgmt/changelogs/.plugin-cache.yaml b/ansible_collections/check_point/mgmt/changelogs/.plugin-cache.yaml index 49a221479..80139d1ed 100644 --- a/ansible_collections/check_point/mgmt/changelogs/.plugin-cache.yaml +++ b/ansible_collections/check_point/mgmt/changelogs/.plugin-cache.yaml @@ -6,6 +6,7 @@ plugins: callback: {} cliconf: {} connection: {} + filter: {} httpapi: checkpoint: description: HttpApi Plugin for Checkpoint devices @@ -14,6 +15,11 @@ plugins: inventory: {} lookup: {} module: + cp_mgmt_abort_get_interfaces: + description: Attempt to abort an on-going "get-interfaces" operation. + name: cp_mgmt_abort_get_interfaces + namespace: '' + version_added: 5.0.0 cp_mgmt_access_layer: description: Manages access-layer objects on Check Point over Web Services API name: cp_mgmt_access_layer @@ -25,6 +31,23 @@ plugins: name: cp_mgmt_access_layer_facts namespace: '' version_added: 1.0.0 + cp_mgmt_access_layers: + description: Manages ACCESS LAYERS resource module + name: cp_mgmt_access_layers + namespace: '' + version_added: 5.0.0 + cp_mgmt_access_point_name: + description: Manages access-point-name objects on Checkpoint over Web Services + API + name: cp_mgmt_access_point_name + namespace: '' + version_added: 5.0.0 + cp_mgmt_access_point_name_facts: + description: Get access-point-name objects facts on Checkpoint over Web Services + API + name: cp_mgmt_access_point_name_facts + namespace: '' + version_added: 5.0.0 cp_mgmt_access_role: description: Manages access-role objects on Check Point over Web Services API name: cp_mgmt_access_role @@ -64,6 +87,11 @@ plugins: name: cp_mgmt_add_api_key namespace: '' version_added: 2.0.0 + cp_mgmt_add_central_license: + description: Add central license. + name: cp_mgmt_add_central_license + namespace: '' + version_added: 5.2.0 cp_mgmt_add_data_center_object: description: Imports a Data Center Object from a Data Center Server.<br> Data Center Object represents an object in the cloud environment. @@ -80,12 +108,23 @@ plugins: name: cp_mgmt_add_nat_rule namespace: '' version_added: 2.0.0 + cp_mgmt_add_repository_package: + description: Add the software package to the central repository. + name: cp_mgmt_add_repository_package + namespace: '' + version_added: 5.0.0 cp_mgmt_add_rules_batch: description: Creates new rules in batch. Use this API to achieve optimum performance when adding more than one rule. name: cp_mgmt_add_rules_batch namespace: '' version_added: 3.0.0 + cp_mgmt_add_updatable_object: + description: Import an updatable object from the repository to the management + server. + name: cp_mgmt_add_updatable_object + namespace: '' + version_added: 5.0.0 cp_mgmt_address_range: description: Manages address-range objects on Check Point over Web Services API @@ -155,6 +194,12 @@ plugins: name: cp_mgmt_assign_global_assignment namespace: '' version_added: 1.0.0 + cp_mgmt_central_license_facts: + description: Get central-license objects facts on Checkpoint over Web Services + API + name: cp_mgmt_central_license_facts + namespace: '' + version_added: 5.2.0 cp_mgmt_check_network_feed: description: Check if a target can reach or parse a network feed; can work with an existing feed object or with a new one (by providing all relevant feed @@ -169,6 +214,18 @@ plugins: name: cp_mgmt_check_threat_ioc_feed namespace: '' version_added: 3.0.0 + cp_mgmt_checkpoint_host: + description: Manages checkpoint-host objects on Checkpoint over Web Services + API + name: cp_mgmt_checkpoint_host + namespace: '' + version_added: 5.0.0 + cp_mgmt_checkpoint_host_facts: + description: Get checkpoint-host objects facts on Checkpoint over Web Services + API + name: cp_mgmt_checkpoint_host_facts + namespace: '' + version_added: 5.0.0 cp_mgmt_cluster_members_facts: description: Retrieve all existing cluster members in domain. name: cp_mgmt_cluster_members_facts @@ -193,6 +250,11 @@ plugins: name: cp_mgmt_delete_api_key namespace: '' version_added: 2.0.0 + cp_mgmt_delete_central_license: + description: Delete central license. + name: cp_mgmt_delete_central_license + namespace: '' + version_added: 5.2.0 cp_mgmt_delete_data_center_object: description: Delete existing object using object name or uid. name: cp_mgmt_delete_data_center_object @@ -208,12 +270,22 @@ plugins: name: cp_mgmt_delete_nat_rule namespace: '' version_added: 2.0.0 + cp_mgmt_delete_repository_package: + description: Delete the repository software package from the central repository. + name: cp_mgmt_delete_repository_package + namespace: '' + version_added: 5.0.0 cp_mgmt_delete_rules_batch: description: Delete rules in batch from the same layer. Use this API to achieve optimum performance when removing more than one rule. name: cp_mgmt_delete_rules_batch namespace: '' version_added: 3.0.0 + cp_mgmt_delete_updatable_object: + description: Delete existing object using object name or uid. + name: cp_mgmt_delete_updatable_object + namespace: '' + version_added: 5.0.0 cp_mgmt_discard: description: All changes done by user are discarded and removed from database. name: cp_mgmt_discard @@ -224,6 +296,11 @@ plugins: name: cp_mgmt_disconnect_cloud_services namespace: '' version_added: 3.0.0 + cp_mgmt_distribute_cloud_licenses: + description: Distribute licenses to target CloudGuard gateways. + name: cp_mgmt_distribute_cloud_licenses + namespace: '' + version_added: 5.2.0 cp_mgmt_dns_domain: description: Manages dns-domain objects on Check Point over Web Services API name: cp_mgmt_dns_domain @@ -251,6 +328,18 @@ plugins: name: cp_mgmt_domain_permissions_profile_facts namespace: '' version_added: 3.0.0 + cp_mgmt_dynamic_global_network_object: + description: Manages dynamic-global-network-object objects on Checkpoint over + Web Services API + name: cp_mgmt_dynamic_global_network_object + namespace: '' + version_added: 5.0.0 + cp_mgmt_dynamic_global_network_object_facts: + description: Get dynamic-global-network-object objects facts on Checkpoint over + Web Services API + name: cp_mgmt_dynamic_global_network_object_facts + namespace: '' + version_added: 5.0.0 cp_mgmt_dynamic_object: description: Manages dynamic-object objects on Check Point over Web Services API @@ -275,6 +364,30 @@ plugins: name: cp_mgmt_exception_group_facts namespace: '' version_added: 1.0.0 + cp_mgmt_export_management: + description: Export the primary Security Management Server database or the primary + Multi-Domain Server database or the single Domain database and the applicable + Check Point configuration. + name: cp_mgmt_export_management + namespace: '' + version_added: 5.0.0 + cp_mgmt_export_smart_task: + description: Export SmartTask to a file. + name: cp_mgmt_export_smart_task + namespace: '' + version_added: 5.0.0 + cp_mgmt_get_attachment: + description: Retrieves a packet capture or blob data, according to the attributes + of a log record. + name: cp_mgmt_get_attachment + namespace: '' + version_added: 5.0.0 + cp_mgmt_get_interfaces: + description: Get physical interfaces with or without their topology from a Gaia + Security Gateway or Cluster. + name: cp_mgmt_get_interfaces + namespace: '' + version_added: 5.0.0 cp_mgmt_get_platform: description: Get actual platform (Hardware, Version, OS) from gateway, cluster or Check Point host. @@ -315,6 +428,23 @@ plugins: name: cp_mgmt_group_with_exclusion_facts namespace: '' version_added: 1.0.0 + cp_mgmt_gsn_handover_group: + description: Manages gsn-handover-group objects on Checkpoint over Web Services + API + name: cp_mgmt_gsn_handover_group + namespace: '' + version_added: 5.0.0 + cp_mgmt_gsn_handover_group_facts: + description: Get gsn-handover-group objects facts on Checkpoint over Web Services + API + name: cp_mgmt_gsn_handover_group_facts + namespace: '' + version_added: 5.0.0 + cp_mgmt_ha_full_sync: + description: Perform full sync from active server to standby peer. + name: cp_mgmt_ha_full_sync + namespace: '' + version_added: 5.0.0 cp_mgmt_host: description: Manages host objects on Check Point over Web Services API name: cp_mgmt_host @@ -325,6 +455,21 @@ plugins: name: cp_mgmt_host_facts namespace: '' version_added: 1.0.0 + cp_mgmt_hosts: + description: Manages HOSTS resource module + name: cp_mgmt_hosts + namespace: '' + version_added: 5.0.0 + cp_mgmt_https_layer: + description: Manages https-layer objects on Checkpoint over Web Services API + name: cp_mgmt_https_layer + namespace: '' + version_added: 5.0.0 + cp_mgmt_https_layer_facts: + description: Get https-layer objects facts on Checkpoint over Web Services API + name: cp_mgmt_https_layer_facts + namespace: '' + version_added: 5.0.0 cp_mgmt_https_section: description: Manages https-section objects on Checkpoint over Web Services API name: cp_mgmt_https_section @@ -359,6 +504,18 @@ plugins: name: cp_mgmt_idp_to_domain_assignment_facts namespace: '' version_added: 3.0.0 + cp_mgmt_import_management: + description: Import the primary Security Management Server database or the primary + Multi-Domain Server database or the single Domain database and the applicable + Check Point configuration. + name: cp_mgmt_import_management + namespace: '' + version_added: 5.0.0 + cp_mgmt_import_smart_task: + description: Import SmartTask from a file. + name: cp_mgmt_import_smart_task + namespace: '' + version_added: 5.0.0 cp_mgmt_install_database: description: Copies the user database and network objects information to specified targets. @@ -387,6 +544,16 @@ plugins: name: cp_mgmt_install_software_package namespace: '' version_added: 2.0.0 + cp_mgmt_interface: + description: Manages interface objects on Checkpoint over Web Services API + name: cp_mgmt_interface + namespace: '' + version_added: 6.0.0 + cp_mgmt_interface_facts: + description: Get interface objects facts on Checkpoint over Web Services API + name: cp_mgmt_interface_facts + namespace: '' + version_added: 6.0.0 cp_mgmt_interoperable_device: description: Manages interoperable-device objects on Checkpoint over Web Services API @@ -399,6 +566,17 @@ plugins: name: cp_mgmt_interoperable_device_facts namespace: '' version_added: 3.0.0 + cp_mgmt_ips_protection_extended_attribute_facts: + description: Get ips-protection-extended-attribute objects facts on Checkpoint + over Web Services API + name: cp_mgmt_ips_protection_extended_attribute_facts + namespace: '' + version_added: 5.0.0 + cp_mgmt_lock_object: + description: Lock object using name and type. + name: cp_mgmt_lock_object + namespace: '' + version_added: 5.0.0 cp_mgmt_lsm_cluster: description: Manages lsm-cluster objects on Checkpoint over Web Services API name: cp_mgmt_lsm_cluster @@ -437,6 +615,16 @@ plugins: name: cp_mgmt_lsm_run_script namespace: '' version_added: 3.0.0 + cp_mgmt_lsv_profile: + description: Manages lsv-profile objects on Checkpoint over Web Services API + name: cp_mgmt_lsv_profile + namespace: '' + version_added: 5.0.0 + cp_mgmt_lsv_profile_facts: + description: Get lsv-profile objects facts on Checkpoint over Web Services API + name: cp_mgmt_lsv_profile_facts + namespace: '' + version_added: 5.0.0 cp_mgmt_md_permissions_profile: description: Manages md-permissions-profile objects on Checkpoint over Web Services API @@ -472,6 +660,11 @@ plugins: name: cp_mgmt_multicast_address_range_facts namespace: '' version_added: 1.0.0 + cp_mgmt_nat_rule: + description: Manages nat-rule objects on Checkpoint over Web Services API. + name: cp_mgmt_nat_rule + namespace: '' + version_added: 5.0.0 cp_mgmt_nat_rule_facts: description: Get nat-rule objects facts on Checkpoint over Web Services API name: cp_mgmt_nat_rule_facts @@ -535,11 +728,39 @@ plugins: name: cp_mgmt_put_file namespace: '' version_added: 1.0.0 + cp_mgmt_radius_group: + description: Manages radius-group objects on Checkpoint over Web Services API + name: cp_mgmt_radius_group + namespace: '' + version_added: 5.0.0 + cp_mgmt_radius_group_facts: + description: Get radius-group objects facts on Checkpoint over Web Services + API + name: cp_mgmt_radius_group_facts + namespace: '' + version_added: 5.0.0 + cp_mgmt_radius_server: + description: Manages radius-server objects on Checkpoint over Web Services API + name: cp_mgmt_radius_server + namespace: '' + version_added: 5.0.0 + cp_mgmt_radius_server_facts: + description: Get radius-server objects facts on Checkpoint over Web Services + API + name: cp_mgmt_radius_server_facts + namespace: '' + version_added: 5.0.0 cp_mgmt_reject_session: description: Workflow feature - Return the session to the submitter administrator. name: cp_mgmt_reject_session namespace: '' version_added: 3.0.0 + cp_mgmt_repository_package_facts: + description: Get repository-package objects facts on Checkpoint over Web Services + API + name: cp_mgmt_repository_package_facts + namespace: '' + version_added: 5.0.0 cp_mgmt_repository_script: description: Manages repository-script objects on Checkpoint over Web Services API @@ -583,6 +804,30 @@ plugins: name: cp_mgmt_security_zone_facts namespace: '' version_added: 1.0.0 + cp_mgmt_service_citrix_tcp: + description: Manages service-citrix-tcp objects on Checkpoint over Web Services + API + name: cp_mgmt_service_citrix_tcp + namespace: '' + version_added: 5.0.0 + cp_mgmt_service_citrix_tcp_facts: + description: Get service-citrix-tcp objects facts on Checkpoint over Web Services + API + name: cp_mgmt_service_citrix_tcp_facts + namespace: '' + version_added: 5.0.0 + cp_mgmt_service_compound_tcp: + description: Manages service-compound-tcp objects on Checkpoint over Web Services + API + name: cp_mgmt_service_compound_tcp + namespace: '' + version_added: 5.0.0 + cp_mgmt_service_compound_tcp_facts: + description: Get service-compound-tcp objects facts on Checkpoint over Web Services + API + name: cp_mgmt_service_compound_tcp_facts + namespace: '' + version_added: 5.0.0 cp_mgmt_service_dce_rpc: description: Manages service-dce-rpc objects on Check Point over Web Services API @@ -691,16 +936,38 @@ plugins: name: cp_mgmt_session_facts namespace: '' version_added: 1.0.0 + cp_mgmt_set_api_settings: + description: Edit API settings, the changes will be applied after publish followed + by running 'api restart' command. + name: cp_mgmt_set_api_settings + namespace: '' + version_added: 5.0.0 + cp_mgmt_set_cloud_services: + description: Set the connection settings between the Management Server and Check + Point's Infinity Portal. + name: cp_mgmt_set_cloud_services + namespace: '' + version_added: 5.0.0 cp_mgmt_set_domain: description: Edit existing object using object name or uid. name: cp_mgmt_set_domain namespace: '' version_added: 2.1.0 + cp_mgmt_set_global_domain: + description: Edit Global domain object using domain name or UID. + name: cp_mgmt_set_global_domain + namespace: '' + version_added: 5.0.0 cp_mgmt_set_global_properties: description: Edit Global Properties. name: cp_mgmt_set_global_properties namespace: '' version_added: 3.0.0 + cp_mgmt_set_ha_state: + description: Switch domain server high availability state. + name: cp_mgmt_set_ha_state + namespace: '' + version_added: 5.0.0 cp_mgmt_set_idp_default_assignment: description: Set default Identity Provider assignment to be use for Management server administrator access. @@ -715,11 +982,26 @@ plugins: name: cp_mgmt_set_idp_to_domain_assignment namespace: '' version_added: 3.0.0 + cp_mgmt_set_ips_update_schedule: + description: Edit IPS Update Schedule. + name: cp_mgmt_set_ips_update_schedule + namespace: '' + version_added: 5.0.0 + cp_mgmt_set_login_message: + description: Edit Login message. + name: cp_mgmt_set_login_message + namespace: '' + version_added: 5.0.0 cp_mgmt_set_nat_rule: description: Edit existing object using object name or uid. name: cp_mgmt_set_nat_rule namespace: '' version_added: 2.0.0 + cp_mgmt_set_policy_settings: + description: Edit Policy settings, the changes will be applied after publish. + name: cp_mgmt_set_policy_settings + namespace: '' + version_added: 5.0.0 cp_mgmt_set_session: description: Edit user's current session. name: cp_mgmt_set_session @@ -730,22 +1012,80 @@ plugins: name: cp_mgmt_set_threat_advanced_settings namespace: '' version_added: 3.0.0 + cp_mgmt_set_vpn_community_remote_access: + description: Edit existing Remote Access object. Using object name or uid is + optional. + name: cp_mgmt_set_vpn_community_remote_access + namespace: '' + version_added: 5.0.0 cp_mgmt_show_access_section: description: Retrieve existing object using object name or uid. name: cp_mgmt_show_access_section namespace: '' version_added: 2.0.0 + cp_mgmt_show_api_settings: + description: Retrieve API Settings. + name: cp_mgmt_show_api_settings + namespace: '' + version_added: 5.0.0 + cp_mgmt_show_api_versions: + description: Shows all supported API versions and current API version (the latest + one). + name: cp_mgmt_show_api_versions + namespace: '' + version_added: 5.0.0 + cp_mgmt_show_azure_ad_content: + description: Retrieve AzureAD Objects from Azure AD Server. + name: cp_mgmt_show_azure_ad_content + namespace: '' + version_added: 5.0.0 + cp_mgmt_show_changes: + description: Show changes between two sessions. + name: cp_mgmt_show_changes + namespace: '' + version_added: 5.0.0 + cp_mgmt_show_cloud_licenses_usage: + description: Show attached licenses usage. + name: cp_mgmt_show_cloud_licenses_usage + namespace: '' + version_added: 5.2.0 cp_mgmt_show_cloud_services: description: Show the connection status of the Management Server to Check Point's Infinity Portal. name: cp_mgmt_show_cloud_services namespace: '' version_added: 3.0.0 + cp_mgmt_show_commands: + description: Retrieve all of the supported Management API commands with their + description. + name: cp_mgmt_show_commands + namespace: '' + version_added: 5.0.0 + cp_mgmt_show_gateways_and_servers: + description: Shows list of Gateways & Servers sorted by name. + name: cp_mgmt_show_gateways_and_servers + namespace: '' + version_added: 5.0.0 + cp_mgmt_show_global_domain: + description: Retrieve existing object using object name or uid. + name: cp_mgmt_show_global_domain + namespace: '' + version_added: 5.0.0 cp_mgmt_show_global_properties: description: Retrieve Global Properties. name: cp_mgmt_show_global_properties namespace: '' version_added: 3.0.0 + cp_mgmt_show_ha_state: + description: Retrieve domain high availability state. + name: cp_mgmt_show_ha_state + namespace: '' + version_added: 5.0.0 + cp_mgmt_show_ha_status: + description: Retrieve domain high availability status. + name: cp_mgmt_show_ha_status + namespace: '' + version_added: 5.2.0 cp_mgmt_show_https_section: description: Retrieve existing HTTPS Inspection section using section name or uid and layer name. @@ -758,6 +1098,26 @@ plugins: name: cp_mgmt_show_idp_default_assignment namespace: '' version_added: 3.0.0 + cp_mgmt_show_ips_status: + description: show ips status on Checkpoint over Web Services API + name: cp_mgmt_show_ips_status + namespace: '' + version_added: 5.0.0 + cp_mgmt_show_ips_update_schedule: + description: Retrieve IPS Update Schedule. + name: cp_mgmt_show_ips_update_schedule + namespace: '' + version_added: 5.0.0 + cp_mgmt_show_layer_structure: + description: Shows the entire layer structure. + name: cp_mgmt_show_layer_structure + namespace: '' + version_added: 5.0.0 + cp_mgmt_show_login_message: + description: Retrieve Login message. + name: cp_mgmt_show_login_message + namespace: '' + version_added: 5.0.0 cp_mgmt_show_logs: description: Showing logs according to the given filter. name: cp_mgmt_show_logs @@ -768,6 +1128,16 @@ plugins: name: cp_mgmt_show_nat_section namespace: '' version_added: 2.0.0 + cp_mgmt_show_place_holder: + description: Retrieve existing object using object uid. + name: cp_mgmt_show_place_holder + namespace: '' + version_added: 5.0.0 + cp_mgmt_show_policy_settings: + description: Show Policy settings. + name: cp_mgmt_show_policy_settings + namespace: '' + version_added: 5.0.0 cp_mgmt_show_servers_and_processes: description: Shows the status of all processes in the current machine (Multi-Domain Server and all Domain Management / Log Servers). <br>This command is available @@ -780,6 +1150,11 @@ plugins: name: cp_mgmt_show_software_package_details namespace: '' version_added: 2.0.0 + cp_mgmt_show_software_packages_per_targets: + description: Shows software packages on targets. + name: cp_mgmt_show_software_packages_per_targets + namespace: '' + version_added: 5.0.0 cp_mgmt_show_task: description: Show task progress and details. name: cp_mgmt_show_task @@ -795,6 +1170,22 @@ plugins: name: cp_mgmt_show_threat_advanced_settings namespace: '' version_added: 3.0.0 + cp_mgmt_show_unused_objects: + description: Retrieve all unused objects. + name: cp_mgmt_show_unused_objects + namespace: '' + version_added: 5.0.0 + cp_mgmt_show_updatable_objects_repository_content: + description: Shows the content of the available updatable objects from the Check + Point User Center. + name: cp_mgmt_show_updatable_objects_repository_content + namespace: '' + version_added: 5.0.0 + cp_mgmt_show_validations: + description: Show all validation incidents limited to 500. + name: cp_mgmt_show_validations + namespace: '' + version_added: 5.0.0 cp_mgmt_simple_cluster: description: Manages simple-cluster objects on Checkpoint over Web Services API @@ -819,6 +1210,22 @@ plugins: name: cp_mgmt_simple_gateway_facts namespace: '' version_added: 1.0.0 + cp_mgmt_smart_task: + description: Manages smart-task objects on Checkpoint over Web Services API + name: cp_mgmt_smart_task + namespace: '' + version_added: 5.0.0 + cp_mgmt_smart_task_facts: + description: Get smart-task objects facts on Checkpoint over Web Services API + name: cp_mgmt_smart_task_facts + namespace: '' + version_added: 5.0.0 + cp_mgmt_smart_task_trigger_facts: + description: Get smart-task-trigger objects facts on Checkpoint over Web Services + API + name: cp_mgmt_smart_task_trigger_facts + namespace: '' + version_added: 5.0.0 cp_mgmt_smtp_server: description: Manages smtp-server objects on Checkpoint over Web Services API name: cp_mgmt_smtp_server @@ -834,6 +1241,28 @@ plugins: name: cp_mgmt_submit_session namespace: '' version_added: 3.0.0 + cp_mgmt_tacacs_group: + description: Manages tacacs-group objects on Checkpoint over Web Services API + name: cp_mgmt_tacacs_group + namespace: '' + version_added: 5.0.0 + cp_mgmt_tacacs_group_facts: + description: Get tacacs-group objects facts on Checkpoint over Web Services + API + name: cp_mgmt_tacacs_group_facts + namespace: '' + version_added: 5.0.0 + cp_mgmt_tacacs_server: + description: Manages tacacs-server objects on Checkpoint over Web Services API + name: cp_mgmt_tacacs_server + namespace: '' + version_added: 5.0.0 + cp_mgmt_tacacs_server_facts: + description: Get tacacs-server objects facts on Checkpoint over Web Services + API + name: cp_mgmt_tacacs_server_facts + namespace: '' + version_added: 5.0.0 cp_mgmt_tag: description: Manages tag objects on Check Point over Web Services API name: cp_mgmt_tag @@ -844,6 +1273,11 @@ plugins: name: cp_mgmt_tag_facts namespace: '' version_added: 1.0.0 + cp_mgmt_task_facts: + description: Get task objects facts on Checkpoint over Web Services API + name: cp_mgmt_task_facts + namespace: '' + version_added: 5.0.0 cp_mgmt_test_sic_status: description: Test SIC Status reflects the state of the gateway after it has received the certificate issued by the ICA. If the SIC status is Unknown then @@ -888,6 +1322,11 @@ plugins: name: cp_mgmt_threat_layer_facts namespace: '' version_added: 1.0.0 + cp_mgmt_threat_layers: + description: Manages THREAT LAYERS resource module + name: cp_mgmt_threat_layers + namespace: '' + version_added: 5.0.0 cp_mgmt_threat_profile: description: Manages threat-profile objects on Check Point over Web Services API @@ -926,6 +1365,16 @@ plugins: name: cp_mgmt_time_facts namespace: '' version_added: 1.0.0 + cp_mgmt_time_group: + description: Manages time-group objects on Checkpoint over Web Services API + name: cp_mgmt_time_group + namespace: '' + version_added: 5.0.0 + cp_mgmt_time_group_facts: + description: Get time-group objects facts on Checkpoint over Web Services API + name: cp_mgmt_time_group_facts + namespace: '' + version_added: 5.0.0 cp_mgmt_trusted_client: description: Manages trusted-client objects on Checkpoint over Web Services API @@ -943,12 +1392,44 @@ plugins: name: cp_mgmt_uninstall_software_package namespace: '' version_added: 2.0.0 + cp_mgmt_unlock_administrator: + description: Unlock administrator. + name: cp_mgmt_unlock_administrator + namespace: '' + version_added: 5.0.0 + cp_mgmt_unlock_object: + description: Unlock object using uid or {name and type}. + name: cp_mgmt_unlock_object + namespace: '' + version_added: 5.0.0 + cp_mgmt_updatable_object_facts: + description: Get updatable-object objects facts on Checkpoint over Web Services + API + name: cp_mgmt_updatable_object_facts + namespace: '' + version_added: 5.0.0 cp_mgmt_update_provisioned_satellites: description: Executes the update-provisioned-satellites on center gateways of VPN communities. name: cp_mgmt_update_provisioned_satellites namespace: '' version_added: 3.0.0 + cp_mgmt_update_updatable_objects_repository_content: + description: Updates the content of the Updatable Objects repository from the + Check Point User Center. + name: cp_mgmt_update_updatable_objects_repository_content + namespace: '' + version_added: 5.0.0 + cp_mgmt_user_group: + description: Manages user-group objects on Checkpoint over Web Services API + name: cp_mgmt_user_group + namespace: '' + version_added: 5.0.0 + cp_mgmt_user_group_facts: + description: Get user-group objects facts on Checkpoint over Web Services API + name: cp_mgmt_user_group_facts + namespace: '' + version_added: 5.0.0 cp_mgmt_verify_policy: description: Verifies the policy of the selected package. name: cp_mgmt_verify_policy @@ -971,6 +1452,12 @@ plugins: name: cp_mgmt_vpn_community_meshed_facts namespace: '' version_added: 1.0.0 + cp_mgmt_vpn_community_remote_access_facts: + description: Get vpn-community-remote-access objects facts on Checkpoint over + Web Services API + name: cp_mgmt_vpn_community_remote_access_facts + namespace: '' + version_added: 5.0.0 cp_mgmt_vpn_community_star: description: Manages vpn-community-star objects on Check Point over Web Services API @@ -983,6 +1470,16 @@ plugins: name: cp_mgmt_vpn_community_star_facts namespace: '' version_added: 1.0.0 + cp_mgmt_vsx_run_operation: + description: Run the VSX operation by its name and parameters. + name: cp_mgmt_vsx_run_operation + namespace: '' + version_added: 5.0.0 + cp_mgmt_where_used: + description: Searches for usage of the target object in other objects and rules. + name: cp_mgmt_where_used + namespace: '' + version_added: 5.0.0 cp_mgmt_wildcard: description: Manages wildcard objects on Check Point over Web Services API name: cp_mgmt_wildcard @@ -996,5 +1493,6 @@ plugins: netconf: {} shell: {} strategy: {} + test: {} vars: {} -version: 4.0.0 +version: 5.2.2 diff --git a/ansible_collections/check_point/mgmt/changelogs/changelog.yaml b/ansible_collections/check_point/mgmt/changelogs/changelog.yaml index 600d23a10..009ed0dce 100644 --- a/ansible_collections/check_point/mgmt/changelogs/changelog.yaml +++ b/ansible_collections/check_point/mgmt/changelogs/changelog.yaml @@ -1,714 +1,961 @@ -ancestor: null +--- +ancestor: releases: 1.0.0: modules: - - description: Manages access-layer objects on Check Point over Web Services API - name: cp_mgmt_access_layer - namespace: '' - - description: Get access-layer objects facts on Check Point over Web Services - API - name: cp_mgmt_access_layer_facts - namespace: '' - - description: Manages access-role objects on Check Point over Web Services API - name: cp_mgmt_access_role - namespace: '' - - description: Get access-role objects facts on Check Point over Web Services - API - name: cp_mgmt_access_role_facts - namespace: '' - - description: Manages access-rule objects on Check Point over Web Services API - name: cp_mgmt_access_rule - namespace: '' - - description: Get access-rule objects facts on Check Point over Web Services - API - name: cp_mgmt_access_rule_facts - namespace: '' - - description: Manages address-range objects on Check Point over Web Services - API - name: cp_mgmt_address_range - namespace: '' - - description: Get address-range objects facts on Check Point over Web Services - API - name: cp_mgmt_address_range_facts - namespace: '' - - description: Manages administrator objects on Checkpoint over Web Services API - name: cp_mgmt_administrator - namespace: '' - - description: Get administrator objects facts on Checkpoint over Web Services - API - name: cp_mgmt_administrator_facts - namespace: '' - - description: Manages application-site objects on Check Point over Web Services - API - name: cp_mgmt_application_site - namespace: '' - - description: Manages application-site-category objects on Check Point over Web - Services API - name: cp_mgmt_application_site_category - namespace: '' - - description: Get application-site-category objects facts on Check Point over - Web Services API - name: cp_mgmt_application_site_category_facts - namespace: '' - - description: Get application-site objects facts on Check Point over Web Services - API - name: cp_mgmt_application_site_facts - namespace: '' - - description: Manages application-site-group objects on Check Point over Web - Services API - name: cp_mgmt_application_site_group - namespace: '' - - description: Get application-site-group objects facts on Check Point over Web - Services API - name: cp_mgmt_application_site_group_facts - namespace: '' - - description: assign global assignment on Check Point over Web Services API - name: cp_mgmt_assign_global_assignment - namespace: '' - - description: All changes done by user are discarded and removed from database. - name: cp_mgmt_discard - namespace: '' - - description: Manages dns-domain objects on Check Point over Web Services API - name: cp_mgmt_dns_domain - namespace: '' - - description: Get dns-domain objects facts on Check Point over Web Services API - name: cp_mgmt_dns_domain_facts - namespace: '' - - description: Manages dynamic-object objects on Check Point over Web Services - API - name: cp_mgmt_dynamic_object - namespace: '' - - description: Get dynamic-object objects facts on Check Point over Web Services - API - name: cp_mgmt_dynamic_object_facts - namespace: '' - - description: Manages exception-group objects on Check Point over Web Services - API - name: cp_mgmt_exception_group - namespace: '' - - description: Get exception-group objects facts on Check Point over Web Services - API - name: cp_mgmt_exception_group_facts - namespace: '' - - description: Manages global-assignment objects on Check Point over Web Services - API - name: cp_mgmt_global_assignment - namespace: '' - - description: Get global-assignment objects facts on Check Point over Web Services - API - name: cp_mgmt_global_assignment_facts - namespace: '' - - description: Manages group objects on Check Point over Web Services API - name: cp_mgmt_group - namespace: '' - - description: Get group objects facts on Check Point over Web Services API - name: cp_mgmt_group_facts - namespace: '' - - description: Manages group-with-exclusion objects on Check Point over Web Services - API - name: cp_mgmt_group_with_exclusion - namespace: '' - - description: Get group-with-exclusion objects facts on Check Point over Web - Services API - name: cp_mgmt_group_with_exclusion_facts - namespace: '' - - description: Manages host objects on Check Point over Web Services API - name: cp_mgmt_host - namespace: '' - - description: Get host objects facts on Check Point over Web Services API - name: cp_mgmt_host_facts - namespace: '' - - description: install policy on Check Point over Web Services API - name: cp_mgmt_install_policy - namespace: '' - - description: Get Multi-Domain Server (mds) objects facts on Check Point over - Web Services API - name: cp_mgmt_mds_facts - namespace: '' - - description: Manages multicast-address-range objects on Check Point over Web - Services API - name: cp_mgmt_multicast_address_range - namespace: '' - - description: Get multicast-address-range objects facts on Check Point over Web - Services API - name: cp_mgmt_multicast_address_range_facts - namespace: '' - - description: Manages network objects on Check Point over Web Services API - name: cp_mgmt_network - namespace: '' - - description: Get network objects facts on Check Point over Web Services API - name: cp_mgmt_network_facts - namespace: '' - - description: Manages package objects on Check Point over Web Services API - name: cp_mgmt_package - namespace: '' - - description: Get package objects facts on Check Point over Web Services API - name: cp_mgmt_package_facts - namespace: '' - - description: All the changes done by this user will be seen by all users only - after publish is called. - name: cp_mgmt_publish - namespace: '' - - description: put file on Check Point over Web Services API - name: cp_mgmt_put_file - namespace: '' - - description: Runs IPS database update. If "package-path" is not provided server - will try to get the latest package from the User Center. - name: cp_mgmt_run_ips_update - namespace: '' - - description: Executes the script on a given list of targets. - name: cp_mgmt_run_script - namespace: '' - - description: Manages security-zone objects on Check Point over Web Services - API - name: cp_mgmt_security_zone - namespace: '' - - description: Get security-zone objects facts on Check Point over Web Services - API - name: cp_mgmt_security_zone_facts - namespace: '' - - description: Manages service-dce-rpc objects on Check Point over Web Services - API - name: cp_mgmt_service_dce_rpc - namespace: '' - - description: Get service-dce-rpc objects facts on Check Point over Web Services - API - name: cp_mgmt_service_dce_rpc_facts - namespace: '' - - description: Manages service-group objects on Check Point over Web Services - API - name: cp_mgmt_service_group - namespace: '' - - description: Get service-group objects facts on Check Point over Web Services - API - name: cp_mgmt_service_group_facts - namespace: '' - - description: Manages service-icmp objects on Check Point over Web Services API - name: cp_mgmt_service_icmp - namespace: '' - - description: Manages service-icmp6 objects on Check Point over Web Services - API - name: cp_mgmt_service_icmp6 - namespace: '' - - description: Get service-icmp6 objects facts on Check Point over Web Services - API - name: cp_mgmt_service_icmp6_facts - namespace: '' - - description: Get service-icmp objects facts on Check Point over Web Services - API - name: cp_mgmt_service_icmp_facts - namespace: '' - - description: Manages service-other objects on Check Point over Web Services - API - name: cp_mgmt_service_other - namespace: '' - - description: Get service-other objects facts on Check Point over Web Services - API - name: cp_mgmt_service_other_facts - namespace: '' - - description: Manages service-rpc objects on Check Point over Web Services API - name: cp_mgmt_service_rpc - namespace: '' - - description: Get service-rpc objects facts on Check Point over Web Services - API - name: cp_mgmt_service_rpc_facts - namespace: '' - - description: Manages service-sctp objects on Check Point over Web Services API - name: cp_mgmt_service_sctp - namespace: '' - - description: Get service-sctp objects facts on Check Point over Web Services - API - name: cp_mgmt_service_sctp_facts - namespace: '' - - description: Manages service-tcp objects on Check Point over Web Services API - name: cp_mgmt_service_tcp - namespace: '' - - description: Get service-tcp objects facts on Check Point over Web Services - API - name: cp_mgmt_service_tcp_facts - namespace: '' - - description: Manages service-udp objects on Check Point over Web Services API - name: cp_mgmt_service_udp - namespace: '' - - description: Get service-udp objects facts on Check Point over Web Services - API - name: cp_mgmt_service_udp_facts - namespace: '' - - description: Get session objects facts on Check Point over Web Services API - name: cp_mgmt_session_facts - namespace: '' - - description: Manages simple-gateway objects on Check Point over Web Services - API - name: cp_mgmt_simple_gateway - namespace: '' - - description: Get simple-gateway objects facts on Check Point over Web Services - API - name: cp_mgmt_simple_gateway_facts - namespace: '' - - description: Manages tag objects on Check Point over Web Services API - name: cp_mgmt_tag - namespace: '' - - description: Get tag objects facts on Check Point over Web Services API - name: cp_mgmt_tag_facts - namespace: '' - - description: Manages threat-exception objects on Check Point over Web Services - API - name: cp_mgmt_threat_exception - namespace: '' - - description: Get threat-exception objects facts on Check Point over Web Services - API - name: cp_mgmt_threat_exception_facts - namespace: '' - - description: Manages threat-indicator objects on Check Point over Web Services - API - name: cp_mgmt_threat_indicator - namespace: '' - - description: Get threat-indicator objects facts on Check Point over Web Services - API - name: cp_mgmt_threat_indicator_facts - namespace: '' - - description: Manages threat-layer objects on Check Point over Web Services API - name: cp_mgmt_threat_layer - namespace: '' - - description: Get threat-layer objects facts on Check Point over Web Services - API - name: cp_mgmt_threat_layer_facts - namespace: '' - - description: Manages threat-profile objects on Check Point over Web Services - API - name: cp_mgmt_threat_profile - namespace: '' - - description: Get threat-profile objects facts on Check Point over Web Services - API - name: cp_mgmt_threat_profile_facts - namespace: '' - - description: Edit existing object using object name or uid. - name: cp_mgmt_threat_protection_override - namespace: '' - - description: Manages threat-rule objects on Check Point over Web Services API - name: cp_mgmt_threat_rule - namespace: '' - - description: Get threat-rule objects facts on Check Point over Web Services - API - name: cp_mgmt_threat_rule_facts - namespace: '' - - description: Manages time objects on Check Point over Web Services API - name: cp_mgmt_time - namespace: '' - - description: Get time objects facts on Check Point over Web Services API - name: cp_mgmt_time_facts - namespace: '' - - description: Verifies the policy of the selected package. - name: cp_mgmt_verify_policy - namespace: '' - - description: Manages vpn-community-meshed objects on Check Point over Web Services - API - name: cp_mgmt_vpn_community_meshed - namespace: '' - - description: Get vpn-community-meshed objects facts on Check Point over Web - Services API - name: cp_mgmt_vpn_community_meshed_facts - namespace: '' - - description: Manages vpn-community-star objects on Check Point over Web Services - API - name: cp_mgmt_vpn_community_star - namespace: '' - - description: Get vpn-community-star objects facts on Check Point over Web Services - API - name: cp_mgmt_vpn_community_star_facts - namespace: '' - - description: Manages wildcard objects on Check Point over Web Services API - name: cp_mgmt_wildcard - namespace: '' - - description: Get wildcard objects facts on Check Point over Web Services API - name: cp_mgmt_wildcard_facts - namespace: '' - release_date: '2022-06-01' + - description: Manages access-layer objects on Check Point over Web Services API + name: cp_mgmt_access_layer + namespace: "" + - description: Get access-layer objects facts on Check Point over Web Services API + name: cp_mgmt_access_layer_facts + namespace: "" + - description: Manages access-role objects on Check Point over Web Services API + name: cp_mgmt_access_role + namespace: "" + - description: Get access-role objects facts on Check Point over Web Services API + name: cp_mgmt_access_role_facts + namespace: "" + - description: Manages access-rule objects on Check Point over Web Services API + name: cp_mgmt_access_rule + namespace: "" + - description: Get access-rule objects facts on Check Point over Web Services API + name: cp_mgmt_access_rule_facts + namespace: "" + - description: Manages address-range objects on Check Point over Web Services API + name: cp_mgmt_address_range + namespace: "" + - description: Get address-range objects facts on Check Point over Web Services API + name: cp_mgmt_address_range_facts + namespace: "" + - description: Manages administrator objects on Checkpoint over Web Services API + name: cp_mgmt_administrator + namespace: "" + - description: Get administrator objects facts on Checkpoint over Web Services API + name: cp_mgmt_administrator_facts + namespace: "" + - description: Manages application-site objects on Check Point over Web Services API + name: cp_mgmt_application_site + namespace: "" + - description: Manages application-site-category objects on Check Point over Web Services API + name: cp_mgmt_application_site_category + namespace: "" + - description: Get application-site-category objects facts on Check Point over Web Services API + name: cp_mgmt_application_site_category_facts + namespace: "" + - description: Get application-site objects facts on Check Point over Web Services API + name: cp_mgmt_application_site_facts + namespace: "" + - description: Manages application-site-group objects on Check Point over Web Services API + name: cp_mgmt_application_site_group + namespace: "" + - description: Get application-site-group objects facts on Check Point over Web Services API + name: cp_mgmt_application_site_group_facts + namespace: "" + - description: assign global assignment on Check Point over Web Services API + name: cp_mgmt_assign_global_assignment + namespace: "" + - description: All changes done by user are discarded and removed from database. + name: cp_mgmt_discard + namespace: "" + - description: Manages dns-domain objects on Check Point over Web Services API + name: cp_mgmt_dns_domain + namespace: "" + - description: Get dns-domain objects facts on Check Point over Web Services API + name: cp_mgmt_dns_domain_facts + namespace: "" + - description: Manages dynamic-object objects on Check Point over Web Services API + name: cp_mgmt_dynamic_object + namespace: "" + - description: Get dynamic-object objects facts on Check Point over Web Services API + name: cp_mgmt_dynamic_object_facts + namespace: "" + - description: Manages exception-group objects on Check Point over Web Services API + name: cp_mgmt_exception_group + namespace: "" + - description: Get exception-group objects facts on Check Point over Web Services API + name: cp_mgmt_exception_group_facts + namespace: "" + - description: Manages global-assignment objects on Check Point over Web Services API + name: cp_mgmt_global_assignment + namespace: "" + - description: Get global-assignment objects facts on Check Point over Web Services API + name: cp_mgmt_global_assignment_facts + namespace: "" + - description: Manages group objects on Check Point over Web Services API + name: cp_mgmt_group + namespace: "" + - description: Get group objects facts on Check Point over Web Services API + name: cp_mgmt_group_facts + namespace: "" + - description: Manages group-with-exclusion objects on Check Point over Web Services API + name: cp_mgmt_group_with_exclusion + namespace: "" + - description: Get group-with-exclusion objects facts on Check Point over Web Services API + name: cp_mgmt_group_with_exclusion_facts + namespace: "" + - description: Manages host objects on Check Point over Web Services API + name: cp_mgmt_host + namespace: "" + - description: Get host objects facts on Check Point over Web Services API + name: cp_mgmt_host_facts + namespace: "" + - description: install policy on Check Point over Web Services API + name: cp_mgmt_install_policy + namespace: "" + - description: Get Multi-Domain Server (mds) objects facts on Check Point over Web Services API + name: cp_mgmt_mds_facts + namespace: "" + - description: Manages multicast-address-range objects on Check Point over Web Services API + name: cp_mgmt_multicast_address_range + namespace: "" + - description: Get multicast-address-range objects facts on Check Point over Web Services API + name: cp_mgmt_multicast_address_range_facts + namespace: "" + - description: Manages network objects on Check Point over Web Services API + name: cp_mgmt_network + namespace: "" + - description: Get network objects facts on Check Point over Web Services API + name: cp_mgmt_network_facts + namespace: "" + - description: Manages package objects on Check Point over Web Services API + name: cp_mgmt_package + namespace: "" + - description: Get package objects facts on Check Point over Web Services API + name: cp_mgmt_package_facts + namespace: "" + - description: All the changes done by this user will be seen by all users only after publish is called. + name: cp_mgmt_publish + namespace: "" + - description: put file on Check Point over Web Services API + name: cp_mgmt_put_file + namespace: "" + - description: Runs IPS database update. If "package-path" is not provided server will try to get the latest package from the User Center. + name: cp_mgmt_run_ips_update + namespace: "" + - description: Executes the script on a given list of targets. + name: cp_mgmt_run_script + namespace: "" + - description: Manages security-zone objects on Check Point over Web Services API + name: cp_mgmt_security_zone + namespace: "" + - description: Get security-zone objects facts on Check Point over Web Services API + name: cp_mgmt_security_zone_facts + namespace: "" + - description: Manages service-dce-rpc objects on Check Point over Web Services API + name: cp_mgmt_service_dce_rpc + namespace: "" + - description: Get service-dce-rpc objects facts on Check Point over Web Services API + name: cp_mgmt_service_dce_rpc_facts + namespace: "" + - description: Manages service-group objects on Check Point over Web Services API + name: cp_mgmt_service_group + namespace: "" + - description: Get service-group objects facts on Check Point over Web Services API + name: cp_mgmt_service_group_facts + namespace: "" + - description: Manages service-icmp objects on Check Point over Web Services API + name: cp_mgmt_service_icmp + namespace: "" + - description: Manages service-icmp6 objects on Check Point over Web Services API + name: cp_mgmt_service_icmp6 + namespace: "" + - description: Get service-icmp6 objects facts on Check Point over Web Services API + name: cp_mgmt_service_icmp6_facts + namespace: "" + - description: Get service-icmp objects facts on Check Point over Web Services API + name: cp_mgmt_service_icmp_facts + namespace: "" + - description: Manages service-other objects on Check Point over Web Services API + name: cp_mgmt_service_other + namespace: "" + - description: Get service-other objects facts on Check Point over Web Services API + name: cp_mgmt_service_other_facts + namespace: "" + - description: Manages service-rpc objects on Check Point over Web Services API + name: cp_mgmt_service_rpc + namespace: "" + - description: Get service-rpc objects facts on Check Point over Web Services API + name: cp_mgmt_service_rpc_facts + namespace: "" + - description: Manages service-sctp objects on Check Point over Web Services API + name: cp_mgmt_service_sctp + namespace: "" + - description: Get service-sctp objects facts on Check Point over Web Services API + name: cp_mgmt_service_sctp_facts + namespace: "" + - description: Manages service-tcp objects on Check Point over Web Services API + name: cp_mgmt_service_tcp + namespace: "" + - description: Get service-tcp objects facts on Check Point over Web Services API + name: cp_mgmt_service_tcp_facts + namespace: "" + - description: Manages service-udp objects on Check Point over Web Services API + name: cp_mgmt_service_udp + namespace: "" + - description: Get service-udp objects facts on Check Point over Web Services API + name: cp_mgmt_service_udp_facts + namespace: "" + - description: Get session objects facts on Check Point over Web Services API + name: cp_mgmt_session_facts + namespace: "" + - description: Manages simple-gateway objects on Check Point over Web Services API + name: cp_mgmt_simple_gateway + namespace: "" + - description: Get simple-gateway objects facts on Check Point over Web Services API + name: cp_mgmt_simple_gateway_facts + namespace: "" + - description: Manages tag objects on Check Point over Web Services API + name: cp_mgmt_tag + namespace: "" + - description: Get tag objects facts on Check Point over Web Services API + name: cp_mgmt_tag_facts + namespace: "" + - description: Manages threat-exception objects on Check Point over Web Services API + name: cp_mgmt_threat_exception + namespace: "" + - description: Get threat-exception objects facts on Check Point over Web Services API + name: cp_mgmt_threat_exception_facts + namespace: "" + - description: Manages threat-indicator objects on Check Point over Web Services API + name: cp_mgmt_threat_indicator + namespace: "" + - description: Get threat-indicator objects facts on Check Point over Web Services API + name: cp_mgmt_threat_indicator_facts + namespace: "" + - description: Manages threat-layer objects on Check Point over Web Services API + name: cp_mgmt_threat_layer + namespace: "" + - description: Get threat-layer objects facts on Check Point over Web Services API + name: cp_mgmt_threat_layer_facts + namespace: "" + - description: Manages threat-profile objects on Check Point over Web Services API + name: cp_mgmt_threat_profile + namespace: "" + - description: Get threat-profile objects facts on Check Point over Web Services API + name: cp_mgmt_threat_profile_facts + namespace: "" + - description: Edit existing object using object name or uid. + name: cp_mgmt_threat_protection_override + namespace: "" + - description: Manages threat-rule objects on Check Point over Web Services API + name: cp_mgmt_threat_rule + namespace: "" + - description: Get threat-rule objects facts on Check Point over Web Services API + name: cp_mgmt_threat_rule_facts + namespace: "" + - description: Manages time objects on Check Point over Web Services API + name: cp_mgmt_time + namespace: "" + - description: Get time objects facts on Check Point over Web Services API + name: cp_mgmt_time_facts + namespace: "" + - description: Verifies the policy of the selected package. + name: cp_mgmt_verify_policy + namespace: "" + - description: Manages vpn-community-meshed objects on Check Point over Web Services API + name: cp_mgmt_vpn_community_meshed + namespace: "" + - description: Get vpn-community-meshed objects facts on Check Point over Web Services API + name: cp_mgmt_vpn_community_meshed_facts + namespace: "" + - description: Manages vpn-community-star objects on Check Point over Web Services API + name: cp_mgmt_vpn_community_star + namespace: "" + - description: Get vpn-community-star objects facts on Check Point over Web Services API + name: cp_mgmt_vpn_community_star_facts + namespace: "" + - description: Manages wildcard objects on Check Point over Web Services API + name: cp_mgmt_wildcard + namespace: "" + - description: Get wildcard objects facts on Check Point over Web Services API + name: cp_mgmt_wildcard_facts + namespace: "" + release_date: "2022-06-01" 2.0.0: modules: - - description: Manages access-section objects on Checkpoint over Web Services - API - name: cp_mgmt_access_section - namespace: '' - - description: Add API key for administrator, to enable login with it. For the - key to be valid publish is needed. - name: cp_mgmt_add_api_key - namespace: '' - - description: Imports a Data Center Object from a Data Center Server.<br> Data - Center Object represents an object in the cloud environment. - name: cp_mgmt_add_data_center_object - namespace: '' - - description: Create new object. - name: cp_mgmt_add_nat_rule - namespace: '' - - description: Get data-center-object objects facts on Checkpoint over Web Services - API - name: cp_mgmt_data_center_object_facts - namespace: '' - - description: Delete the API key. For the key to be invalid publish is needed. - name: cp_mgmt_delete_api_key - namespace: '' - - description: Delete existing object using object name or uid. - name: cp_mgmt_delete_data_center_object - namespace: '' - - description: Delete existing object using object name or uid. - name: cp_mgmt_delete_nat_rule - namespace: '' - - description: Manages https-section objects on Checkpoint over Web Services API - name: cp_mgmt_https_section - namespace: '' - - description: Installs the software package on target machines. - name: cp_mgmt_install_software_package - namespace: '' - - description: Get nat-rule objects facts on Checkpoint over Web Services API - name: cp_mgmt_nat_rule_facts - namespace: '' - - description: Manages nat-section objects on Checkpoint over Web Services API - name: cp_mgmt_nat_section - namespace: '' - - description: Edit existing object using object name or uid. - name: cp_mgmt_set_nat_rule - namespace: '' - - description: Edit user's current session. - name: cp_mgmt_set_session - namespace: '' - - description: Retrieve existing object using object name or uid. - name: cp_mgmt_show_access_section - namespace: '' - - description: Retrieve existing HTTPS Inspection section using section name or - uid and layer name. - name: cp_mgmt_show_https_section - namespace: '' - - description: Showing logs according to the given filter. - name: cp_mgmt_show_logs - namespace: '' - - description: Retrieve existing object using object name or uid. - name: cp_mgmt_show_nat_section - namespace: '' - - description: Gets the software package information from the cloud. - name: cp_mgmt_show_software_package_details - namespace: '' - - description: Show task progress and details. - name: cp_mgmt_show_task - namespace: '' - - description: Retrieve all tasks and show their progress and details. - name: cp_mgmt_show_tasks - namespace: '' - - description: Uninstalls the software package from target machines. - name: cp_mgmt_uninstall_software_package - namespace: '' - - description: Verifies the software package on target machines. - name: cp_mgmt_verify_software_package - namespace: '' - release_date: '2022-06-01' + - description: Manages access-section objects on Checkpoint over Web Services API + name: cp_mgmt_access_section + namespace: "" + - description: Add API key for administrator, to enable login with it. For the key to be valid publish is needed. + name: cp_mgmt_add_api_key + namespace: "" + - description: Imports a Data Center Object from a Data Center Server.<br> Data Center Object represents an object in the cloud environment. + name: cp_mgmt_add_data_center_object + namespace: "" + - description: Create new object. + name: cp_mgmt_add_nat_rule + namespace: "" + - description: Get data-center-object objects facts on Checkpoint over Web Services API + name: cp_mgmt_data_center_object_facts + namespace: "" + - description: Delete the API key. For the key to be invalid publish is needed. + name: cp_mgmt_delete_api_key + namespace: "" + - description: Delete existing object using object name or uid. + name: cp_mgmt_delete_data_center_object + namespace: "" + - description: Delete existing object using object name or uid. + name: cp_mgmt_delete_nat_rule + namespace: "" + - description: Manages https-section objects on Checkpoint over Web Services API + name: cp_mgmt_https_section + namespace: "" + - description: Installs the software package on target machines. + name: cp_mgmt_install_software_package + namespace: "" + - description: Get nat-rule objects facts on Checkpoint over Web Services API + name: cp_mgmt_nat_rule_facts + namespace: "" + - description: Manages nat-section objects on Checkpoint over Web Services API + name: cp_mgmt_nat_section + namespace: "" + - description: Edit existing object using object name or uid. + name: cp_mgmt_set_nat_rule + namespace: "" + - description: Edit user's current session. + name: cp_mgmt_set_session + namespace: "" + - description: Retrieve existing object using object name or uid. + name: cp_mgmt_show_access_section + namespace: "" + - description: Retrieve existing HTTPS Inspection section using section name or uid and layer name. + name: cp_mgmt_show_https_section + namespace: "" + - description: Showing logs according to the given filter. + name: cp_mgmt_show_logs + namespace: "" + - description: Retrieve existing object using object name or uid. + name: cp_mgmt_show_nat_section + namespace: "" + - description: Gets the software package information from the cloud. + name: cp_mgmt_show_software_package_details + namespace: "" + - description: Show task progress and details. + name: cp_mgmt_show_task + namespace: "" + - description: Retrieve all tasks and show their progress and details. + name: cp_mgmt_show_tasks + namespace: "" + - description: Uninstalls the software package from target machines. + name: cp_mgmt_uninstall_software_package + namespace: "" + - description: Verifies the software package on target machines. + name: cp_mgmt_verify_software_package + namespace: "" + release_date: "2022-06-01" 2.1.0: modules: - - description: Create new object - name: cp_mgmt_add_domain - namespace: '' - - description: Delete existing object using object name or uid. - name: cp_mgmt_delete_domain - namespace: '' - - description: Get domain objects facts on Checkpoint over Web Services API - name: cp_mgmt_domain_facts - namespace: '' - - description: Manages identity-tag objects on Checkpoint over Web Services API - name: cp_mgmt_identity_tag - namespace: '' - - description: Get identity-tag objects facts on Checkpoint over Web Services - API - name: cp_mgmt_identity_tag_facts - namespace: '' - - description: Copies the user database and network objects information to specified - targets. - name: cp_mgmt_install_database - namespace: '' - - description: Manages mds objects on Checkpoint over Web Services API - name: cp_mgmt_mds - namespace: '' - - description: Edit existing object using object name or uid. - name: cp_mgmt_set_domain - namespace: '' - - description: Manages trusted-client objects on Checkpoint over Web Services - API - name: cp_mgmt_trusted_client - namespace: '' - - description: Get trusted-client objects facts on Checkpoint over Web Services - API - name: cp_mgmt_trusted_client_facts - namespace: '' - release_date: '2022-06-01' + - description: Create new object + name: cp_mgmt_add_domain + namespace: "" + - description: Delete existing object using object name or uid. + name: cp_mgmt_delete_domain + namespace: "" + - description: Get domain objects facts on Checkpoint over Web Services API + name: cp_mgmt_domain_facts + namespace: "" + - description: Manages identity-tag objects on Checkpoint over Web Services API + name: cp_mgmt_identity_tag + namespace: "" + - description: Get identity-tag objects facts on Checkpoint over Web Services API + name: cp_mgmt_identity_tag_facts + namespace: "" + - description: Copies the user database and network objects information to specified targets. + name: cp_mgmt_install_database + namespace: "" + - description: Manages mds objects on Checkpoint over Web Services API + name: cp_mgmt_mds + namespace: "" + - description: Edit existing object using object name or uid. + name: cp_mgmt_set_domain + namespace: "" + - description: Manages trusted-client objects on Checkpoint over Web Services API + name: cp_mgmt_trusted_client + namespace: "" + - description: Get trusted-client objects facts on Checkpoint over Web Services API + name: cp_mgmt_trusted_client_facts + namespace: "" + release_date: "2022-06-01" 2.2.0: modules: - - description: Manages access-rules objects on Check Point over Web Services API - name: cp_mgmt_access_rules - namespace: '' - release_date: '2022-06-01' + - description: Manages access-rules objects on Check Point over Web Services API + name: cp_mgmt_access_rules + namespace: "" + release_date: "2022-06-01" 2.3.0: modules: - - description: Manages lsm-cluster objects on Checkpoint over Web Services API - name: cp_mgmt_lsm_cluster - namespace: '' - - description: Get lsm-cluster objects facts on Checkpoint over Web Services API - name: cp_mgmt_lsm_cluster_facts - namespace: '' - - description: Manages lsm-gateway objects on Checkpoint over Web Services API - name: cp_mgmt_lsm_gateway - namespace: '' - - description: Get lsm-gateway objects facts on Checkpoint over Web Services API - name: cp_mgmt_lsm_gateway_facts - namespace: '' - release_date: '2022-06-01' + - description: Manages lsm-cluster objects on Checkpoint over Web Services API + name: cp_mgmt_lsm_cluster + namespace: "" + - description: Get lsm-cluster objects facts on Checkpoint over Web Services API + name: cp_mgmt_lsm_cluster_facts + namespace: "" + - description: Manages lsm-gateway objects on Checkpoint over Web Services API + name: cp_mgmt_lsm_gateway + namespace: "" + - description: Get lsm-gateway objects facts on Checkpoint over Web Services API + name: cp_mgmt_lsm_gateway_facts + namespace: "" + release_date: "2022-06-01" 3.0.0: changes: - release_summary: This is release 3.0.0 of ``check_point.mgmt``, released on - 2022-06-07. + release_summary: This is release 3.0.0 of ``check_point.mgmt``, released on 2022-06-07. fragments: - - 3.0.0.yml + - 3.0.0.yml modules: - - description: Creates new rules in batch. Use this API to achieve optimum performance - when adding more than one rule. - name: cp_mgmt_add_rules_batch - namespace: '' - - description: Workflow feature - Approve and Publish the session. - name: cp_mgmt_approve_session - namespace: '' - - description: Check if a target can reach or parse a network feed; can work with - an existing feed object or with a new one (by providing all relevant feed - parameters). - name: cp_mgmt_check_network_feed - namespace: '' - - description: Check if a target can reach or parse a threat IOC feed; can work - with an existing feed object or with a new one (by providing all relevant - feed parameters). - name: cp_mgmt_check_threat_ioc_feed - namespace: '' - - description: Retrieve all existing cluster members in domain. - name: cp_mgmt_cluster_members_facts - namespace: '' - - description: Securely connect the Management Server to Check Point's Infinity - Portal. <br>This is a preliminary operation so that the management server - can use various Check Point cloud-based security services hosted in the Infinity - Portal. - name: cp_mgmt_connect_cloud_services - namespace: '' - - description: Delete rules in batch from the same layer. Use this API to achieve - optimum performance when removing more than one rule. - name: cp_mgmt_delete_rules_batch - namespace: '' - - description: Disconnect the Management Server from Check Point's Infinity Portal. - name: cp_mgmt_disconnect_cloud_services - namespace: '' - - description: Manages domain-permissions-profile objects on Checkpoint over Web - Services API - name: cp_mgmt_domain_permissions_profile - namespace: '' - - description: Get domain-permissions-profile objects facts on Checkpoint over - Web Services API - name: cp_mgmt_domain_permissions_profile_facts - namespace: '' - - description: Get actual platform (Hardware, Version, OS) from gateway, cluster - or Check Point host. - name: cp_mgmt_get_platform - namespace: '' - - description: Manages idp-administrator-group objects on Checkpoint over Web - Services API - name: cp_mgmt_idp_administrator_group - namespace: '' - - description: Get idp-administrator-group objects facts on Checkpoint over Web - Services API - name: cp_mgmt_idp_administrator_group_facts - namespace: '' - - description: Get idp-to-domain-assignment objects facts on Checkpoint over Web - Services API - name: cp_mgmt_idp_to_domain_assignment_facts - namespace: '' - - description: Import Outbound Inspection certificate for HTTPS inspection. - name: cp_mgmt_import_outbound_inspection_certificate - namespace: '' - - description: Executes the lsm-install-policy on a given list of targets. Install - the LSM policy that defined on the attached LSM profile on the targets devices. - name: cp_mgmt_install_lsm_policy - namespace: '' - - description: Executes the lsm-install-settings on a given list of targets. Install - the provisioning settings that defined on the object on the targets devices. - name: cp_mgmt_install_lsm_settings - namespace: '' - - description: Manages interoperable-device objects on Checkpoint over Web Services - API - name: cp_mgmt_interoperable_device - namespace: '' - - description: Get interoperable-device objects facts on Checkpoint over Web Services - API - name: cp_mgmt_interoperable_device_facts - namespace: '' - - description: Get lsm-cluster-profile objects facts on Checkpoint over Web Services - API - name: cp_mgmt_lsm_cluster_profile_facts - namespace: '' - - description: Get lsm-gateway-profile objects facts on Checkpoint over Web Services - API - name: cp_mgmt_lsm_gateway_profile_facts - namespace: '' - - description: Executes the lsm-run-script on a given list of targets. Run the - given script on the targets devices. - name: cp_mgmt_lsm_run_script - namespace: '' - - description: Manages md-permissions-profile objects on Checkpoint over Web Services - API - name: cp_mgmt_md_permissions_profile - namespace: '' - - description: Get md-permissions-profile objects facts on Checkpoint over Web - Services API - name: cp_mgmt_md_permissions_profile_facts - namespace: '' - - description: Manages network-feed objects on Checkpoint over Web Services API - name: cp_mgmt_network_feed - namespace: '' - - description: Get network-feed objects facts on Checkpoint over Web Services - API - name: cp_mgmt_network_feed_facts - namespace: '' - - description: Get objects objects facts on Checkpoint over Web Services API - name: cp_mgmt_objects_facts - namespace: '' - - description: Get provisioning-profile objects facts on Checkpoint over Web Services - API - name: cp_mgmt_provisioning_profile_facts - namespace: '' - - description: Workflow feature - Return the session to the submitter administrator. - name: cp_mgmt_reject_session - namespace: '' - - description: Manages repository-script objects on Checkpoint over Web Services - API - name: cp_mgmt_repository_script - namespace: '' - - description: Get repository-script objects facts on Checkpoint over Web Services - API - name: cp_mgmt_repository_script_facts - namespace: '' - - description: Reset Secure Internal Communication (SIC). To complete the reset - operation need also to reset the device in the Check Point Configuration Tool - (by running cpconfig in Clish or Expert mode). Communication will not be possible - until you reset and re-initialize the device properly. - name: cp_mgmt_reset_sic - namespace: '' - - description: Edit Global Properties. - name: cp_mgmt_set_global_properties - namespace: '' - - description: Set default Identity Provider assignment to be use for Management - server administrator access. - name: cp_mgmt_set_idp_default_assignment - namespace: '' - - description: Set Identity Provider assignment to domain, to allow administrator - login to that domain using that identity provider, if there is no Identity - Provider assigned to the domain the 'idp-default-assignment' will be used. - This command only available for Multi-Domain server. - name: cp_mgmt_set_idp_to_domain_assignment - namespace: '' - - description: Create or update a certificate to be used as outbound certificate - for HTTPS inspection. <br>The outbound CA certificate will be used by the - Gateway to inspect SSL traffic. - name: cp_mgmt_set_outbound_inspection_certificate - namespace: '' - - description: Edit Threat Prevention's Blades' Settings. - name: cp_mgmt_set_threat_advanced_settings - namespace: '' - - description: Show the connection status of the Management Server to Check Point's - Infinity Portal. - name: cp_mgmt_show_cloud_services - namespace: '' - - description: Retrieve Global Properties. - name: cp_mgmt_show_global_properties - namespace: '' - - description: Retrieve default Identity Provider assignment that used for Management - server administrator access. - name: cp_mgmt_show_idp_default_assignment - namespace: '' - - description: Show outbound inspection certificate. - name: cp_mgmt_show_outbound_inspection_certificate - namespace: '' - - description: Shows the status of all processes in the current machine (Multi-Domain - Server and all Domain Management / Log Servers). <br>This command is available - only on Multi-Domain Server. - name: cp_mgmt_show_servers_and_processes - namespace: '' - - description: Show Threat Prevention's Blades' Settings. - name: cp_mgmt_show_threat_advanced_settings - namespace: '' - - description: Manages simple-cluster objects on Checkpoint over Web Services - API - name: cp_mgmt_simple_cluster - namespace: '' - - description: Get simple-cluster objects facts on Checkpoint over Web Services - API - name: cp_mgmt_simple_cluster_facts - namespace: '' - - description: Manages smtp-server objects on Checkpoint over Web Services API - name: cp_mgmt_smtp_server - namespace: '' - - description: Get smtp-server objects facts on Checkpoint over Web Services API - name: cp_mgmt_smtp_server_facts - namespace: '' - - description: Workflow feature - Submit the session for approval. - name: cp_mgmt_submit_session - namespace: '' - - description: Test SIC Status reflects the state of the gateway after it has - received the certificate issued by the ICA. If the SIC status is Unknown then - there is no connection between the gateway and the Security Management Server. - If the SIC status is No Communication, an error message will appear. It may - contain specific instructions on how to fix the situation. - name: cp_mgmt_test_sic_status - namespace: '' - - description: Executes the update-provisioned-satellites on center gateways of - VPN communities. - name: cp_mgmt_update_provisioned_satellites - namespace: '' - release_date: '2022-05-31' + - description: Creates new rules in batch. Use this API to achieve optimum performance when adding more than one rule. + name: cp_mgmt_add_rules_batch + namespace: "" + - description: Workflow feature - Approve and Publish the session. + name: cp_mgmt_approve_session + namespace: "" + - description: > + Check if a target can reach or parse a network feed; + can work with an existing feed object or with a new one + (by providing all relevant feed parameters). + name: cp_mgmt_check_network_feed + namespace: "" + - description: > + Check if a target can reach or parse a threat IOC feed; can work with an existing feed + object or with a new one (by providing all relevant feed parameters). + name: cp_mgmt_check_threat_ioc_feed + namespace: "" + - description: Retrieve all existing cluster members in domain. + name: cp_mgmt_cluster_members_facts + namespace: "" + - description: > + Securely connect the Management Server to Check Point's Infinity Portal. + This is a preliminary operation so that the management server can use + various Check Point cloud-based security services hosted in the Infinity Portal. + name: cp_mgmt_connect_cloud_services + namespace: "" + - description: Delete rules in batch from the same layer. Use this API to achieve optimum performance when removing more than one rule. + name: cp_mgmt_delete_rules_batch + namespace: "" + - description: Disconnect the Management Server from Check Point's Infinity Portal. + name: cp_mgmt_disconnect_cloud_services + namespace: "" + - description: Manages domain-permissions-profile objects on Checkpoint over Web Services API + name: cp_mgmt_domain_permissions_profile + namespace: "" + - description: Get domain-permissions-profile objects facts on Checkpoint over Web Services API + name: cp_mgmt_domain_permissions_profile_facts + namespace: "" + - description: Get actual platform (Hardware, Version, OS) from gateway, cluster or Check Point host. + name: cp_mgmt_get_platform + namespace: "" + - description: Manages idp-administrator-group objects on Checkpoint over Web Services API + name: cp_mgmt_idp_administrator_group + namespace: "" + - description: Get idp-administrator-group objects facts on Checkpoint over Web Services API + name: cp_mgmt_idp_administrator_group_facts + namespace: "" + - description: Get idp-to-domain-assignment objects facts on Checkpoint over Web Services API + name: cp_mgmt_idp_to_domain_assignment_facts + namespace: "" + - description: > + Executes the lsm-install-policy on a given list of targets. Install the LSM policy + that defined on the attached LSM profile on the targets devices. + name: cp_mgmt_install_lsm_policy + namespace: "" + - description: > + Executes the lsm-install-settings on a given list of targets. Install the provisioning + settings that defined on the object on the targets devices. + name: cp_mgmt_install_lsm_settings + namespace: "" + - description: Manages interoperable-device objects on Checkpoint over Web Services API + name: cp_mgmt_interoperable_device + namespace: "" + - description: Get interoperable-device objects facts on Checkpoint over Web Services API + name: cp_mgmt_interoperable_device_facts + namespace: "" + - description: Get lsm-cluster-profile objects facts on Checkpoint over Web Services API + name: cp_mgmt_lsm_cluster_profile_facts + namespace: "" + - description: Get lsm-gateway-profile objects facts on Checkpoint over Web Services API + name: cp_mgmt_lsm_gateway_profile_facts + namespace: "" + - description: Executes the lsm-run-script on a given list of targets. Run the given script on the targets devices. + name: cp_mgmt_lsm_run_script + namespace: "" + - description: Manages md-permissions-profile objects on Checkpoint over Web Services API + name: cp_mgmt_md_permissions_profile + namespace: "" + - description: Get md-permissions-profile objects facts on Checkpoint over Web Services API + name: cp_mgmt_md_permissions_profile_facts + namespace: "" + - description: Manages network-feed objects on Checkpoint over Web Services API + name: cp_mgmt_network_feed + namespace: "" + - description: Get network-feed objects facts on Checkpoint over Web Services API + name: cp_mgmt_network_feed_facts + namespace: "" + - description: Get objects objects facts on Checkpoint over Web Services API + name: cp_mgmt_objects_facts + namespace: "" + - description: Get provisioning-profile objects facts on Checkpoint over Web Services API + name: cp_mgmt_provisioning_profile_facts + namespace: "" + - description: Workflow feature - Return the session to the submitter administrator. + name: cp_mgmt_reject_session + namespace: "" + - description: Manages repository-script objects on Checkpoint over Web Services API + name: cp_mgmt_repository_script + namespace: "" + - description: Get repository-script objects facts on Checkpoint over Web Services API + name: cp_mgmt_repository_script_facts + namespace: "" + - description: > + Reset Secure Internal Communication (SIC). To complete the reset operation need also + to reset the device in the Check Point Configuration Tool (by running cpconfig in Clish or Expert mode). + Communication will not be possible until you reset and re-initialize the device properly. + name: cp_mgmt_reset_sic + namespace: "" + - description: Edit Global Properties. + name: cp_mgmt_set_global_properties + namespace: "" + - description: Set default Identity Provider assignment to be use for Management server administrator access. + name: cp_mgmt_set_idp_default_assignment + namespace: "" + - description: > + Set Identity Provider assignment to domain, to allow administrator login to that domain using + that identity provider, if there is no Identity Provider assigned to the domain the 'idp-default-assignment' will be used. + This command only available for Multi-Domain server. + name: cp_mgmt_set_idp_to_domain_assignment + namespace: "" + - description: Edit Threat Prevention's Blades' Settings. + name: cp_mgmt_set_threat_advanced_settings + namespace: "" + - description: Show the connection status of the Management Server to Check Point's Infinity Portal. + name: cp_mgmt_show_cloud_services + namespace: "" + - description: Retrieve Global Properties. + name: cp_mgmt_show_global_properties + namespace: "" + - description: Retrieve default Identity Provider assignment that used for Management server administrator access. + name: cp_mgmt_show_idp_default_assignment + namespace: "" + - description: > + Shows the status of all processes in the current machine (Multi-Domain Server and all Domain Management / Log Servers). + This command is available only on Multi-Domain Server. + name: cp_mgmt_show_servers_and_processes + namespace: "" + - description: Show Threat Prevention's Blades' Settings. + name: cp_mgmt_show_threat_advanced_settings + namespace: "" + - description: Manages simple-cluster objects on Checkpoint over Web Services API + name: cp_mgmt_simple_cluster + namespace: "" + - description: Get simple-cluster objects facts on Checkpoint over Web Services API + name: cp_mgmt_simple_cluster_facts + namespace: "" + - description: Manages smtp-server objects on Checkpoint over Web Services API + name: cp_mgmt_smtp_server + namespace: "" + - description: Get smtp-server objects facts on Checkpoint over Web Services API + name: cp_mgmt_smtp_server_facts + namespace: "" + - description: Workflow feature - Submit the session for approval. + name: cp_mgmt_submit_session + namespace: "" + - description: > + Test SIC Status reflects the state of the gateway after it has received the certificate issued by the ICA. + If the SIC status is Unknown then there is no connection between the gateway and the Security Management Server. + If the SIC status is No Communication, an error message will appear. It may contain specific instructions on how to fix the situation. + name: cp_mgmt_test_sic_status + namespace: "" + - description: Executes the update-provisioned-satellites on center gateways of VPN communities. + name: cp_mgmt_update_provisioned_satellites + namespace: "" + release_date: "2022-05-31" 3.1.0: changes: - release_summary: This is release 3.1.0 of ``check_point.mgmt``, released on - 2022-07-04. + release_summary: This is release 3.1.0 of ``check_point.mgmt``, released on 2022-07-04. fragments: - - 3.1.0.yml - release_date: '2022-07-04' + - 3.1.0.yml + release_date: "2022-07-04" 3.2.0: changes: - release_summary: This is release 3.2.0 of ``check_point.mgmt``, released on - 2022-08-09. + release_summary: This is release 3.2.0 of ``check_point.mgmt``, released on 2022-08-09. fragments: - - 3.2.0.yml - release_date: '2022-06-09' + - 3.2.0.yml + release_date: "2022-06-09" 4.0.0: changes: breaking_changes: - - cp_mgmt_access_role - the 'machines' parameter now accepts a single str and - a new parameter 'machines_list' of type dict has been added. the 'users' parameter - now accepts a single str and a new parameter 'users_list' of type dict has - been added. - - cp_mgmt_access_rule - the 'vpn' parameter now accepts a single str and a new - parameter 'vpn_list' of type dict has been added. the 'position_by_rule' parameter - has been changed to 'relative_position' with support of positioning above/below - a section (and not just a rule). the 'relative_position' parameter has also - 'top' and 'bottom' suboptions which allows positioning a rule at the top and - bottom of a section respectively. a new parameter 'search_entire_rulebase' - has been added to allow the relative positioning to be unlimited (was previously - limited to 50 rules) - - cp_mgmt_administrator - the 'permissions_profile' parameter now accepts a - single str and a new parameter 'permissions_profile_list' of type dict has - been added. - - cp_mgmt_publish - the 'uid' parameter has been removed. + - cp_mgmt_access_role- > + The 'machines' parameter now accepts a single str and a new parameter 'machines_list' of type dict has been added. + The 'users' parameter now accepts a single str and a new parameter 'users_list' of type dict has been added. + - cp_mgmt_access_rule- > + The 'vpn' parameter now accepts a single str and a new parameter 'vpn_list' of type dict has been added. + The 'position_by_rule' parameter has been changed to 'relative_position' with support of positioning above/below + a section (and not just a rule). the 'relative_position' parameter has also 'top' and 'bottom' suboptions which allows + positioning a rule at the top and bottom of a section respectively. + A new parameter 'search_entire_rulebase' has been added to allow the relative positioning to be unlimited (was previously limited to 50 rules). + - cp_mgmt_administrator- > + The 'permissions_profile' parameter now accepts a single str and a new parameter 'permissions_profile_list' + of type dict has been added. + - cp_mgmt_publish - the 'uid' parameter has been removed. bugfixes: - - cp_mgmt_access_rule - support for relative positioning for rulebase with more - than 50 rules (https://github.com/CheckPointSW/CheckPointAnsibleMgmtCollection/issues/69) - - cp_mgmt_administrator - specifying the administartor's permissions profile - now works for both SMC and MDS (https://github.com/CheckPointSW/CheckPointAnsibleMgmtCollection/issues/83) - - meta/runtime.yml - update value of minimum ansible version and remove redirect - (https://github.com/CheckPointSW/CheckPointAnsibleMgmtCollection/issues/84) + - cp_mgmt_access_rule- > + support for relative positioning for rulebase with more than 50 rules + (https://github.com/CheckPointSW/CheckPointAnsibleMgmtCollection/issues/69) + - cp_mgmt_administrator- > + specifying the administartor's permissions profile now works for both SMC and MDS + (https://github.com/CheckPointSW/CheckPointAnsibleMgmtCollection/issues/83) + - meta/runtime.yml - update value of minimum ansible version and remove redirect + (https://github.com/CheckPointSW/CheckPointAnsibleMgmtCollection/issues/84) major_changes: - - plugins/httpapi/checkpoint - Support for Smart-1 Cloud with new variable 'ansible_cloud_mgmt_id' - release_summary: This is release 4.0.0 of ``check_point.mgmt``, released on - 2022-09-14. + - plugins/httpapi/checkpoint - Support for Smart-1 Cloud with new variable 'ansible_cloud_mgmt_id' + release_summary: This is release 4.0.0 of ``check_point.mgmt``, released on 2022-09-14. fragments: - - 4.0.0.yml - release_date: '2022-06-09' + - 4.0.0.yml + release_date: "2022-06-09" + 5.0.0: + changes: + deprecated_features: + - add/set/delete nat-rule modules - will be replaced by the single cp_mgmt_nat_rule module. + - cp_mgmt_show_task/s modules - will be replaced by the by the single cp_mgmt_task_facts module. + release_summary: This is release 5.0.0 of ``check_point.mgmt``, released on 2023-04-17. + fragments: + - 5.0.0.yml + modules: + - description: Attempt to abort an on-going "get-interfaces" operation. + name: cp_mgmt_abort_get_interfaces + namespace: "" + - description: Manages ACCESS LAYERS resource module + name: cp_mgmt_access_layers + namespace: "" + - description: Manages access-point-name objects on Checkpoint over Web Services API + name: cp_mgmt_access_point_name + namespace: "" + - description: Get access-point-name objects facts on Checkpoint over Web Services API + name: cp_mgmt_access_point_name_facts + namespace: "" + - description: Add the software package to the central repository. + name: cp_mgmt_add_repository_package + namespace: "" + - description: Import an updatable object from the repository to the management server. + name: cp_mgmt_add_updatable_object + namespace: "" + - description: Manages checkpoint-host objects on Checkpoint over Web Services API + name: cp_mgmt_checkpoint_host + namespace: "" + - description: Get checkpoint-host objects facts on Checkpoint over Web Services API + name: cp_mgmt_checkpoint_host_facts + namespace: "" + - description: Delete the repository software package from the central repository. + name: cp_mgmt_delete_repository_package + namespace: "" + - description: Delete existing object using object name or uid. + name: cp_mgmt_delete_updatable_object + namespace: "" + - description: Manages dynamic-global-network-object objects on Checkpoint over Web Services API + name: cp_mgmt_dynamic_global_network_object + namespace: "" + - description: Get dynamic-global-network-object objects facts on Checkpoint over Web Services API + name: cp_mgmt_dynamic_global_network_object_facts + namespace: "" + - description: > + Export the primary Security Management Server database or the primary Multi-Domain Server database or the + single Domain database and the applicable Check Point configuration. + name: cp_mgmt_export_management + namespace: "" + - description: Export SmartTask to a file. + name: cp_mgmt_export_smart_task + namespace: "" + - description: Retrieves a packet capture or blob data, according to the attributes of a log record. + name: cp_mgmt_get_attachment + namespace: "" + - description: Get physical interfaces with or without their topology from a Gaia Security Gateway or Cluster. + name: cp_mgmt_get_interfaces + namespace: "" + - description: Manages gsn-handover-group objects on Checkpoint over Web Services API + name: cp_mgmt_gsn_handover_group + namespace: "" + - description: Get gsn-handover-group objects facts on Checkpoint over Web Services API + name: cp_mgmt_gsn_handover_group_facts + namespace: "" + - description: Perform full sync from active server to standby peer. + name: cp_mgmt_ha_full_sync + namespace: "" + - description: Manages HOSTS resource module + name: cp_mgmt_hosts + namespace: "" + - description: Manages https-layer objects on Checkpoint over Web Services API + name: cp_mgmt_https_layer + namespace: "" + - description: Get https-layer objects facts on Checkpoint over Web Services API + name: cp_mgmt_https_layer_facts + namespace: "" + - description: > + Import the primary Security Management Server database or the primary Multi-Domain Server database or the single Domain + database and the applicable Check Point configuration. + name: cp_mgmt_import_management + namespace: "" + - description: Import SmartTask from a file. + name: cp_mgmt_import_smart_task + namespace: "" + - description: Get ips-protection-extended-attribute objects facts on Checkpoint over Web Services API + name: cp_mgmt_ips_protection_extended_attribute_facts + namespace: "" + - description: Lock object using uid or {name and type}. + name: cp_mgmt_lock_object + namespace: "" + - description: Manages lsv-profile objects on Checkpoint over Web Services API + name: cp_mgmt_lsv_profile + namespace: "" + - description: Get lsv-profile objects facts on Checkpoint over Web Services API + name: cp_mgmt_lsv_profile_facts + namespace: "" + - description: Manages nat-rule objects on Checkpoint over Web Services API. + name: cp_mgmt_nat_rule + namespace: "" + - description: Manages radius-group objects on Checkpoint over Web Services API + name: cp_mgmt_radius_group + namespace: "" + - description: Get radius-group objects facts on Checkpoint over Web Services API + name: cp_mgmt_radius_group_facts + namespace: "" + - description: Manages radius-server objects on Checkpoint over Web Services API + name: cp_mgmt_radius_server + namespace: "" + - description: Get radius-server objects facts on Checkpoint over Web Services API + name: cp_mgmt_radius_server_facts + namespace: "" + - description: Get repository-package objects facts on Checkpoint over Web Services API + name: cp_mgmt_repository_package_facts + namespace: "" + - description: Manages service-citrix-tcp objects on Checkpoint over Web Services API + name: cp_mgmt_service_citrix_tcp + namespace: "" + - description: Get service-citrix-tcp objects facts on Checkpoint over Web Services API + name: cp_mgmt_service_citrix_tcp_facts + namespace: "" + - description: Manages service-compound-tcp objects on Checkpoint over Web Services API + name: cp_mgmt_service_compound_tcp + namespace: "" + - description: Get service-compound-tcp objects facts on Checkpoint over Web Services API + name: cp_mgmt_service_compound_tcp_facts + namespace: "" + - description: Edit API settings, the changes will be applied after publish followed by running 'api restart' command. + name: cp_mgmt_set_api_settings + namespace: "" + - description: Set the connection settings between the Management Server and Check Point's Infinity Portal. + name: cp_mgmt_set_cloud_services + namespace: "" + - description: Edit Global domain object using domain name or UID. + name: cp_mgmt_set_global_domain + namespace: "" + - description: Switch domain server high availability state. + name: cp_mgmt_set_ha_state + namespace: "" + - description: Edit IPS Update Schedule. + name: cp_mgmt_set_ips_update_schedule + namespace: "" + - description: Edit Login message. + name: cp_mgmt_set_login_message + namespace: "" + - description: Edit Policy settings, the changes will be applied after publish. + name: cp_mgmt_set_policy_settings + namespace: "" + - description: Edit existing Remote Access object. Using object name or uid is optional. + name: cp_mgmt_set_vpn_community_remote_access + namespace: "" + - description: Retrieve API Settings. + name: cp_mgmt_show_api_settings + namespace: "" + - description: Shows all supported API versions and current API version (the latest one). + name: cp_mgmt_show_api_versions + namespace: "" + - description: Retrieve AzureAD Objects from Azure AD Server. + name: cp_mgmt_show_azure_ad_content + namespace: "" + - description: Show changes between two sessions. + name: cp_mgmt_show_changes + namespace: "" + - description: Retrieve all of the supported Management API commands with their description. + name: cp_mgmt_show_commands + namespace: "" + - description: Shows list of Gateways & Servers sorted by name. + name: cp_mgmt_show_gateways_and_servers + namespace: "" + - description: Retrieve existing object using object name or uid. + name: cp_mgmt_show_global_domain + namespace: "" + - description: Retrieve domain high availability state. + name: cp_mgmt_show_ha_state + namespace: "" + - description: show ips status on Checkpoint over Web Services API + name: cp_mgmt_show_ips_status + namespace: "" + - description: Retrieve IPS Update Schedule. + name: cp_mgmt_show_ips_update_schedule + namespace: "" + - description: Shows the entire layer structure. + name: cp_mgmt_show_layer_structure + namespace: "" + - description: Retrieve Login message. + name: cp_mgmt_show_login_message + namespace: "" + - description: Retrieve existing object using object uid. + name: cp_mgmt_show_place_holder + namespace: "" + - description: Show Policy settings. + name: cp_mgmt_show_policy_settings + namespace: "" + - description: Shows software packages on targets. + name: cp_mgmt_show_software_packages_per_targets + namespace: "" + - description: Retrieve all unused objects. + name: cp_mgmt_show_unused_objects + namespace: "" + - description: Shows the content of the available updatable objects from the Check Point User Center. + name: cp_mgmt_show_updatable_objects_repository_content + namespace: "" + - description: Show all validation incidents limited to 500. + name: cp_mgmt_show_validations + namespace: "" + - description: Manages smart-task objects on Checkpoint over Web Services API + name: cp_mgmt_smart_task + namespace: "" + - description: Get smart-task objects facts on Checkpoint over Web Services API + name: cp_mgmt_smart_task_facts + namespace: "" + - description: Get smart-task-trigger objects facts on Checkpoint over Web Services API + name: cp_mgmt_smart_task_trigger_facts + namespace: "" + - description: Manages tacacs-group objects on Checkpoint over Web Services API + name: cp_mgmt_tacacs_group + namespace: "" + - description: Get tacacs-group objects facts on Checkpoint over Web Services API + name: cp_mgmt_tacacs_group_facts + namespace: "" + - description: Manages tacacs-server objects on Checkpoint over Web Services API + name: cp_mgmt_tacacs_server + namespace: "" + - description: Get tacacs-server objects facts on Checkpoint over Web Services API + name: cp_mgmt_tacacs_server_facts + namespace: "" + - description: Get task objects facts on Checkpoint over Web Services API + name: cp_mgmt_task_facts + namespace: "" + - description: Manages THREAT LAYERS resource module + name: cp_mgmt_threat_layers + namespace: "" + - description: Manages time-group objects on Checkpoint over Web Services API + name: cp_mgmt_time_group + namespace: "" + - description: Get time-group objects facts on Checkpoint over Web Services API + name: cp_mgmt_time_group_facts + namespace: "" + - description: Unlock administrator. + name: cp_mgmt_unlock_administrator + namespace: "" + - description: Unlock object using uid or {name and type}. + name: cp_mgmt_unlock_object + namespace: "" + - description: Get updatable-object objects facts on Checkpoint over Web Services API + name: cp_mgmt_updatable_object_facts + namespace: "" + - description: Updates the content of the Updatable Objects repository from the Check Point User Center. + name: cp_mgmt_update_updatable_objects_repository_content + namespace: "" + - description: Manages user-group objects on Checkpoint over Web Services API + name: cp_mgmt_user_group + namespace: "" + - description: Get user-group objects facts on Checkpoint over Web Services API + name: cp_mgmt_user_group_facts + namespace: "" + - description: Get vpn-community-remote-access objects facts on Checkpoint over Web Services API + name: cp_mgmt_vpn_community_remote_access_facts + namespace: "" + - description: Run the VSX operation by its name and parameters. + name: cp_mgmt_vsx_run_operation + namespace: "" + - description: Searches for usage of the target object in other objects and rules. + name: cp_mgmt_where_used + namespace: "" + release_date: "2022-07-10" + 5.1.0: + changes: + bugfixes: + - cp_mgmt_access_rules - split vpn param that can accept either a String or list of objects to two + minor_changes: + - cp_mgmt_vpn_community_star - new fields added. + - show command modules - no longer return result of changed=True. + release_summary: This is release 5.1.0 of ``check_point.mgmt``, released on 2023-05-18. + fragments: + - 5.1.0.yml + release_date: "2022-07-16" + 5.1.1: + changes: + bugfixes: + - module_utils/checkpoint.py - fixed compile issue (Syntax Error) on python 2.7 + release_summary: This is release 5.1.1 of ``check_point.mgmt``, released on 2023-05-25. + fragments: + - 5.1.1.yml + release_date: "2022-07-17" + 5.1.2: + changes: + minor_changes: + - meta/runtime.yml - update minimum Ansible version required to 2.14.0. + release_summary: This is release 5.1.2 of ``check_point.mgmt``, released on 2023-12-12. + fragments: + - 5.1.2.yml + release_date: "2022-12-12" + 5.1.3: + changes: + bugfixes: + - httpapi/checkpoint.py - Raise a fatal error if login wasn't successful. + release_summary: This is release 5.1.3 of ``check_point.mgmt``, released on 2023-12-13. + fragments: + - 5.1.3.yml + release_date: "2022-12-13" + 5.2.0: + changes: + minor_changes: + - New resource modules for R81.20 JHF Take 43 + release_summary: This is release 5.2.0 of ``check_point.mgmt``, released on 2024-01-10. + fragments: + - 5.2.0.yml + modules: + - description: Add central license. + name: cp_mgmt_add_central_license + namespace: "" + - description: Get central-license objects facts on Checkpoint over Web Services API. + name: cp_mgmt_central_license_facts + namespace: "" + - description: Delete central license. + name: cp_mgmt_delete_central_license + namespace: "" + - description: Distribute licenses to target CloudGuard gateways. + name: cp_mgmt_distribute_cloud_licenses + namespace: "" + - description: Show attached licenses usage. + name: cp_mgmt_show_cloud_licenses_usage + namespace: "" + - description: Retrieve domain high availability status. + name: cp_mgmt_show_ha_status + namespace: "" + release_date: "2024-01-10" + 5.2.1: + changes: + release_summary: This is release 5.2.1 of ``check_point.mgmt``, released on 2024-01-16 + fragments: + - 5.2.1.yml + release_date: "2024-01-16" + 5.2.2: + changes: + release_summary: This is release 5.2.2 of ``check_point.mgmt``, released on + 2024-01-28. + fragments: + - 5.2.2.yml + release_date: '2024-01-28' + 5.2.3: + changes: + release_summary: This is release 5.2.3 of ``check_point.mgmt``, released on + 2024-03-04. + fragments: + - 5.2.2.yml + release_date: '2024-01-28' diff --git a/ansible_collections/check_point/mgmt/changelogs/config.yaml b/ansible_collections/check_point/mgmt/changelogs/config.yaml index 359f5e692..860cccdb4 100644 --- a/ansible_collections/check_point/mgmt/changelogs/config.yaml +++ b/ansible_collections/check_point/mgmt/changelogs/config.yaml @@ -1,3 +1,4 @@ +--- changelog_filename_template: ../CHANGELOG.rst changelog_filename_version_depth: 0 changes_file: changelog.yaml @@ -11,22 +12,22 @@ prelude_section_name: release_summary prelude_section_title: Release Summary sanitize_changelog: true sections: -- - major_changes - - Major Changes -- - minor_changes - - Minor Changes -- - breaking_changes - - Breaking Changes / Porting Guide -- - deprecated_features - - Deprecated Features -- - removed_features - - Removed Features (previously deprecated) -- - security_fixes - - Security Fixes -- - bugfixes - - Bugfixes -- - known_issues - - Known Issues + - - major_changes + - Major Changes + - - minor_changes + - Minor Changes + - - breaking_changes + - Breaking Changes / Porting Guide + - - deprecated_features + - Deprecated Features + - - removed_features + - Removed Features (previously deprecated) + - - security_fixes + - Security Fixes + - - bugfixes + - Bugfixes + - - known_issues + - Known Issues title: Check_Point.Mgmt trivial_section_name: trivial use_fqcn: true diff --git a/ansible_collections/check_point/mgmt/meta/execution-environment.yml b/ansible_collections/check_point/mgmt/meta/execution-environment.yml index ea607057e..49e91fa92 100644 --- a/ansible_collections/check_point/mgmt/meta/execution-environment.yml +++ b/ansible_collections/check_point/mgmt/meta/execution-environment.yml @@ -2,4 +2,4 @@ version: 1 dependencies: - galaxy: requirements.yml
\ No newline at end of file + galaxy: requirements.yml diff --git a/ansible_collections/check_point/mgmt/meta/runtime.yml b/ansible_collections/check_point/mgmt/meta/runtime.yml index 30a544b77..93a159c0c 100644 --- a/ansible_collections/check_point/mgmt/meta/runtime.yml +++ b/ansible_collections/check_point/mgmt/meta/runtime.yml @@ -1 +1,52 @@ -requires_ansible: '>=2.9.10'
\ No newline at end of file +--- +requires_ansible: ">=2.14.0" +plugin_routing: + modules: + cp_mgmt_add_nat_rule: + deprecation: + removal_date: "2024-11-01" + warning_text: > + cp_mgmt_add_nat_rule will be removed in a future release of this collection. + Use newer and updated module cp_mgmt_nat_rule with more functionality instead. + cp_mgmt_set_nat_rule: + deprecation: + removal_date: "2024-11-01" + warning_text: > + cp_mgmt_set_nat_rule will be removed in a future release of this collection. + Use newer and updated module cp_mgmt_nat_rule with more functionality instead. + cp_mgmt_delete_nat_rule: + deprecation: + removal_date: "2024-11-01" + warning_text: > + cp_mgmt_delete_nat_rule will be removed in a future release of this collection. + Use newer and updated module cp_mgmt_nat_rule with more functionality instead. + cp_mgmt_access_layer: + deprecation: + removal_date: "2024-11-01" + warning_text: > + cp_mgmt_access_layer will be removed in a future release of this collection. + Use newer and updated module cp_mgmt_access_layers with more functionality instead. + cp_mgmt_show_task: + deprecation: + removal_date: "2024-11-01" + warning_text: > + cp_mgmt_show_task will be removed in a future release of this collection. + Use newer and updated module cp_mgmt_task_facts instead. + cp_mgmt_show_tasks: + deprecation: + removal_date: "2024-11-01" + warning_text: > + cp_mgmt_show_tasks will be removed in a future release of this collection. + Use newer and updated module cp_mgmt_task_facts instead. + cp_mgmt_host: + deprecation: + removal_date: "2024-11-01" + warning_text: > + cp_mgmt_host will be removed in a future release of this collection. + Use newer and updated module cp_mgmt_hosts with more functionality instead. + cp_mgmt_threat_layer: + deprecation: + removal_date: "2024-11-01" + warning_text: > + cp_mgmt_threat_layer will be removed in a future release of this collection. + Use newer and updated module cp_mgmt_threat_layers with more functionality instead. diff --git a/ansible_collections/check_point/mgmt/plugins/action/cp_mgmt_access_layers.py b/ansible_collections/check_point/mgmt/plugins/action/cp_mgmt_access_layers.py new file mode 100644 index 000000000..f48a8b353 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/action/cp_mgmt_access_layers.py @@ -0,0 +1,268 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +""" +The module file for cp_mgmt_add_access_layers +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from ansible.plugins.action import ActionBase +from ansible.module_utils.connection import Connection + +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( + utils, +) +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + CheckPointRequest, + map_params_to_obj, + map_obj_to_params, + sync_show_params_with_add_params, + remove_unwanted_key, + contains_show_identifier_param, +) +from ansible_collections.ansible.utils.plugins.module_utils.common.argspec_validate import ( + AnsibleArgSpecValidator, +) +from ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_access_layers import ( + DOCUMENTATION, +) + + +class ActionModule(ActionBase): + """action module""" + + def __init__(self, *args, **kwargs): + super(ActionModule, self).__init__(*args, **kwargs) + self._result = None + self.api_call_object = "access-layer" + self.api_call_object_plural_version = "access-layers" + self.module_return = "mgmt_access_layers" + self.key_transform = { + "add_default_rule": "add-default-rule", + "applications_and_url_filtering": "applications-and-url-filtering", + "content_awareness": "content-awareness", + "detect_using_x_forward_for": "detect-using-x-forward-for", + "implicit_cleanup_action": "implicit-cleanup-action", + "mobile_access": "mobile-access", + "details_level": "details-level", + "ignore_warnings": "ignore-warnings", + "ignore_errors": "ignore-errors", + } + + def _check_argspec(self): + aav = AnsibleArgSpecValidator( + data=self._task.args, + schema=DOCUMENTATION, + schema_format="doc", + name=self._task.action, + ) + valid, errors, self._task.args = aav.validate() + if not valid: + self._result["failed"] = True + self._result["msg"] = errors + + def search_for_existing_rules( + self, conn_request, api_call_object, search_payload=None, state=None + ): + result = conn_request.post(api_call_object, state, data=search_payload) + return result + + def search_for_resource_name(self, conn_request, payload): + search_result = [] + round_trip = False + search_payload = utils.remove_empties(payload) + if search_payload.get("round_trip"): + round_trip = True + if search_payload.get("round_trip") is not None: + del search_payload["round_trip"] + + search_payload = map_params_to_obj(search_payload, self.key_transform) + if not contains_show_identifier_param(search_payload): + search_result = self.search_for_existing_rules( + conn_request, + self.api_call_object_plural_version, + search_payload, + "gathered", + ) + if search_result.get("code") == 200: + search_result = search_result["response"][ + self.api_call_object_plural_version + ] + return search_result + else: + search_result = self.search_for_existing_rules( + conn_request, self.api_call_object, search_payload, "gathered" + ) + if round_trip: + search_result = sync_show_params_with_add_params( + search_result["response"], self.key_transform + ) + elif search_result.get("code") and search_result["code"] == 200: + search_result = search_result["response"] + search_result = map_obj_to_params( + search_result, + self.key_transform, + self.module_return, + ) + if search_result.get("code") and search_result["code"] != 200: + if ( + search_result.get("response") + and "object_not_found" in search_result["response"]["code"] + and "not found" in search_result["response"]["message"] + ): + search_result = {} + elif "object_not_found" in search_result.get( + "code" + ) and "not found" in search_result.get("message"): + search_result = {} + return search_result + + def delete_module_api_config(self, conn_request, module_config_params): + config = {} + before = {} + after = {} + result = {} + changed = False + round_trip = False + ckp_session_uid = None + payload = utils.remove_empties(module_config_params) + if payload.get("round_trip"): + round_trip = True + del payload["round_trip"] + remove_from_response = ["uid", "read-only", "domain"] + if round_trip: + search_payload = {"name": payload["name"], "round_trip": True} + else: + search_payload = {"name": payload["name"]} + search_result = self.search_for_resource_name( + conn_request, search_payload + ) + if search_result: + if round_trip: + search_result = remove_unwanted_key( + search_result, remove_from_response + ) + before = search_result + result = conn_request.post( + self.api_call_object, self._task.args["state"], data=payload + ) + if before: + config.update({"before": before, "after": after}) + else: + config.update({"before": before}) + if result.get("changed"): + changed = True + ckp_session_uid = result["checkpoint_session_uid"] + return config, changed, ckp_session_uid + + def configure_module_api(self, conn_request, module_config_params): + config = {} + before = {} + after = {} + result = {} + changed = False + round_trip = False + ckp_session_uid = None + # Add to the THIS list for the value which needs to be excluded + # from HAVE params when compared to WANT param like 'ID' can be + # part of HAVE param but may not be part of your WANT param + remove_from_response = ["uid", "read-only", "domain"] + remove_from_set = ["add-default-rule"] + payload = utils.remove_empties(module_config_params) + if payload.get("round_trip"): + round_trip = True + del payload["round_trip"] + if payload.get("name"): + if round_trip: + search_payload = {"name": payload["name"], "round_trip": True} + else: + search_payload = {"name": payload["name"]} + search_result = self.search_for_resource_name( + conn_request, search_payload + ) + if search_result: + if round_trip: + search_result = remove_unwanted_key( + search_result, remove_from_response + ) + before = search_result + payload = map_params_to_obj(payload, self.key_transform) + delete_params = { + "name": payload["name"], + } + result = conn_request.post( + self.api_call_object, + self._task.args["state"], + data=payload, + remove_keys=remove_from_set, + delete_params=delete_params, + ) + if result.get("changed"): + if round_trip: + search_result = sync_show_params_with_add_params( + result["response"], self.key_transform + ) + else: + search_result = map_obj_to_params( + result["response"], + self.key_transform, + self.module_return, + ) + if round_trip: + search_result = remove_unwanted_key( + search_result, remove_from_response + ) + after = search_result + ckp_session_uid = result["checkpoint_session_uid"] + changed = True + config.update({"before": before, "after": after}) + + return config, changed, ckp_session_uid + + def run(self, tmp=None, task_vars=None): + self._supports_check_mode = True + self._result = super(ActionModule, self).run(tmp, task_vars) + self._check_argspec() + self._result["checkpoint_session_uid"] = None + if self._result.get("failed"): + return self._result + conn = Connection(self._connection.socket_path) + conn_request = CheckPointRequest(connection=conn, task_vars=task_vars) + if self._task.args["state"] == "gathered": + if self._task.args.get("config"): + self._result["gathered"] = self.search_for_resource_name( + conn_request, self._task.args["config"] + ) + else: + self._result["gathered"] = self.search_for_resource_name( + conn_request, dict() + ) + elif ( + self._task.args["state"] == "merged" + or self._task.args["state"] == "replaced" + ): + if self._task.args.get("config"): + ( + self._result[self.module_return], + self._result["changed"], + self._result["checkpoint_session_uid"], + ) = self.configure_module_api( + conn_request, self._task.args["config"] + ) + elif self._task.args["state"] == "deleted": + if self._task.args.get("config"): + ( + self._result[self.module_return], + self._result["changed"], + self._result["checkpoint_session_uid"], + ) = self.delete_module_api_config( + conn_request, self._task.args["config"] + ) + if self._result.get("checkpoint_session_uid") is None: + del self._result["checkpoint_session_uid"] + + return self._result diff --git a/ansible_collections/check_point/mgmt/plugins/action/cp_mgmt_access_rules.py b/ansible_collections/check_point/mgmt/plugins/action/cp_mgmt_access_rules.py index 3a06797d9..bee4770f5 100644 --- a/ansible_collections/check_point/mgmt/plugins/action/cp_mgmt_access_rules.py +++ b/ansible_collections/check_point/mgmt/plugins/action/cp_mgmt_access_rules.py @@ -1,60 +1,91 @@ -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type from ansible.errors import AnsibleActionFail from ansible.plugins.action import ActionBase -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import \ - prepare_rule_params_for_execute_module, check_if_to_publish_for_action +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + prepare_rule_params_for_execute_module, + check_if_to_publish_for_action, +) class ActionModule(ActionBase): - def run(self, tmp=None, task_vars=None): module = super(ActionModule, self).run(tmp, task_vars) - result = self._execute_module(module_name='check_point.mgmt.cp_mgmt_access_rules', module_args=self._task.args, - task_vars=task_vars, tmp=tmp) + result = self._execute_module( + module_name="check_point.mgmt.cp_mgmt_access_rules", + module_args=self._task.args, + task_vars=task_vars, + tmp=tmp, + ) - if 'msg' in result.keys(): - raise AnsibleActionFail(result['msg']) + if "msg" in result.keys(): + raise AnsibleActionFail(result["msg"]) module_args = self._task.args - fields = {'position', 'layer', 'auto_publish_session'} - rules_list = module_args['rules'] + fields = {"position", "layer", "auto_publish_session"} + rules_list = module_args["rules"] for rule in rules_list: for field in fields: if field in rule.keys(): - raise AnsibleActionFail('Unsupported parameter ' + field + ' for rule') + raise AnsibleActionFail( + "Unsupported parameter " + field + " for rule" + ) # check_fields_for_rule_action_module(module_args) - rules_list = self._task.args['rules'] + rules_list = self._task.args["rules"] position = 1 below_rule_name = None for rule in rules_list: - rule, position, below_rule_name = prepare_rule_params_for_execute_module(rule=rule, module_args=module_args, - position=position, - below_rule_name=below_rule_name) - - result['rule: ' + rule['name']] = self._execute_module(module_name='check_point.mgmt.cp_mgmt_access_rule', - module_args=rule, - task_vars=task_vars, tmp=tmp, wrap_async=False) - if 'changed' in result['rule: ' + rule['name']].keys() and \ - result['rule: ' + rule['name']]['changed'] is True: - result['changed'] = True - if 'failed' in result['rule: ' + rule['name']].keys() and result['rule: ' + rule['name']]['failed'] is True: - temp = result['rule: ' + rule['name']].copy() + ( + rule, + position, + below_rule_name, + ) = prepare_rule_params_for_execute_module( + rule=rule, + module_args=module_args, + position=position, + below_rule_name=below_rule_name, + ) + + result["rule: " + rule["name"]] = self._execute_module( + module_name="check_point.mgmt.cp_mgmt_access_rule", + module_args=rule, + task_vars=task_vars, + tmp=tmp, + wrap_async=False, + ) + if ( + "changed" in result["rule: " + rule["name"]].keys() + and result["rule: " + rule["name"]]["changed"] is True + ): + result["changed"] = True + if ( + "failed" in result["rule: " + rule["name"]].keys() + and result["rule: " + rule["name"]]["failed"] is True + ): + temp = result["rule: " + rule["name"]].copy() result = {} - result['rule: ' + rule['name']] = temp - result['failed'] = True - result['discard:'] = self._execute_module(module_name='check_point.mgmt.cp_mgmt_discard', - module_args={}, task_vars=task_vars, tmp=tmp) + result["rule: " + rule["name"]] = temp + result["failed"] = True + result["discard:"] = self._execute_module( + module_name="check_point.mgmt.cp_mgmt_discard", + module_args={}, + task_vars=task_vars, + tmp=tmp, + ) break if check_if_to_publish_for_action(result, module_args): - result['publish:'] = self._execute_module(module_name='check_point.mgmt.cp_mgmt_publish', module_args={}, - task_vars=task_vars, tmp=tmp) + result["publish:"] = self._execute_module( + module_name="check_point.mgmt.cp_mgmt_publish", + module_args={}, + task_vars=task_vars, + tmp=tmp, + ) return result diff --git a/ansible_collections/check_point/mgmt/plugins/action/cp_mgmt_hosts.py b/ansible_collections/check_point/mgmt/plugins/action/cp_mgmt_hosts.py new file mode 100644 index 000000000..9dc289d31 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/action/cp_mgmt_hosts.py @@ -0,0 +1,281 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +""" +The module file for cp_mgmt_hosts +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from ansible.plugins.action import ActionBase +from ansible.module_utils.connection import Connection + +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( + utils, +) +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + CheckPointRequest, + map_params_to_obj, + map_obj_to_params, + sync_show_params_with_add_params, + remove_unwanted_key, + contains_show_identifier_param, +) +from ansible_collections.ansible.utils.plugins.module_utils.common.argspec_validate import ( + AnsibleArgSpecValidator, +) +from ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_hosts import ( + DOCUMENTATION, +) + + +class ActionModule(ActionBase): + """action module""" + + def __init__(self, *args, **kwargs): + super(ActionModule, self).__init__(*args, **kwargs) + self._result = None + self.api_call_object = "host" + self.api_call_object_plural_version = "hosts" + self.module_return = "mgmt_hosts" + self.key_transform = { + "ip_address": "ip-address", + "ipv4_address": "ipv4-address", + "ipv6_address": "ipv6-address", + "interfaces": "interfaces", + "nat_settings": "nat-settings", + "hide_behind": "hide-behind", + "install_on": "install-on", + "host_servers": "host-servers", + "dns_server": "dns-server", + "mail_server": "mail-server", + "web_server": "web-server", + "web_server_config": "web-server-config", + "additional_ports": "additional-ports", + "application_engines": "application-engines", + "listen_standard_port": "listen-standard-port", + "operating_system": "operating-system", + "protected_by": "protected-by", + "details_level": "details-level", + "ignore_warnings": "ignore-warnings", + "ignore_errors": "ignore-errors", + "mask_length": "mask-length", + "mask_length4": "mask-length4", + "mask_length6": "mask-length4", + "subnet_mask": "subnet-mask", + } + + def _check_argspec(self): + aav = AnsibleArgSpecValidator( + data=self._task.args, + schema=DOCUMENTATION, + schema_format="doc", + name=self._task.action, + ) + valid, errors, self._task.args = aav.validate() + if not valid: + self._result["failed"] = True + self._result["msg"] = errors + + def search_for_existing_rules( + self, conn_request, api_call_object, search_payload=None, state=None + ): + result = conn_request.post(api_call_object, state, data=search_payload) + return result + + def search_for_resource_name(self, conn_request, payload): + search_result = [] + round_trip = False + + search_payload = utils.remove_empties(payload) + if search_payload.get("round_trip"): + round_trip = True + if search_payload.get("round_trip") is not None: + del search_payload["round_trip"] + search_payload = map_params_to_obj(search_payload, self.key_transform) + if not contains_show_identifier_param(search_payload): + search_result = self.search_for_existing_rules( + conn_request, + self.api_call_object_plural_version, + search_payload, + "gathered", + ) + if search_result.get("code") == 200: + search_result = search_result["response"]["objects"] + return search_result + else: + search_result = self.search_for_existing_rules( + conn_request, self.api_call_object, search_payload, "gathered" + ) + if round_trip: + search_result = sync_show_params_with_add_params( + search_result["response"], self.key_transform + ) + elif search_result.get("code") and search_result["code"] == 200: + search_result = search_result["response"] + search_result = map_obj_to_params( + search_result, + self.key_transform, + self.module_return, + ) + if search_result.get("code") and search_result["code"] != 200: + if ( + search_result.get("response") + and "object_not_found" in search_result["response"]["code"] + and "not found" in search_result["response"]["message"] + ): + search_result = {} + elif "object_not_found" in search_result.get( + "code" + ) and "not found" in search_result.get("message"): + search_result = {} + return search_result + + def delete_module_api_config(self, conn_request, module_config_params): + config = {} + before = {} + after = {} + result = {} + changed = False + round_trip = False + ckp_session_uid = None + payload = utils.remove_empties(module_config_params) + if payload.get("round_trip"): + round_trip = True + del payload["round_trip"] + remove_from_response = ["uid", "read-only", "domain"] + if round_trip: + search_payload = {"name": payload["name"], "round_trip": True} + else: + search_payload = {"name": payload["name"]} + search_result = self.search_for_resource_name( + conn_request, search_payload + ) + if search_result: + if round_trip: + search_result = remove_unwanted_key( + search_result, remove_from_response + ) + before = search_result + result = conn_request.post( + self.api_call_object, self._task.args["state"], data=payload + ) + if before: + config.update({"before": before, "after": after}) + else: + config.update({"before": before}) + if result.get("changed"): + changed = True + ckp_session_uid = result["checkpoint_session_uid"] + return config, changed, ckp_session_uid + + def configure_module_api(self, conn_request, module_config_params): + config = {} + before = {} + after = {} + result = {} + changed = False + round_trip = False + ckp_session_uid = None + # Add to the THIS list for the value which needs to be excluded + # from HAVE params when compared to WANT param like 'ID' can be + # part of HAVE param but may not be part of your WANT param + remove_from_response = ["uid", "read-only", "domain"] + remove_from_set = [] + payload = utils.remove_empties(module_config_params) + if payload.get("round_trip"): + round_trip = True + del payload["round_trip"] + if payload.get("name"): + if round_trip: + search_payload = {"name": payload["name"], "round_trip": True} + else: + search_payload = {"name": payload["name"]} + search_result = self.search_for_resource_name( + conn_request, search_payload + ) + if search_result: + if round_trip: + search_result = remove_unwanted_key( + search_result, remove_from_response + ) + before = search_result + payload = map_params_to_obj(payload, self.key_transform) + delete_params = { + "name": payload["name"], + } + result = conn_request.post( + self.api_call_object, + self._task.args["state"], + data=payload, + remove_keys=remove_from_set, + delete_params=delete_params, + ) + if result.get("changed"): + if round_trip: + search_result = sync_show_params_with_add_params( + result["response"], self.key_transform + ) + else: + search_result = map_obj_to_params( + result["response"], + self.key_transform, + self.module_return, + ) + if round_trip: + search_result = remove_unwanted_key( + search_result, remove_from_response + ) + after = search_result + ckp_session_uid = result["checkpoint_session_uid"] + changed = True + config.update({"before": before, "after": after}) + + return config, changed, ckp_session_uid + + def run(self, tmp=None, task_vars=None): + self._supports_check_mode = True + self._result = super(ActionModule, self).run(tmp, task_vars) + self._check_argspec() + self._result["checkpoint_session_uid"] = None + if self._result.get("failed"): + return self._result + conn = Connection(self._connection.socket_path) + conn_request = CheckPointRequest(connection=conn, task_vars=task_vars) + if self._task.args["state"] == "gathered": + if self._task.args.get("config"): + self._result["gathered"] = self.search_for_resource_name( + conn_request, self._task.args["config"] + ) + else: + self._result["gathered"] = self.search_for_resource_name( + conn_request, dict() + ) + elif ( + self._task.args["state"] == "merged" + or self._task.args["state"] == "replaced" + ): + if self._task.args.get("config"): + ( + self._result[self.module_return], + self._result["changed"], + self._result["checkpoint_session_uid"], + ) = self.configure_module_api( + conn_request, self._task.args["config"] + ) + elif self._task.args["state"] == "deleted": + if self._task.args.get("config"): + ( + self._result[self.module_return], + self._result["changed"], + self._result["checkpoint_session_uid"], + ) = self.delete_module_api_config( + conn_request, self._task.args["config"] + ) + if self._result.get("checkpoint_session_uid") is None: + del self._result["checkpoint_session_uid"] + + return self._result diff --git a/ansible_collections/check_point/mgmt/plugins/action/cp_mgmt_threat_layers.py b/ansible_collections/check_point/mgmt/plugins/action/cp_mgmt_threat_layers.py new file mode 100644 index 000000000..4e91ecfac --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/action/cp_mgmt_threat_layers.py @@ -0,0 +1,264 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +""" +The module file for cp_mgmt_threat_layers +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from ansible.plugins.action import ActionBase +from ansible.module_utils.connection import Connection + +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( + utils, +) +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + CheckPointRequest, + map_params_to_obj, + map_obj_to_params, + sync_show_params_with_add_params, + remove_unwanted_key, + contains_show_identifier_param, +) +from ansible_collections.ansible.utils.plugins.module_utils.common.argspec_validate import ( + AnsibleArgSpecValidator, +) +from ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_threat_layers import ( + DOCUMENTATION, +) + + +class ActionModule(ActionBase): + """action module""" + + def __init__(self, *args, **kwargs): + super(ActionModule, self).__init__(*args, **kwargs) + self._result = None + self.api_call_object = "threat-layer" + self.api_call_object_plural_version = "threat-layers" + self.module_return = "mgmt_threat_layers" + self.key_transform = { + "add_default_rule": "add-default-rule", + "details_level": "details-level", + "ignore_warnings": "ignore-warnings", + "ignore_errors": "ignore-errors", + } + + def _check_argspec(self): + aav = AnsibleArgSpecValidator( + data=self._task.args, + schema=DOCUMENTATION, + schema_format="doc", + name=self._task.action, + ) + valid, errors, self._task.args = aav.validate() + if not valid: + self._result["failed"] = True + self._result["msg"] = errors + + def search_for_existing_rules( + self, conn_request, api_call_object, search_payload=None, state=None + ): + result = conn_request.post(api_call_object, state, data=search_payload) + return result + + def search_for_resource_name(self, conn_request, payload): + search_result = [] + round_trip = False + + search_payload = utils.remove_empties(payload) + if search_payload.get("round_trip"): + round_trip = True + if search_payload.get("round_trip") is not None: + del search_payload["round_trip"] + search_payload = map_params_to_obj(search_payload, self.key_transform) + if not contains_show_identifier_param(search_payload): + search_result = self.search_for_existing_rules( + conn_request, + self.api_call_object_plural_version, + search_payload, + "gathered", + ) + if search_result.get("code") == 200: + search_result = search_result["response"][ + self.api_call_object_plural_version + ] + return search_result + else: + search_result = self.search_for_existing_rules( + conn_request, self.api_call_object, search_payload, "gathered" + ) + if round_trip: + search_result = sync_show_params_with_add_params( + search_result["response"], self.key_transform + ) + elif search_result.get("code") and search_result["code"] == 200: + search_result = search_result["response"] + search_result = map_obj_to_params( + search_result, + self.key_transform, + self.module_return, + ) + if search_result.get("code") and search_result["code"] != 200: + if ( + search_result.get("response") + and "object_not_found" in search_result["response"]["code"] + and "not found" in search_result["response"]["message"] + ): + search_result = {} + elif "object_not_found" in search_result.get( + "code" + ) and "not found" in search_result.get("message"): + search_result = {} + return search_result + + def delete_module_api_config(self, conn_request, module_config_params): + config = {} + before = {} + after = {} + result = {} + changed = False + round_trip = False + ckp_session_uid = None + payload = utils.remove_empties(module_config_params) + if payload.get("round_trip"): + round_trip = True + del payload["round_trip"] + remove_from_response = ["uid", "read-only", "domain"] + if round_trip: + search_payload = {"name": payload["name"], "round_trip": True} + else: + search_payload = {"name": payload["name"]} + search_result = self.search_for_resource_name( + conn_request, search_payload + ) + if search_result: + if round_trip: + search_result = remove_unwanted_key( + search_result, remove_from_response + ) + before = search_result + result = conn_request.post( + self.api_call_object, self._task.args["state"], data=payload + ) + if before: + config.update({"before": before, "after": after}) + else: + config.update({"before": before}) + if result.get("changed"): + changed = True + ckp_session_uid = result["checkpoint_session_uid"] + + return config, changed, ckp_session_uid + + def configure_module_api(self, conn_request, module_config_params): + config = {} + before = {} + after = {} + result = {} + changed = False + round_trip = False + ckp_session_uid = None + # Add to the THIS list for the value which needs to be excluded + # from HAVE params when compared to WANT param like 'ID' can be + # part of HAVE param but may not be part of your WANT param + remove_from_response = ["uid", "read-only", "domain"] + remove_from_set = ["add-default-rule"] + payload = utils.remove_empties(module_config_params) + if payload.get("round_trip"): + round_trip = True + del payload["round_trip"] + if payload.get("name"): + if round_trip: + search_payload = {"name": payload["name"], "round_trip": True} + else: + search_payload = {"name": payload["name"]} + search_result = self.search_for_resource_name( + conn_request, search_payload + ) + if search_result: + if round_trip: + search_result = remove_unwanted_key( + search_result, remove_from_response + ) + before = search_result + payload = map_params_to_obj(payload, self.key_transform) + delete_params = { + "name": payload["name"], + } + result = conn_request.post( + self.api_call_object, + self._task.args["state"], + data=payload, + remove_keys=remove_from_set, + delete_params=delete_params, + ) + if result.get("changed"): + if round_trip: + search_result = sync_show_params_with_add_params( + result["response"], self.key_transform + ) + else: + search_result = map_obj_to_params( + result["response"], + self.key_transform, + self.module_return, + ) + if round_trip: + search_result = remove_unwanted_key( + search_result, remove_from_response + ) + after = search_result + ckp_session_uid = result["checkpoint_session_uid"] + changed = True + config.update({"before": before, "after": after}) + + return config, changed, ckp_session_uid + + def run(self, tmp=None, task_vars=None): + self._supports_check_mode = True + self._result = super(ActionModule, self).run(tmp, task_vars) + self._check_argspec() + self._result["checkpoint_session_uid"] = None + if self._result.get("failed"): + return self._result + conn = Connection(self._connection.socket_path) + conn_request = CheckPointRequest(connection=conn, task_vars=task_vars) + if self._task.args["state"] == "gathered": + if self._task.args.get("config"): + self._result["gathered"] = self.search_for_resource_name( + conn_request, self._task.args["config"] + ) + else: + self._result["gathered"] = self.search_for_resource_name( + conn_request, dict() + ) + elif ( + self._task.args["state"] == "merged" + or self._task.args["state"] == "replaced" + ): + if self._task.args.get("config"): + ( + self._result[self.module_return], + self._result["changed"], + self._result["checkpoint_session_uid"], + ) = self.configure_module_api( + conn_request, self._task.args["config"] + ) + elif self._task.args["state"] == "deleted": + if self._task.args.get("config"): + ( + self._result[self.module_return], + self._result["changed"], + self._result["checkpoint_session_uid"], + ) = self.delete_module_api_config( + conn_request, self._task.args["config"] + ) + if self._result.get("checkpoint_session_uid") is None: + del self._result["checkpoint_session_uid"] + + return self._result diff --git a/ansible_collections/check_point/mgmt/plugins/doc_fragments/checkpoint_commands.py b/ansible_collections/check_point/mgmt/plugins/doc_fragments/checkpoint_commands.py index 19e13ffac..a11749626 100644 --- a/ansible_collections/check_point/mgmt/plugins/doc_fragments/checkpoint_commands.py +++ b/ansible_collections/check_point/mgmt/plugins/doc_fragments/checkpoint_commands.py @@ -3,14 +3,15 @@ # Copyright: (c) 2019, Or Soffer <orso@checkpoint.com> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function + __metaclass__ = type class ModuleDocFragment(object): # Standard files documentation fragment - DOCUMENTATION = r''' + DOCUMENTATION = r""" options: wait_for_task: description: @@ -26,4 +27,9 @@ options: description: - Version of checkpoint. If not given one, the latest version taken. type: str -''' + auto_publish_session: + description: + - Publish the current session if changes have been performed after task completes. + type: bool + default: False +""" diff --git a/ansible_collections/check_point/mgmt/plugins/doc_fragments/checkpoint_facts.py b/ansible_collections/check_point/mgmt/plugins/doc_fragments/checkpoint_facts.py index 08a6b8954..7b520a7ae 100644 --- a/ansible_collections/check_point/mgmt/plugins/doc_fragments/checkpoint_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/doc_fragments/checkpoint_facts.py @@ -3,19 +3,18 @@ # Copyright: (c) 2019, Or Soffer <orso@checkpoint.com> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function -from __future__ import (absolute_import, division, print_function) __metaclass__ = type class ModuleDocFragment(object): # Standard files documentation fragment - DOCUMENTATION = r''' + DOCUMENTATION = r""" options: version: description: - Version of checkpoint. If not given one, the latest version taken. type: str -''' +""" diff --git a/ansible_collections/check_point/mgmt/plugins/doc_fragments/checkpoint_objects.py b/ansible_collections/check_point/mgmt/plugins/doc_fragments/checkpoint_objects.py index 6df1f2f82..351656b4c 100644 --- a/ansible_collections/check_point/mgmt/plugins/doc_fragments/checkpoint_objects.py +++ b/ansible_collections/check_point/mgmt/plugins/doc_fragments/checkpoint_objects.py @@ -3,28 +3,27 @@ # Copyright: (c) 2019, Or Soffer <orso@checkpoint.com> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function + __metaclass__ = type class ModuleDocFragment(object): # Standard files documentation fragment - DOCUMENTATION = r''' + DOCUMENTATION = r""" options: state: description: - - State of the access rule (present or absent). Defaults to present. + - State of the access rule (present or absent). type: str default: present - choices: - - 'present' - - 'absent' + choices: ['present', 'absent'] auto_publish_session: description: - - Publish the current session if changes have been performed - after task completes. + - Publish the current session if changes have been performed after task completes. type: bool + default: False wait_for_task: description: - Wait for the task to end. Such as publish task. @@ -39,4 +38,4 @@ options: description: - Version of checkpoint. If not given one, the latest version taken. type: str -''' +""" diff --git a/ansible_collections/check_point/mgmt/plugins/doc_fragments/checkpoint_objects_action_module.py b/ansible_collections/check_point/mgmt/plugins/doc_fragments/checkpoint_objects_action_module.py index 992428bbe..62d8d5f60 100644 --- a/ansible_collections/check_point/mgmt/plugins/doc_fragments/checkpoint_objects_action_module.py +++ b/ansible_collections/check_point/mgmt/plugins/doc_fragments/checkpoint_objects_action_module.py @@ -3,20 +3,22 @@ # Copyright: (c) 2019, Or Soffer <orso@checkpoint.com> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function + __metaclass__ = type class ModuleDocFragment(object): # Standard files documentation fragment - DOCUMENTATION = r''' + DOCUMENTATION = r""" options: auto_publish_session: description: - Publish the current session if changes have been performed after task completes. type: bool + default: False wait_for_task_timeout: description: - How many minutes to wait until throwing a timeout error. @@ -26,4 +28,4 @@ options: description: - Version of checkpoint. If not given one, the latest version taken. type: str -''' +""" diff --git a/ansible_collections/check_point/mgmt/plugins/httpapi/checkpoint.py b/ansible_collections/check_point/mgmt/plugins/httpapi/checkpoint.py index ade89cb00..606af77b1 100644 --- a/ansible_collections/check_point/mgmt/plugins/httpapi/checkpoint.py +++ b/ansible_collections/check_point/mgmt/plugins/httpapi/checkpoint.py @@ -1,7 +1,7 @@ # (c) 2018 Red Hat Inc. # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type @@ -44,39 +44,44 @@ from ansible.plugins.httpapi import HttpApiBase from ansible.module_utils.connection import ConnectionError BASE_HEADERS = { - 'Content-Type': 'application/json', - 'User-Agent': 'Ansible', + "Content-Type": "application/json", + "User-Agent": "Ansible", } class HttpApi(HttpApiBase): def login(self, username, password): payload = {} - cp_domain = self.get_option('domain') - cp_api_key = self.get_option('api_key') + cp_domain = self.get_option("domain") + cp_api_key = self.get_option("api_key") if cp_domain: - payload['domain'] = cp_domain + payload["domain"] = cp_domain if username and password and not cp_api_key: - payload['user'] = username - payload['password'] = password + payload["user"] = username + payload["password"] = password elif cp_api_key and not username and not password: - payload['api-key'] = cp_api_key + payload["api-key"] = cp_api_key else: - raise AnsibleConnectionFailure('[Username and password] or api_key are required for login') - url = '/web_api/login' + raise AnsibleConnectionFailure( + "[Username and password] or api_key are required for login" + ) + url = "/web_api/login" response, response_data = self.send_request(url, payload) - + if response != 200: + raise ConnectionError("Login to server failed: %s" % response_data) try: - self.connection._auth = {'X-chkp-sid': response_data['sid']} + self.connection._auth = {"X-chkp-sid": response_data["sid"]} except KeyError: raise ConnectionError( - 'Server returned response without token info during connection authentication: %s' % response) + "Server returned response without token info during connection authentication: %s" + % response + ) # Case of read-only - if 'uid' in response_data.keys(): - self.connection._session_uid = response_data['uid'] + if "uid" in response_data.keys(): + self.connection._session_uid = response_data["uid"] def logout(self): - url = '/web_api/logout' + url = "/web_api/logout" response, dummy = self.send_request(url, None) @@ -84,13 +89,15 @@ class HttpApi(HttpApiBase): return self.connection._session_uid def send_request(self, path, body_params): - data = json.dumps(body_params) if body_params else '{}' - cp_cloud_mgmt_id = self.get_option('cloud_mgmt_id') + data = json.dumps(body_params) if body_params else "{}" + cp_cloud_mgmt_id = self.get_option("cloud_mgmt_id") if cp_cloud_mgmt_id: - path = '/' + cp_cloud_mgmt_id + path + path = "/" + cp_cloud_mgmt_id + path try: self._display_request() - response, response_data = self.connection.send(path, data, method='POST', headers=BASE_HEADERS) + response, response_data = self.connection.send( + path, data, method="POST", headers=BASE_HEADERS + ) value = self._get_response_value(response_data) return response.getcode(), self._response_to_json(value) @@ -101,7 +108,9 @@ class HttpApi(HttpApiBase): return e.code, error def _display_request(self): - self.connection.queue_message('vvvv', 'Web Services: %s %s' % ('POST', self.connection._url)) + self.connection.queue_message( + "vvvv", "Web Services: %s %s" % ("POST", self.connection._url) + ) def _get_response_value(self, response_data): return to_text(response_data.getvalue()) @@ -111,4 +120,4 @@ class HttpApi(HttpApiBase): return json.loads(response_text) if response_text else {} # JSONDecodeError only available on Python 3.5+ except ValueError: - raise ConnectionError('Invalid JSON response: %s' % response_text) + raise ConnectionError("Invalid JSON response: %s" % response_text) diff --git a/ansible_collections/check_point/mgmt/plugins/module_utils/checkpoint.py b/ansible_collections/check_point/mgmt/plugins/module_utils/checkpoint.py index 476e56f16..12d5ea360 100644 --- a/ansible_collections/check_point/mgmt/plugins/module_utils/checkpoint.py +++ b/ansible_collections/check_point/mgmt/plugins/module_utils/checkpoint.py @@ -4,7 +4,7 @@ # still belong to the author of the module, and may assign their own license # to the complete work. # -# (c) 2018 Red Hat Inc. +# (c) 2022 Red Hat Inc. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: @@ -26,71 +26,246 @@ # USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type import time - +from ansible.module_utils.six import iteritems +from ansible.module_utils.urls import CertificateError +from ansible.module_utils.connection import ConnectionError from ansible.module_utils.connection import Connection +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( + utils, +) + + +BASE_HEADERS = { + "Content-Type": "application/json", + "User-Agent": "Ansible", +} checkpoint_argument_spec_for_action_module = dict( - auto_publish_session=dict(type='bool'), - wait_for_task_timeout=dict(type='int', default=30), - version=dict(type='str') + auto_publish_session=dict(type="bool", default=False), + wait_for_task_timeout=dict(type="int", default=30), + version=dict(type="str"), ) checkpoint_argument_spec_for_objects = dict( - auto_publish_session=dict(type='bool'), - wait_for_task=dict(type='bool', default=True), - wait_for_task_timeout=dict(type='int', default=30), - state=dict(type='str', choices=['present', 'absent'], default='present'), - version=dict(type='str') + auto_publish_session=dict(type="bool", default=False), + wait_for_task=dict(type="bool", default=True), + wait_for_task_timeout=dict(type="int", default=30), + state=dict(type="str", choices=["present", "absent"], default="present"), + version=dict(type="str"), ) -checkpoint_argument_spec_for_facts = dict( - version=dict(type='str') -) +checkpoint_argument_spec_for_facts = dict(version=dict(type="str")) checkpoint_argument_spec_for_commands = dict( - wait_for_task=dict(type='bool', default=True), - wait_for_task_timeout=dict(type='int', default=30), - version=dict(type='str') + wait_for_task=dict(type="bool", default=True), + wait_for_task_timeout=dict(type="int", default=30), + version=dict(type="str"), + auto_publish_session=dict(type="bool", default=False), ) -delete_params = ['name', 'uid', 'layer', 'exception-group-name', 'rule-name', 'package'] +delete_params = [ + "name", + "uid", + "layer", + "exception-group-name", + "rule-name", + "package", + "ignore-errors", + "ignore-warnings", + "gateway-uid" +] + +remove_from_set_payload = { + "lsm-cluster": [ + "security-profile", + "name-prefix", + "name-suffix", + "main-ip-address", + ], + "md-permissions-profile": ["permission-level"], +} + +remove_from_add_payload = {"lsm-cluster": ["name"]} + + +def _fail_json(msg): + """Replace the AnsibleModule fail_json here + :param msg: The message for the failure + :type msg: str + """ + raise Exception(msg) + + +def map_params_to_obj(module_params, key_transform): + """The fn to convert the api returned params to module params + :param module_params: Module params + :param key_transform: Dict with module equivalent API params + :rtype: A dict + :returns: dict with module prams transformed having API expected params + """ + obj = {} + for k, v in iteritems(key_transform): + if k in module_params and ( + module_params.get(k) + or module_params.get(k) == 0 + or module_params.get(k) is False + ): + val = module_params.pop(k) + if isinstance(val, list): + temp = [] + for each in val: + if isinstance(each, dict): + temp.append(map_params_to_obj(each, key_transform)) + if temp: + val = temp + if isinstance(val, dict): + temp_child = {} + for each_k, each_v in iteritems(val): + if "_" in each_k: + temp_param = "-".join(each_k.split("_")) + if isinstance(each_v, dict): + temp_dict = map_params_to_obj( + each_v, key_transform + ) + each_v = temp_dict + temp_child.update({temp_param: each_v}) + else: + temp_child.update({each_k: each_v}) + obj[v] = temp_child + else: + obj[v] = val + if module_params: + obj.update(module_params) + return obj + + +def map_obj_to_params(module_return_params, key_transform, return_param): + """The fn to convert the api returned params to module params + :param module_return_params: API returned response params + :param key_transform: Module params + :rtype: A dict + :returns: dict with api returned value to module param value + """ + temp = {} + if module_return_params.get(return_param): + temp[return_param] = [] + for each in module_return_params[return_param]: + api_temp = {} + for k, v in iteritems(key_transform): + if v in each and ( + each.get(v) or each.get(v) == 0 or each.get(v) is False + ): + api_temp[k] = each.pop(v) + if each: + api_temp.update(each) + temp[return_param].append(api_temp) + else: + for k, v in iteritems(key_transform): + if v in module_return_params and ( + module_return_params.get(v) + or module_return_params.get(v) == 0 + or module_return_params.get(v) is False + ): + if isinstance(module_return_params[v], dict): + temp_child = {} + for each_k, each_v in iteritems(module_return_params[v]): + if "-" in each_k: + temp_param = "_".join(each_k.split("-")) + if temp_param in key_transform: + temp_child.update({temp_param: each_v}) + else: + temp_child.update({each_k: each_v}) + temp[k] = temp_child + module_return_params.pop(v) + else: + temp[k] = module_return_params.pop(v) + if module_return_params: + temp.update(module_return_params) + return temp + -remove_from_set_payload = {'lsm-cluster': ['security-profile', 'name-prefix', 'name-suffix', 'main-ip-address'], - 'md-permissions-profile': ['permission-level']} +def verify_want_have_diff(want, have, remove_key_from_diff): + for each in remove_key_from_diff: + if each in want: + del want[each] + diff = utils.dict_diff(have, want) + return diff -remove_from_add_payload = {'lsm-cluster': ['name']} + +def remove_unwanted_key(payload, remove_keys): + for each in remove_keys: + if each in payload: + del payload[each] + return payload + + +def sync_show_params_with_add_params(search_result, key_transform): + temp = {} + remove_keys = ["type", "meta-info"] + for k, v in iteritems(search_result): + if k in remove_keys: + continue + if isinstance(v, dict): + if v.get("name"): + temp.update({k: v["name"]}) + else: + temp_child = {} + for each_k, each_v in iteritems(v): + if isinstance(each_v, dict): + if each_v.get("name"): + temp_child.update({each_k: each_v["name"]}) + else: + temp_child.update({each_k: each_v}) + temp.update({k: temp_child}) + elif isinstance(v, list): + temp[k] = [] + for each in v: + if each.get("name"): + temp[k].append(each["name"]) + else: + temp.update(each) + else: + temp.update({k: v}) + temp = map_obj_to_params(temp, key_transform, "") + return temp # parse failure message with code and response def parse_fail_message(code, response): - return 'Checkpoint device returned error {0} with message {1}'.format(code, response) + return "Checkpoint device returned error {0} with message {1}".format( + code, response + ) # send the request to checkpoint def send_request(connection, version, url, payload=None): - code, response = connection.send_request('/web_api/' + version + url, payload) + code, response = connection.send_request( + "/web_api/" + version + url, payload + ) return code, response # get the payload from the user parameters def is_checkpoint_param(parameter): - if parameter == 'auto_publish_session' or \ - parameter == 'state' or \ - parameter == 'wait_for_task' or \ - parameter == 'wait_for_task_timeout' or \ - parameter == 'version': + if ( + parameter == "auto_publish_session" + or parameter == "state" + or parameter == "wait_for_task" + or parameter == "wait_for_task_timeout" + or parameter == "version" + ): return False return True def contains_show_identifier_param(payload): - identifier_params = ["name", "uid", "assigned-domain"] + identifier_params = ["name", "uid", "assigned-domain", "task-id", "signature", "url"] for param in identifier_params: if payload.get(param) is not None: return True @@ -104,17 +279,36 @@ def get_payload_from_parameters(params): parameter_value = params[parameter] if parameter_value is not None and is_checkpoint_param(parameter): if isinstance(parameter_value, dict): - payload[parameter.replace("_", "-")] = get_payload_from_parameters(parameter_value) - elif isinstance(parameter_value, list) and len(parameter_value) != 0 and isinstance(parameter_value[0], dict): + payload[ + parameter.replace("_", "-") + ] = get_payload_from_parameters(parameter_value) + elif ( + isinstance(parameter_value, list) + and len(parameter_value) != 0 + and isinstance(parameter_value[0], dict) + ): payload_list = [] for element_dict in parameter_value: - payload_list.append(get_payload_from_parameters(element_dict)) + payload_list.append( + get_payload_from_parameters(element_dict) + ) payload[parameter.replace("_", "-")] = payload_list else: # special handle for this param in order to avoid two params called "version" - if parameter == "gateway_version" or parameter == "cluster_version": + if ( + parameter == "gateway_version" + or parameter == "cluster_version" + or parameter == "server_version" + or parameter == "check_point_host_version" + or parameter == "target_version" + or parameter == "vsx_version" + ): parameter = "version" + # message & syslog_facility are internally used by Ansible, so need to avoid param duplicity + elif parameter == "login_message": + parameter = "message" + payload[parameter.replace("_", "-")] = parameter_value return payload @@ -122,11 +316,14 @@ def get_payload_from_parameters(params): # wait for task def wait_for_task(module, version, connection, task_id): - task_id_payload = {'task-id': task_id, 'details-level': 'full'} + task_id_payload = {"task-id": task_id, "details-level": "full"} task_complete = False minutes_until_timeout = 30 - if module.params['wait_for_task_timeout'] is not None and module.params['wait_for_task_timeout'] >= 0: - minutes_until_timeout = module.params['wait_for_task_timeout'] + if ( + module.params["wait_for_task_timeout"] is not None + and module.params["wait_for_task_timeout"] >= 0 + ): + minutes_until_timeout = module.params["wait_for_task_timeout"] max_num_iterations = minutes_until_timeout * 30 current_iteration = 0 @@ -134,40 +331,65 @@ def wait_for_task(module, version, connection, task_id): while not task_complete and current_iteration < max_num_iterations: current_iteration += 1 # Check the status of the task - code, response = send_request(connection, version, 'show-task', task_id_payload) + code, response = send_request( + connection, version, "show-task", task_id_payload + ) attempts_counter = 0 while code != 200: if attempts_counter < 5: attempts_counter += 1 time.sleep(2) - code, response = send_request(connection, version, 'show-task', task_id_payload) + code, response = send_request( + connection, version, "show-task", task_id_payload + ) else: - response['message'] = "ERROR: Failed to handle asynchronous tasks as synchronous, tasks result is" \ - " undefined. " + response['message'] + response["message"] = ( + "ERROR: Failed to handle asynchronous tasks as synchronous, tasks result is" + " undefined. " + response["message"] + ) module.fail_json(msg=parse_fail_message(code, response)) # Count the number of tasks that are not in-progress completed_tasks = 0 - for task in response['tasks']: - if task['status'] == 'failed': - status_description, comments = get_status_description_and_comments(task) + for task in response["tasks"]: + if task["status"] == "failed": + ( + status_description, + comments, + ) = get_status_description_and_comments(task) if comments and status_description: module.fail_json( - msg='Task {0} with task id {1} failed. Message: {2} with description: {3} - ' - 'Look at the logs for more details ' - .format(task['task-name'], task['task-id'], comments, status_description)) + msg="Task {0} with task id {1} failed. Message: {2} with description: {3} - " + "Look at the logs for more details ".format( + task["task-name"], + task["task-id"], + comments, + status_description, + ) + ) elif comments: - module.fail_json(msg='Task {0} with task id {1} failed. Message: {2} - Look at the logs for more details ' - .format(task['task-name'], task['task-id'], comments)) + module.fail_json( + msg="Task {0} with task id {1} failed. Message: {2} - Look at the logs for more details ".format( + task["task-name"], task["task-id"], comments + ) + ) elif status_description: - module.fail_json(msg='Task {0} with task id {1} failed. Message: {2} - Look at the logs for more ' - 'details ' - .format(task['task-name'], task['task-id'], status_description)) + module.fail_json( + msg="Task {0} with task id {1} failed. Message: {2} - Look at the logs for more " + "details ".format( + task["task-name"], + task["task-id"], + status_description, + ) + ) else: - module.fail_json(msg='Task {0} with task id {1} failed. Look at the logs for more details' - .format(task['task-name'], task['task-id'])) - if task['status'] == 'in progress': + module.fail_json( + msg="Task {0} with task id {1} failed. Look at the logs for more details".format( + task["task-name"], task["task-id"] + ) + ) + if task["status"] == "in progress": break completed_tasks += 1 @@ -177,7 +399,11 @@ def wait_for_task(module, version, connection, task_id): else: time.sleep(2) # Wait for two seconds if not task_complete: - module.fail_json(msg="ERROR: Timeout. Task-id: {0}.".format(task_id_payload['task-id'])) + module.fail_json( + msg="ERROR: Timeout. Task-id: {0}.".format( + task_id_payload["task-id"] + ) + ) else: return response @@ -186,56 +412,98 @@ def wait_for_task(module, version, connection, task_id): def get_status_description_and_comments(task): status_description = None comments = None - if 'comments' in task and task['comments']: - comments = task['comments'] - if 'task-details' in task and task['task-details']: - task_details = task['task-details'][0] - if 'statusDescription' in task_details: - status_description = task_details['statusDescription'] + if "comments" in task and task["comments"]: + comments = task["comments"] + if "task-details" in task and task["task-details"]: + task_details = task["task-details"][0] + if "statusDescription" in task_details: + status_description = task_details["statusDescription"] return status_description, comments # if failed occurred, in some cases we want to discard changes before exiting. We also notify the user about the `discard` def discard_and_fail(module, code, response, connection, version): - discard_code, discard_response = send_request(connection, version, 'discard') + discard_code, discard_response = send_request( + connection, version, "discard" + ) if discard_code != 200: try: - module.fail_json(msg=parse_fail_message(code, response) + ' Failed to discard session {0}' - ' with error {1} with message {2}'.format(connection.get_session_uid(), - discard_code, discard_response)) + module.fail_json( + msg=parse_fail_message(code, response) + + " Failed to discard session {0}" + " with error {1} with message {2}".format( + connection.get_session_uid(), + discard_code, + discard_response, + ) + ) except Exception: # Read-only mode without UID - module.fail_json(msg=parse_fail_message(code, response) + ' Failed to discard session' - ' with error {0} with message {1}'.format(discard_code, discard_response)) + module.fail_json( + msg=parse_fail_message(code, response) + + " Failed to discard session" + " with error {0} with message {1}".format( + discard_code, discard_response + ) + ) - module.fail_json(msg=parse_fail_message(code, response) + ' Unpublished changes were discarded') + module.fail_json( + msg=parse_fail_message(code, response) + + " Unpublished changes were discarded" + ) # handle publish command, and wait for it to end if the user asked so def handle_publish(module, connection, version): - if 'auto_publish_session' in module.params and module.params['auto_publish_session']: - publish_code, publish_response = send_request(connection, version, 'publish') + if ( + "auto_publish_session" in module.params + and module.params["auto_publish_session"] + ): + publish_code, publish_response = send_request( + connection, version, "publish" + ) if publish_code != 200: - discard_and_fail(module, publish_code, publish_response, connection, version) - if module.params['wait_for_task']: - wait_for_task(module, version, connection, publish_response['task-id']) + discard_and_fail( + module, publish_code, publish_response, connection, version + ) + if module.params["wait_for_task"]: + wait_for_task( + module, version, connection, publish_response["task-id"] + ) # if user insert a specific version, we add it to the url def get_version(module): - return ('v' + module.params['version'] + '/') if module.params.get('version') else '' + return ( + ("v" + module.params["version"] + "/") + if module.params.get("version") + else "" + ) # if code is 400 (bad request) or 500 (internal error) - fail def handle_equals_failure(module, equals_code, equals_response): if equals_code == 400 or equals_code == 500: module.fail_json(msg=parse_fail_message(equals_code, equals_response)) - if equals_code == 404 and equals_response['code'] == 'generic_err_command_not_found': - module.fail_json(msg='Relevant hotfix is not installed on Check Point server. See sk114661 on Check Point Support Center.') + if ( + equals_code == 404 + and equals_response["code"] == "generic_err_command_not_found" + ): + module.fail_json( + msg="Relevant hotfix is not installed on Check Point server. See sk114661 on Check Point Support Center." + ) # handle call -def handle_call(connection, version, call, payload, module, to_publish, to_discard_on_failure): +def handle_call( + connection, + version, + call, + payload, + module, + to_publish, + to_discard_on_failure, +): code, response = send_request(connection, version, call, payload) if code != 200: if to_discard_on_failure: @@ -243,15 +511,19 @@ def handle_call(connection, version, call, payload, module, to_publish, to_disca else: module.fail_json(msg=parse_fail_message(code, response)) else: - if 'wait_for_task' in module.params and module.params['wait_for_task']: - if 'task-id' in response: - response = wait_for_task(module, version, connection, response['task-id']) - elif 'tasks' in response: - for task in response['tasks']: - if 'task-id' in task: - task_id = task['task-id'] - response[task_id] = wait_for_task(module, version, connection, task['task-id']) - del response['tasks'] + if "wait_for_task" in module.params and module.params["wait_for_task"]: + if "task-id" in response: + response = wait_for_task( + module, version, connection, response["task-id"] + ) + elif "tasks" in response: + for task in response["tasks"]: + if "task-id" in task: + task_id = task["task-id"] + response[task_id] = wait_for_task( + module, version, connection, task["task-id"] + ) + del response["tasks"] if to_publish: handle_publish(module, connection, version) return response @@ -264,18 +536,25 @@ def api_command(module, command): version = get_version(module) code, response = send_request(connection, version, command, payload) - result = {'changed': True} + result = {"changed": True} + + if command.startswith("show"): + result['changed'] = False if code == 200: - if module.params['wait_for_task']: - if 'task-id' in response: - response = wait_for_task(module, version, connection, response['task-id']) - elif 'tasks' in response: - for task in response['tasks']: - if 'task-id' in task: - task_id = task['task-id'] - response[task_id] = wait_for_task(module, version, connection, task['task-id']) - del response['tasks'] + if module.params["wait_for_task"]: + if "task-id" in response: + response = wait_for_task( + module, version, connection, response["task-id"] + ) + elif "tasks" in response: + for task in response["tasks"]: + if "task-id" in task: + task_id = task["task-id"] + response[task_id] = wait_for_task( + module, version, connection, task["task-id"] + ) + del response["tasks"] result[command] = response @@ -296,24 +575,55 @@ def api_call_facts(module, api_call_object, api_call_object_plural_version): if not contains_show_identifier_param(payload): api_call_object = api_call_object_plural_version - response = handle_call(connection, version, 'show-' + api_call_object, payload, module, False, False) - result = {api_call_object: response} + response = handle_call( + connection, + version, + "show-" + api_call_object, + payload, + module, + False, + False, + ) + result = {api_call_object.replace("-", "_"): response} return result # handle delete -def handle_delete(equals_code, payload, delete_params, connection, version, api_call_object, module, result): +def handle_delete( + equals_code, + payload, + delete_params, + connection, + version, + api_call_object, + module, + result, +): # else equals_code is 404 and no need to delete because he doesn't exist if equals_code == 200: - payload_for_delete = extract_payload_with_some_params(payload, delete_params) - response = handle_call(connection, version, 'delete-' + api_call_object, payload_for_delete, module, True, True) - result['changed'] = True - - -# handle the call and set the result with 'changed' and teh response -def handle_call_and_set_result(connection, version, call, payload, module, result): - response = handle_call(connection, version, call, payload, module, True, True) - result['changed'] = True + payload_for_delete = extract_payload_with_some_params( + payload, delete_params + ) + response = handle_call( + connection, + version, + "delete-" + api_call_object, + payload_for_delete, + module, + True, + True, + ) + result["changed"] = True + + +# handle the call and set the result with 'changed' and the response +def handle_call_and_set_result( + connection, version, call, payload, module, result +): + response = handle_call( + connection, version, call, payload, module, True, True + ) + result["changed"] = True result[call] = response @@ -323,77 +633,128 @@ def api_call(module, api_call_object): connection = Connection(module._socket_path) version = get_version(module) - result = {'changed': False} + result = {"changed": False} if module.check_mode: return result - payload_for_equals = {'type': api_call_object, 'params': payload} - equals_code, equals_response = send_request(connection, version, 'equals', payload_for_equals) - result['checkpoint_session_uid'] = connection.get_session_uid() + payload_for_equals = {"type": api_call_object, "params": payload} + equals_code, equals_response = send_request( + connection, version, "equals", payload_for_equals + ) + result["checkpoint_session_uid"] = connection.get_session_uid() handle_equals_failure(module, equals_code, equals_response) - if module.params['state'] == 'present': + if module.params["state"] == "present": if equals_code == 200: # else objects are equals and there is no need for set request - if not equals_response['equals']: - build_payload(api_call_object, payload, remove_from_set_payload) - handle_call_and_set_result(connection, version, 'set-' + api_call_object, payload, module, result) + if not equals_response["equals"]: + build_payload( + api_call_object, payload, remove_from_set_payload + ) + handle_call_and_set_result( + connection, + version, + "set-" + api_call_object, + payload, + module, + result, + ) elif equals_code == 404: build_payload(api_call_object, payload, remove_from_add_payload) - handle_call_and_set_result(connection, version, 'add-' + api_call_object, payload, module, result) - elif module.params['state'] == 'absent': - handle_delete(equals_code, payload, delete_params, connection, version, api_call_object, module, result) + handle_call_and_set_result( + connection, + version, + "add-" + api_call_object, + payload, + module, + result, + ) + elif module.params["state"] == "absent": + handle_delete( + equals_code, + payload, + delete_params, + connection, + version, + api_call_object, + module, + result, + ) return result -# returns a generator of the entire rulebase -def get_rulebase_generator(connection, version, layer, show_rulebase_command, rules_amount): +# returns a generator of the entire rulebase. show_rulebase_identifier_payload can be either package or layer +def get_rulebase_generator( + connection, version, show_rulebase_identifier_payload, show_rulebase_command, rules_amount +): offset = 0 limit = 100 while True: payload_for_show_rulebase = { - 'name': layer, - 'limit': limit, - 'offset': offset, + "limit": limit, + "offset": offset, } + payload_for_show_rulebase.update(show_rulebase_identifier_payload) # in case there are empty sections after the last rule, we need them to appear in the reply and the limit might # cut them out if offset + limit >= rules_amount: - del payload_for_show_rulebase['limit'] - code, response = send_request(connection, version, show_rulebase_command, payload_for_show_rulebase) - offset = response['to'] - total = response['total'] - rulebase = response['rulebase'] + del payload_for_show_rulebase["limit"] + code, response = send_request( + connection, + version, + show_rulebase_command, + payload_for_show_rulebase, + ) + offset = response["to"] + total = response["total"] + rulebase = response["rulebase"] yield rulebase if total <= offset: return # get 'to' or 'from' of given section -def get_edge_position_in_section(connection, version, layer, section_name, edge): - code, response = send_request(connection, version, "show-layer-structure", {'name': layer, 'details-level': 'uid'}) - if response['code'] == 'generic_err_command_not_found': - raise ValueError("The use of the relative_position field with a section as its value is available only for" - " version 1.7.1 with JHF take 42 and above") - sections_in_layer = response['root-section']['children'] +def get_edge_position_in_section( + connection, version, identifier, section_name, edge +): + code, response = send_request( + connection, + version, + "show-layer-structure", + {"name": identifier, "details-level": "uid"}, + ) + if 'code' in response and response["code"] == "generic_err_command_not_found": + raise ValueError( + "The use of the relative_position field with a section as its value is available only for" + " version 1.7.1 with JHF take 42 and above" + ) + sections_in_layer = response["root-section"]["children"] for section in sections_in_layer: - if section['name'] == section_name: - return int(section[edge + '-rule']) + if section["name"] == section_name: + return int(section[edge + "-rule"]) return None # return the total amount of rules in the rulebase of the given layer -def get_rules_amount(connection, version, layer, show_rulebase_command): - payload_for_show_obj_rulebase = {'name': layer, 'limit': 0} - code, response = send_request(connection, version, show_rulebase_command, payload_for_show_obj_rulebase) - return int(response['total']) - - -def keep_searching_rulebase(position, current_section, relative_position, relative_position_is_section): +def get_rules_amount(connection, version, show_rulebase_payload, show_rulebase_command): + payload = {"limit": 0} + payload.update(show_rulebase_payload) + code, response = send_request( + connection, + version, + show_rulebase_command, + payload, + ) + return int(response["total"]) + + +def keep_searching_rulebase( + position, current_section, relative_position, relative_position_is_section +): position_not_found = position is None - if relative_position_is_section and 'above' not in relative_position: + if relative_position_is_section and "above" not in relative_position: # if 'above' in relative_position then get_number_and_section_from_relative_position returns the previous section # so there isn't a need to further search for the relative section relative_section = list(relative_position.values())[0] @@ -403,153 +764,380 @@ def keep_searching_rulebase(position, current_section, relative_position, relati return position_not_found -def relative_position_is_section(connection, version, layer, relative_position): - if 'top' in relative_position or 'bottom' in relative_position: +def relative_position_is_section( + connection, version, api_call_object, layer_or_package_payload, relative_position +): + if "top" in relative_position or "bottom" in relative_position: return True + show_section_command = "show-access-section" if 'access' in api_call_object else "show-nat-section" relative_position_value = list(relative_position.values())[0] - code, response = send_request(connection, version, "show-access-section", {'layer': layer, 'name': relative_position_value}) + payload = {"name": relative_position_value} + payload.update(layer_or_package_payload) + code, response = send_request( + connection, + version, + show_section_command, + payload, + ) if code == 200: return True return False -def get_number_and_section_from_relative_position(payload, connection, version, rulebase, above_relative_position, pos_before_relative_empty_section): - section_name = None +def get_number_and_section_from_relative_position( + payload, + connection, + version, + rulebase, + above_relative_position, + pos_before_relative_empty_section, + api_call_object, + prev_section=None, + current_section=None, +): + section_name = current_section position = None for rules in rulebase: - if 'rulebase' in rules: + if "rulebase" in rules: # cases relevant for relative-position=section - if 'above' in payload['position'] and rules['name'] == payload['position']['above']: - if len(rules['rulebase']) == 0: - position = pos_before_relative_empty_section if above_relative_position else pos_before_relative_empty_section + 1 + if ( + "above" in payload["position"] + and rules["name"] == payload["position"]["above"] + ): + if len(rules["rulebase"]) == 0: + position = ( + pos_before_relative_empty_section + if above_relative_position + else pos_before_relative_empty_section + 1 + ) else: # if the entire section isn't present in rulebase, the 'from' value of the section might not be # the first position in the section, which is why we use get_edge_position_in_section - from_value = get_edge_position_in_section(connection, version, payload['layer'], rules['name'], "from") + from_value = get_edge_position_in_section( + connection, + version, + list(get_relevant_layer_or_package_identifier(api_call_object, payload).values())[0], + rules["name"], + "from", + ) if from_value is not None: # section exists in rulebase - position = max(from_value - 1, 1) if above_relative_position else from_value - return position, section_name, above_relative_position, pos_before_relative_empty_section + position = ( + max(from_value - 1, 1) + if above_relative_position + else from_value + ) + return ( + position, + section_name, + above_relative_position, + pos_before_relative_empty_section, + prev_section, + ) # we update this only after the 'above' case since the section that should be returned in that case isn't # the one we are currently iterating over (but the one beforehand) - section_name = rules['name'] - - if 'bottom' in payload['position'] and rules['name'] == payload['position']['bottom']: - if len(rules['rulebase']) == 0: - position = pos_before_relative_empty_section if above_relative_position else pos_before_relative_empty_section + 1 + prev_section = section_name + section_name = rules["name"] + + if ( + "bottom" in payload["position"] + and rules["name"] == payload["position"]["bottom"] + ): + if len(rules["rulebase"]) == 0: + position = ( + pos_before_relative_empty_section + if above_relative_position + else pos_before_relative_empty_section + 1 + ) else: # if the entire section isn't present in rulebase, the 'to' value of the section might not be the # last position in the section, which is why we use get_edge_position_in_section - to_value = get_edge_position_in_section(connection, version, payload['layer'], section_name, "to") - if to_value is not None and to_value == int(rules['to']): # meaning the entire section is present in rulebase + to_value = get_edge_position_in_section( + connection, + version, + list(get_relevant_layer_or_package_identifier(api_call_object, payload).values())[0], + section_name, + "to", + ) + if to_value is not None and to_value == int( + rules["to"] + ): # meaning the entire section is present in rulebase # is the rule already at the bottom of the section. Can infer this only if the entire section is # present in rulebase - is_bottom = rules['rulebase'][-1]['name'] == payload['name'] - position = to_value if (above_relative_position or is_bottom) else to_value + 1 + is_bottom = ( + rules["rulebase"][-1]["name"] == payload["name"] + ) + position = ( + to_value + if (above_relative_position or is_bottom) + else to_value + 1 + ) # else: need to keep searching the rulebase, so position=None is returned - return position, section_name, above_relative_position, pos_before_relative_empty_section + return ( + position, + section_name, + above_relative_position, + pos_before_relative_empty_section, + prev_section, + ) # setting a rule 'below' a section is equivalent to setting the rule at the top of that section - if ('below' in payload['position'] and section_name == payload['position']['below']) or \ - ('top' in payload['position'] and section_name == payload['position']['top']): - if len(rules['rulebase']) == 0: - position = pos_before_relative_empty_section if above_relative_position else pos_before_relative_empty_section + 1 + if ( + "below" in payload["position"] + and section_name == payload["position"]["below"] + ) or ( + "top" in payload["position"] + and section_name == payload["position"]["top"] + ): + if len(rules["rulebase"]) == 0: + position = ( + pos_before_relative_empty_section + if above_relative_position + else pos_before_relative_empty_section + 1 + ) else: # is the rule already at the top of the section - is_top = rules['rulebase'][0]['name'] == payload['name'] - position = max(int(rules['from']) - 1, 1) if (above_relative_position or not is_top) else int(rules['from']) - return position, section_name, above_relative_position, pos_before_relative_empty_section - - if len(rules['rulebase']) != 0: + is_top = rules["rulebase"][0]["name"] == payload["name"] + position = ( + max(int(rules["from"]) - 1, 1) + if (above_relative_position or not is_top) + else int(rules["from"]) + ) + return ( + position, + section_name, + above_relative_position, + pos_before_relative_empty_section, + prev_section, + ) + + if len(rules["rulebase"]) != 0: # if search_entire_rulebase=True: even if rules['rulebase'] is cut (due to query limit) this will # eventually be updated to the correct value in further calls - pos_before_relative_empty_section = int(rules['to']) + pos_before_relative_empty_section = int(rules["to"]) - rules = rules['rulebase'] + rules = rules["rulebase"] for rule in rules: - if payload['name'] == rule['name']: + if payload["name"] == rule["name"]: above_relative_position = True # cases relevant for relative-position=rule - if 'below' in payload['position'] and rule['name'] == payload['position']['below']: - position = int(rule['rule-number']) if above_relative_position else int(rule['rule-number']) + 1 - return position, section_name, above_relative_position, pos_before_relative_empty_section - elif 'above' in payload['position'] and rule['name'] == payload['position']['above']: - position = max(int(rule['rule-number']) - 1, 1) if above_relative_position else int(rule['rule-number']) - return position, section_name, above_relative_position, pos_before_relative_empty_section + if ( + "below" in payload["position"] + and rule["name"] == payload["position"]["below"] + ): + position = ( + int(rule["rule-number"]) + if above_relative_position + else int(rule["rule-number"]) + 1 + ) + return ( + position, + section_name, + above_relative_position, + pos_before_relative_empty_section, + prev_section, + ) + elif ( + "above" in payload["position"] + and rule["name"] == payload["position"]["above"] + ): + position = ( + max(int(rule["rule-number"]) - 1, 1) + if above_relative_position + else int(rule["rule-number"]) + ) + return ( + position, + section_name, + above_relative_position, + pos_before_relative_empty_section, + prev_section, + ) else: # cases relevant for relative-position=rule - if payload['name'] == rules['name']: + if payload["name"] == rules["name"]: above_relative_position = True - if 'below' in payload['position'] and rules['name'] == payload['position']['below']: - position = int(rules['rule-number']) if above_relative_position else int(rules['rule-number']) + 1 - return position, section_name, above_relative_position, pos_before_relative_empty_section - elif 'above' in payload['position'] and rules['name'] == payload['position']['above']: - position = max(int(rules['rule-number']) - 1, 1) if above_relative_position else int(rules['rule-number']) - return position, section_name, above_relative_position, pos_before_relative_empty_section - - return position, section_name, above_relative_position, pos_before_relative_empty_section # None, None, False/True, x>=1 + if ( + "below" in payload["position"] + and rules["name"] == payload["position"]["below"] + ): + position = ( + int(rules["rule-number"]) + if above_relative_position + else int(rules["rule-number"]) + 1 + ) + return ( + position, + section_name, + above_relative_position, + pos_before_relative_empty_section, + prev_section, + ) + elif ( + "above" in payload["position"] + and rules["name"] == payload["position"]["above"] + ): + position = ( + max(int(rules["rule-number"]) - 1, 1) + if above_relative_position + else int(rules["rule-number"]) + ) + return ( + position, + section_name, + above_relative_position, + pos_before_relative_empty_section, + prev_section, + ) + + return ( + position, + section_name, + above_relative_position, + pos_before_relative_empty_section, + prev_section, + ) # None, None, False/True, x>=1, None # get the position in integer format and the section it is. -def get_number_and_section_from_position(payload, connection, version, api_call_object): +def get_number_and_section_from_position( + payload, connection, version, api_call_object +): show_rulebase_command = get_relevant_show_rulebase_command(api_call_object) - if 'position' in payload: + if "position" in payload: section_name = None - if type(payload['position']) is not dict: - position = payload['position'] - if position == 'top': + if type(payload["position"]) is not dict: + position = payload["position"] + if position == "top": position = 1 return position, section_name - elif position == 'bottom': - position = get_rules_amount(connection, version, payload['layer'], show_rulebase_command) - code, response = send_request(connection, version, show_rulebase_command, {'name': payload['layer'], 'offset': position - 1}) - rulebase = reversed(response['rulebase']) + elif position == "bottom": + show_rulebase_payload = get_relevant_show_rulebase_identifier_payload(api_call_object, payload) + position = get_rules_amount( + connection, + version, + show_rulebase_payload, + show_rulebase_command, + ) + show_rulebase_payload.update({"offset": position - 1}) + code, response = send_request( + connection, + version, + show_rulebase_command, + show_rulebase_payload, + ) + rulebase = reversed(response["rulebase"]) else: # is a number so we need to get the section (if exists) of the rule in that position position = int(position) - payload_for_show_obj_rulebase = build_rulebase_payload(api_call_object, payload, position) - code, response = send_request(connection, version, show_rulebase_command, payload_for_show_obj_rulebase) - rulebase = response['rulebase'] - if position > response['total']: - raise ValueError("The given position " + str(position) + " of rule " + payload['name'] + - "exceeds the total amount of rules in the rulebase") + payload_for_show_obj_rulebase = build_rulebase_payload( + api_call_object, payload, position + ) + code, response = send_request( + connection, + version, + show_rulebase_command, + payload_for_show_obj_rulebase, + ) + rulebase = response["rulebase"] + if position > response["total"]: + raise ValueError( + "The given position " + + str(position) + + " of rule " + + payload["name"] + + "exceeds the total amount of rules in the rulebase" + ) # in case position=1 and there are empty sections at the beginning of the rulebase we want to skip them i = 0 for rules in rulebase: - if 'rulebase' in rules and len(rules['rulebase']) == 0: + if "rulebase" in rules and len(rules["rulebase"]) == 0: i += 1 rulebase = rulebase[i:] for rules in rulebase: - if 'rulebase' in rules: - section_name = rules['name'] + if "rulebase" in rules: + section_name = rules["name"] return position, section_name else: return position, section_name # section = None else: - search_entire_rulebase = payload['search-entire-rulebase'] + search_entire_rulebase = payload["search-entire-rulebase"] position = None # is the rule we're getting its position number above the rule it is relatively positioned to above_relative_position = False # no from-to in empty sections so can't infer the position from them -> need to keep track of the position # before the empty relative section pos_before_relative_empty_section = 1 + show_rulebase_payload = get_relevant_show_rulebase_identifier_payload(api_call_object, payload) if not search_entire_rulebase: - code, response = send_request(connection, version, show_rulebase_command, {'name': payload['layer']}) - rulebase = response['rulebase'] - position, section_name, above_relative_position, pos_before_relative_empty_section = \ - get_number_and_section_from_relative_position(payload, connection, version, rulebase, - above_relative_position, pos_before_relative_empty_section) + code, response = send_request( + connection, + version, + show_rulebase_command, + show_rulebase_payload, + ) + rulebase = response["rulebase"] + ( + position, + section_name, + above_relative_position, + pos_before_relative_empty_section, + ) = get_number_and_section_from_relative_position( + payload, + connection, + version, + rulebase, + above_relative_position, + pos_before_relative_empty_section, + api_call_object, + ) else: - rules_amount = get_rules_amount(connection, version, payload['layer'], show_rulebase_command) - relative_pos_is_section = relative_position_is_section(connection, version, payload['layer'], payload['position']) - rulebase_generator = get_rulebase_generator(connection, version, payload['layer'], show_rulebase_command, rules_amount) + layer_or_package_payload = get_relevant_layer_or_package_identifier(api_call_object, payload) + rules_amount = get_rules_amount( + connection, + version, + show_rulebase_payload, + show_rulebase_command, + ) + relative_pos_is_section = relative_position_is_section( + connection, version, api_call_object, layer_or_package_payload, payload["position"] + ) + rulebase_generator = get_rulebase_generator( + connection, + version, + show_rulebase_payload, + show_rulebase_command, + rules_amount, + ) + # need to keep track of the previous section in case the iteration starts with a new section and + # we want to set the rule above a section - so the section the rule should be at is the previous one + prev_section = None for rulebase in rulebase_generator: - position, section_name, above_relative_position, pos_before_relative_empty_section = \ - get_number_and_section_from_relative_position(payload, connection, version, rulebase, - above_relative_position, pos_before_relative_empty_section) - if not keep_searching_rulebase(position, section_name, payload['position'], relative_pos_is_section): + ( + position, + section_name, + above_relative_position, + pos_before_relative_empty_section, + prev_section, + ) = get_number_and_section_from_relative_position( + payload, + connection, + version, + rulebase, + above_relative_position, + pos_before_relative_empty_section, + api_call_object, + prev_section, + section_name, + ) + if not keep_searching_rulebase( + position, + section_name, + payload["position"], + relative_pos_is_section, + ): break return position, section_name @@ -558,19 +1146,16 @@ def get_number_and_section_from_position(payload, connection, version, api_call_ # build the show rulebase payload def build_rulebase_payload(api_call_object, payload, position_number): - rulebase_payload = {'name': payload['layer'], 'offset': position_number - 1, 'limit': 1} - - if api_call_object == 'threat-exception': - rulebase_payload['rule-name'] = payload['rule-name'] - - return rulebase_payload + show_rulebase_required_identifiers_payload = get_relevant_show_rulebase_identifier_payload(api_call_object, payload) + show_rulebase_required_identifiers_payload.update({'offset': position_number - 1, 'limit': 1}) + return show_rulebase_required_identifiers_payload def build_rulebase_command(api_call_object): - rulebase_command = 'show-' + api_call_object.split('-')[0] + '-rulebase' + rulebase_command = "show-" + api_call_object.split("-")[0] + "-rulebase" - if api_call_object == 'threat-exception': - rulebase_command = 'show-threat-rule-exception-rulebase' + if api_call_object == "threat-exception": + rulebase_command = "show-threat-rule-exception-rulebase" return rulebase_command @@ -580,44 +1165,77 @@ def build_payload(api_call_object, payload, params_to_remove): if api_call_object in params_to_remove: for param in params_to_remove[api_call_object]: del payload[param] + return payload # extract first rule from given rulebase response and the section it is in. def extract_rule_and_section_from_rulebase_response(response): section_name = None - rule = response['rulebase'][0] + rule = response["rulebase"][0] i = 0 # skip empty sections (possible when offset=0) - while 'rulebase' in rule and len(rule['rulebase']) == 0: + while "rulebase" in rule and len(rule["rulebase"]) == 0: i += 1 - rule = response['rulebase'][i] + rule = response["rulebase"][i] - while 'rulebase' in rule: - section_name = rule['name'] - rule = rule['rulebase'][0] + while "rulebase" in rule: + section_name = rule["name"] + rule = rule["rulebase"][0] return rule, section_name def get_relevant_show_rulebase_command(api_call_object): - if api_call_object == 'access-rule': - return 'show-access-rulebase' + if api_call_object == "access-rule": + return "show-access-rulebase" elif api_call_object == "threat-rule": - return 'show-threat-rulebase' + return "show-threat-rulebase" elif api_call_object == "threat-exception": - return 'show-threat-rule-exception-rulebase' -# uncomment code below when https & nat modules are added as crud modules - # elif api_call_object == 'nat-rule': - # return 'show-nat-rulebase' + return "show-threat-rule-exception-rulebase" + elif api_call_object == 'nat-rule': + return 'show-nat-rulebase' + # uncomment code below when https module is added as a crud module # elif api_call_object == 'https-rule': # return 'show-https-rulebase' +# returns the show rulebase payload with the relevant required identifiers params +def get_relevant_show_rulebase_identifier_payload(api_call_object, payload): + if api_call_object == 'nat-rule': + show_rulebase_payload = {'package': payload['package']} + + else: + show_rulebase_payload = {'name': payload['layer']} + + if api_call_object == 'threat-exception': + show_rulebase_payload['rule-name'] = payload['rule-name'] + + return show_rulebase_payload + + +# returns the show section/rule payload with the relevant required identifying package/layer +def get_relevant_layer_or_package_identifier(api_call_object, payload): + if 'nat' in api_call_object: + identifier = {'package': payload['package']} + + else: + identifier = {'layer': payload['layer']} + + return identifier + + # is the param position (if the user inserted it) equals between the object and the user input, as well as the section the rule is in -def is_equals_with_position_param(payload, connection, version, api_call_object): +def is_equals_with_position_param( + payload, connection, version, api_call_object +): - position_number, section_according_to_position = get_number_and_section_from_position(payload, connection, version, api_call_object) + ( + position_number, + section_according_to_position, + ) = get_number_and_section_from_position( + payload, connection, version, api_call_object + ) # In this case the one of the following has occurred: # 1) There is no position param, then it's equals in vacuous truth @@ -626,16 +1244,23 @@ def is_equals_with_position_param(payload, connection, version, api_call_object) if position_number is None: return True - rulebase_payload = build_rulebase_payload(api_call_object, payload, position_number) + rulebase_payload = build_rulebase_payload( + api_call_object, payload, position_number + ) rulebase_command = build_rulebase_command(api_call_object) - code, response = send_request(connection, version, rulebase_command, rulebase_payload) + code, response = send_request( + connection, version, rulebase_command, rulebase_payload + ) rule, section = extract_rule_and_section_from_rulebase_response(response) # if the names of the exist rule and the user input rule are equals, as well as the section they're in, then it # means that their positions are equals so I return True. and there is no way that there is another rule with this # name cause otherwise the 'equals' command would fail - if rule['name'] == payload['name'] and section_according_to_position == section: + if ( + rule["name"] == payload["name"] + and section_according_to_position == section + ): return True else: return False @@ -660,18 +1285,28 @@ def extract_payload_with_some_params(payload, params_to_insert): # is equals with all the params including action and position -def is_equals_with_all_params(payload, connection, version, api_call_object, is_access_rule): - if is_access_rule and 'action' in payload: - payload_for_show = extract_payload_with_some_params(payload, ['name', 'uid', 'layer']) - code, response = send_request(connection, version, 'show-' + api_call_object, payload_for_show) - exist_action = response['action']['name'] - if exist_action.lower() != payload['action'].lower(): - if payload['action'].lower() != 'Apply Layer'.lower() or\ - exist_action.lower() != 'Inner Layer'.lower(): +def is_equals_with_all_params( + payload, connection, version, api_call_object, is_access_rule +): + if is_access_rule and "action" in payload: + payload_for_show = extract_payload_with_some_params( + payload, ["name", "uid", "layer"] + ) + code, response = send_request( + connection, version, "show-" + api_call_object, payload_for_show + ) + exist_action = response["action"]["name"] + if exist_action.lower() != payload["action"].lower(): + if ( + payload["action"].lower() != "Apply Layer".lower() + or exist_action.lower() != "Inner Layer".lower() + ): return False # here the action is equals, so check the position param - if not is_equals_with_position_param(payload, connection, version, api_call_object): + if not is_equals_with_position_param( + payload, connection, version, api_call_object + ): return False return True @@ -679,44 +1314,82 @@ def is_equals_with_all_params(payload, connection, version, api_call_object, is_ # handle api call for rule def api_call_for_rule(module, api_call_object): - is_access_rule = True if 'access' in api_call_object else False + is_access_rule = True if "access" in api_call_object else False payload = get_payload_from_parameters(module.params) connection = Connection(module._socket_path) version = get_version(module) - result = {'changed': False} + result = {"changed": False} if module.check_mode: return result if is_access_rule: - copy_payload_without_some_params = extract_payload_without_some_params(payload, ['action', 'position', 'search_entire_rulebase']) + copy_payload_without_some_params = extract_payload_without_some_params( + payload, ["action", "position", "search_entire_rulebase"] + ) else: - copy_payload_without_some_params = extract_payload_without_some_params(payload, ['position']) - payload_for_equals = {'type': api_call_object, 'params': copy_payload_without_some_params} - equals_code, equals_response = send_request(connection, version, 'equals', payload_for_equals) - result['checkpoint_session_uid'] = connection.get_session_uid() + copy_payload_without_some_params = extract_payload_without_some_params( + payload, ["position"] + ) + payload_for_equals = { + "type": api_call_object, + "params": copy_payload_without_some_params, + } + equals_code, equals_response = send_request( + connection, version, "equals", payload_for_equals + ) + result["checkpoint_session_uid"] = connection.get_session_uid() handle_equals_failure(module, equals_code, equals_response) - if module.params['state'] == 'present': + if module.params["state"] == "present": if equals_code == 200: - if equals_response['equals']: - if not is_equals_with_all_params(payload, connection, version, api_call_object, is_access_rule): - equals_response['equals'] = False + if equals_response["equals"]: + if not is_equals_with_all_params( + payload, + connection, + version, + api_call_object, + is_access_rule, + ): + equals_response["equals"] = False # else objects are equals and there is no need for set request - if not equals_response['equals']: + if not equals_response["equals"]: # if user insert param 'position' and needed to use the 'set' command, change the param name to 'new-position' - if 'position' in payload: - payload['new-position'] = payload['position'] - del payload['position'] - if 'search-entire-rulebase' in payload: - del payload['search-entire-rulebase'] - handle_call_and_set_result(connection, version, 'set-' + api_call_object, payload, module, result) + if "position" in payload: + payload["new-position"] = payload["position"] + del payload["position"] + if "search-entire-rulebase" in payload: + del payload["search-entire-rulebase"] + handle_call_and_set_result( + connection, + version, + "set-" + api_call_object, + payload, + module, + result, + ) elif equals_code == 404: - if 'search-entire-rulebase' in payload: - del payload['search-entire-rulebase'] - handle_call_and_set_result(connection, version, 'add-' + api_call_object, payload, module, result) - elif module.params['state'] == 'absent': - handle_delete(equals_code, payload, delete_params, connection, version, api_call_object, module, result) + if "search-entire-rulebase" in payload: + del payload["search-entire-rulebase"] + handle_call_and_set_result( + connection, + version, + "add-" + api_call_object, + payload, + module, + result, + ) + elif module.params["state"] == "absent": + handle_delete( + equals_code, + payload, + delete_params, + connection, + version, + api_call_object, + module, + result, + ) return result @@ -724,20 +1397,23 @@ def api_call_for_rule(module, api_call_object): # check if call is in plural form def call_is_plural(api_call_object, payload): is_plural = False - if 'access' in api_call_object and payload.get("layer") is None: + if "access" in api_call_object and payload.get("layer") is None: is_plural = True - elif 'threat' in api_call_object and payload.get("layer") is None: + elif "threat" in api_call_object and payload.get("layer") is None: is_plural = True - elif 'nat' in api_call_object \ - and payload.get("name") is None \ - and payload.get("uid") is None \ - and payload.get("rule-number") is None: + elif ( + "nat" in api_call_object + and payload.get("name") is None + and payload.get("rule-number") is None + ): is_plural = True return is_plural # handle api call facts for rule -def api_call_facts_for_rule(module, api_call_object, api_call_object_plural_version): +def api_call_facts_for_rule( + module, api_call_object, api_call_object_plural_version +): payload = get_payload_from_parameters(module.params) connection = Connection(module._socket_path) version = get_version(module) @@ -746,62 +1422,459 @@ def api_call_facts_for_rule(module, api_call_object, api_call_object_plural_vers if call_is_plural(api_call_object, payload): api_call_object = api_call_object_plural_version - response = handle_call(connection, version, 'show-' + api_call_object, payload, module, False, False) + response = handle_call( + connection, + version, + "show-" + api_call_object, + payload, + module, + False, + False, + ) result = {api_call_object: response} return result # The code from here till EOF will be deprecated when Rikis' modules will be deprecated -checkpoint_argument_spec = dict(auto_publish_session=dict(type='bool', default=True), - policy_package=dict(type='str', default='standard'), - auto_install_policy=dict(type='bool', default=True), - targets=dict(type='list') - ) +# checkpoint_argument_spec = dict( +# auto_publish_session=dict(type="bool", default=True), +# policy_package=dict(type="str", default="standard"), +# auto_install_policy=dict(type="bool", default=True), +# targets=dict(type="list"), +# ) def publish(connection, uid=None): payload = None if uid: - payload = {'uid': uid} + payload = {"uid": uid} - connection.send_request('/web_api/publish', payload) + connection.send_request("/web_api/publish", payload) def discard(connection, uid=None): payload = None if uid: - payload = {'uid': uid} + payload = {"uid": uid} - connection.send_request('/web_api/discard', payload) + connection.send_request("/web_api/discard", payload) def install_policy(connection, policy_package, targets): - payload = {'policy-package': policy_package, - 'targets': targets} + payload = {"policy-package": policy_package, "targets": targets} - connection.send_request('/web_api/install-policy', payload) + connection.send_request("/web_api/install-policy", payload) -def prepare_rule_params_for_execute_module(rule, module_args, position, below_rule_name): - rule['layer'] = module_args['layer'] - if 'details_level' in module_args.keys(): - rule['details_level'] = module_args['details_level'] - if 'state' not in rule.keys() or ('state' in rule.keys() and rule['state'] != 'absent'): +def prepare_rule_params_for_execute_module( + rule, module_args, position, below_rule_name +): + rule["layer"] = module_args["layer"] + if "details_level" in module_args.keys(): + rule["details_level"] = module_args["details_level"] + if "state" not in rule.keys() or ( + "state" in rule.keys() and rule["state"] != "absent" + ): if below_rule_name: - relative_position = {'relative_position': {'below': below_rule_name}} + relative_position = { + "relative_position": {"below": below_rule_name} + } rule.update(relative_position) else: - rule['position'] = position + rule["position"] = position position = position + 1 - below_rule_name = rule['name'] + below_rule_name = rule["name"] return rule, position, below_rule_name def check_if_to_publish_for_action(result, module_args): - to_publish = ('auto_publish_session' in module_args.keys() and module_args['auto_publish_session']) and \ - ('changed' in result.keys() and result['changed'] is True) and ('failed' not in result.keys() or - result['failed'] is False) + to_publish = ( + ( + "auto_publish_session" in module_args.keys() + and module_args["auto_publish_session"] + ) + and ("changed" in result.keys() and result["changed"] is True) + and ("failed" not in result.keys() or result["failed"] is False) + ) return to_publish + + +class CheckPointRequest(object): + def __init__( + self, + module=None, + connection=None, + headers=None, + not_rest_data_keys=None, + task_vars=None, + ): + self.module = module + if module: + # This will be removed, once all of the available modules + # are moved to use action plugin design, as otherwise test + # would start to complain without the implementation. + self.connection = Connection(self.module._socket_path) + elif connection: + self.connection = connection + try: + self.connection.load_platform_plugins( + "check_point.mgmt.checkpoint" + ) + self.connection.set_options(var_options=task_vars) + except ConnectionError: + raise + # This allows us to exclude specific argspec keys from being included by + # the rest data that don't follow the deepsec_* naming convention + if not_rest_data_keys: + self.not_rest_data_keys = not_rest_data_keys + else: + self.not_rest_data_keys = [] + self.not_rest_data_keys.append("validate_certs") + self.headers = headers if headers else BASE_HEADERS + + # wait for task + def wait_for_task(self, version, connection, task_id): + task_id_payload = {"task-id": task_id, "details-level": "full"} + task_complete = False + minutes_until_timeout = 30 + # if module.params['wait_for_task_timeout'] is not None and module.params['wait_for_task_timeout'] >= 0: + # minutes_until_timeout = module.params['wait_for_task_timeout'] + max_num_iterations = minutes_until_timeout * 30 + current_iteration = 0 + + # As long as there is a task in progress + while not task_complete and current_iteration < max_num_iterations: + current_iteration += 1 + # Check the status of the task + code, response = send_request( + connection, version, "show-task", task_id_payload + ) + + attempts_counter = 0 + while code != 200: + if attempts_counter < 5: + attempts_counter += 1 + time.sleep(2) + code, response = send_request( + connection, version, "show-task", task_id_payload + ) + else: + response["message"] = ( + "ERROR: Failed to handle asynchronous tasks as synchronous, tasks result is" + " undefined. " + response["message"] + ) + _fail_json(parse_fail_message(code, response)) + + # Count the number of tasks that are not in-progress + completed_tasks = 0 + for task in response["tasks"]: + if task["status"] == "failed": + _fail_json( + "Task {0} with task id {1} failed. Look at the logs for more details".format( + task["task-name"], task["task-id"] + ) + ) + if task["status"] == "in progress": + break + completed_tasks += 1 + + # Are we done? check if all tasks are completed + if completed_tasks == len(response["tasks"]): + task_complete = True + else: + time.sleep(2) # Wait for two seconds + if not task_complete: + _fail_json( + "ERROR: Timeout. Task-id: {0}.".format( + task_id_payload["task-id"] + ) + ) + else: + return response + + # if failed occurred, in some cases we want to discard changes before exiting. We also notify the user about the `discard` + def discard_and_fail( + self, code, response, connection, version, session_uid + ): + discard_code, discard_response = send_request( + connection, version, "discard" + ) + if discard_code != 200: + try: + _fail_json( + parse_fail_message(code, response) + + " Failed to discard session {0}" + " with error {1} with message {2}".format( + session_uid, + discard_code, + discard_response, + ) + ) + except Exception: + # Read-only mode without UID + _fail_json( + parse_fail_message(code, response) + + " Failed to discard session" + " with error {0} with message {1}".format( + discard_code, discard_response + ) + ) + + _fail_json( + "Checkpoint session with ID: {0}".format(session_uid) + + ", " + + parse_fail_message(code, response) + + " Unpublished changes were discarded" + ) + + # handle publish command, and wait for it to end if the user asked so + def handle_publish(self, connection, version, payload): + publish_code, publish_response = send_request( + connection, version, "publish" + ) + if publish_code != 200: + self.discard_and_fail( + publish_code, publish_response, connection, version + ) + if payload.get("wait_for_task"): + self.wait_for_task( + version, connection, publish_response["task-id"] + ) + + # handle call + def handle_call( + self, + connection, + version, + api_url, + payload, + to_discard_on_failure, + session_uid=None, + to_publish=False, + ): + code, response = send_request(connection, version, api_url, payload) + if code != 200: + if to_discard_on_failure: + self.discard_and_fail( + code, response, connection, version, session_uid + ) + elif "object_not_found" not in response.get( + "code" + ) and "not found" not in response.get("message"): + raise _fail_json( + "Checkpoint session with ID: {0}".format(session_uid) + + ", " + + parse_fail_message(code, response) + ) + else: + if "wait_for_task" in payload and payload["wait_for_task"]: + if "task-id" in response: + response = self.wait_for_task( + version, connection, response["task-id"] + ) + elif "tasks" in response: + for task in response["tasks"]: + if "task-id" in task: + task_id = task["task-id"] + response[task_id] = self.wait_for_task( + version, connection, task["task-id"] + ) + del response["tasks"] + + if to_publish: + self.handle_publish(connection, version, payload) + return code, response + + # handle the call and set the result with 'changed' and teh response + def handle_add_and_set_result( + self, + connection, + version, + api_url, + payload, + session_uid, + auto_publish_session=False, + ): + code, response = self.handle_call( + connection, + version, + api_url, + payload, + True, + session_uid, + auto_publish_session, + ) + result = {"code": code, "response": response, "changed": True} + return result + + # handle delete + def handle_delete(self, connection, payload, api_call_object, version): + auto_publish = False + payload_for_equals = {"type": api_call_object, "params": payload} + equals_code, equals_response = send_request( + connection, version, "equals", payload_for_equals + ) + session_uid = connection.get_session_uid() + if equals_code == 200: + if payload.get("auto_publish_session"): + auto_publish = payload["auto_publish_session"] + del payload["auto_publish_session"] + code, response = self.handle_call( + connection, + version, + "delete-" + api_call_object, + payload, + True, + session_uid, + auto_publish, + ) + result = {"code": code, "response": response, "changed": True} + else: + # else equals_code is 404 and no need to delete because object doesn't exist + result = {"changed": False} + if result.get("response"): + result["checkpoint_session_uid"] = session_uid + return result + + # handle api call facts + def api_call_facts(self, connection, payload, api_call_object, version): + if payload.get("auto_publish_session"): + del payload["auto_publish_session"] + code, response = self.handle_call( + connection, version, api_call_object, payload, False + ) + result = {"code": code, "response": response} + return result + + # handle api call + def api_call( + self, + connection, + payload, + remove_keys, + api_call_object, + state, + equals_response, + version, + delete_params, + ): + result = {} + auto_publish_session = False + if payload.get("auto_publish_session"): + auto_publish_session = payload["auto_publish_session"] + del payload["auto_publish_session"] + session_uid = connection.get_session_uid() + if state == "merged": + if equals_response and equals_response.get("equals") is False: + payload = remove_unwanted_key(payload, remove_keys) + result = self.handle_add_and_set_result( + connection, + version, + "set-" + api_call_object, + payload, + session_uid, + auto_publish_session, + ) + elif equals_response.get("code") or equals_response.get("message"): + result = self.handle_add_and_set_result( + connection, + version, + "add-" + api_call_object, + payload, + session_uid, + auto_publish_session, + ) + elif state == "replaced": + if equals_response and equals_response.get("equals") is False: + code, response = self.handle_call( + connection, + version, + "delete-" + api_call_object, + delete_params, + True, + session_uid, + auto_publish_session, + ) + result = self.handle_add_and_set_result( + connection, + version, + "add-" + api_call_object, + payload, + session_uid, + auto_publish_session, + ) + elif equals_response.get("code") or equals_response.get("message"): + result = self.handle_add_and_set_result( + connection, + version, + "add-" + api_call_object, + payload, + session_uid, + auto_publish_session, + ) + if result.get("response"): + result["checkpoint_session_uid"] = session_uid + + return result + + # if user insert a specific version, we add it to the url + def get_version(self, payload): + return ( + ("v" + payload["version"] + "/") if payload.get("version") else "" + ) + + def _httpapi_error_handle(self, api_obj, state, **kwargs): + # FIXME - make use of handle_httperror(self, exception) where applicable + # https://docs.ansible.com/ansible/latest/network/dev_guide/developing_plugins_network.html#developing-plugins-httpapi + try: + result = {} + version = self.get_version(kwargs["data"]) + if state == "gathered": + result = self.api_call_facts( + self.connection, kwargs["data"], "show-" + api_obj, version + ) + elif state == "deleted": + result = self.handle_delete( + self.connection, kwargs["data"], api_obj, version + ) + elif state == "merged" or state == "replaced": + payload_for_equals = { + "type": api_obj, + "params": kwargs["data"], + } + equals_code, equals_response = send_request( + self.connection, version, "equals", payload_for_equals + ) + if equals_response.get("equals"): + result = { + "code": equals_code, + "response": equals_response, + "changed": False, + } + else: + result = self.api_call( + self.connection, + kwargs["data"], + kwargs["remove_keys"], + api_obj, + state, + equals_response, + version, + kwargs["delete_params"], + ) + except ConnectionError as e: + raise _fail_json("connection error occurred: {0}".format(e)) + except CertificateError as e: + raise _fail_json("certificate error occurred: {0}".format(e)) + except ValueError as e: + raise _fail_json("certificate not found: {0}".format(e)) + # This fn. will return both code and response, once all of the available modules + # are moved to use action plugin design, as otherwise test + # would start to complain without the implementation. + return result + + def post(self, obj, state, **kwargs): + return self._httpapi_error_handle(obj, state, **kwargs) diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_abort_get_interfaces.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_abort_get_interfaces.py new file mode 100644 index 000000000..ae87643be --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_abort_get_interfaces.py @@ -0,0 +1,83 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_abort_get_interfaces +short_description: Attempt to abort an on-going "get-interfaces" operation. +description: + - Attempt to abort an on-going "get-interfaces" operation. + This API might fail if the "get-interfaces" operation is in its final stage. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + task_id: + description: + - get-interfaces task UID. + type: str + force_cleanup: + description: + - Forcefully abort the "get-interfaces" task. + type: bool +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: abort-get-interfaces + cp_mgmt_abort_get_interfaces: + task_id: 45b185e7-9ccd-4971-b74b-d212282f8f96 +""" + +RETURN = """ +cp_mgmt_abort_get_interfaces: + description: The checkpoint abort-get-interfaces output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + task_id=dict(type='str'), + force_cleanup=dict(type='bool') + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "abort-get-interfaces" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_layer.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_layer.py index dde5b24b6..46bdab564 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_layer.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_layer.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["deprecated"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -34,6 +36,10 @@ description: - All operations are performed over Web Services API. version_added: "1.0.0" author: "Or Soffer (@chkp-orso)" +deprecated: + alternative: cp_mgmt_access_layers + why: Newer and updated modules released with more functionality. + removed_at_date: '2024-11-01' options: name: description: @@ -133,39 +139,80 @@ cp_mgmt_access_layer: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - add_default_rule=dict(type='bool'), - applications_and_url_filtering=dict(type='bool'), - content_awareness=dict(type='bool'), - detect_using_x_forward_for=dict(type='bool'), - firewall=dict(type='bool'), - implicit_cleanup_action=dict(type='str', choices=['drop', 'accept']), - mobile_access=dict(type='bool'), - shared=dict(type='bool'), - tags=dict(type='list', elements='str'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + add_default_rule=dict(type="bool"), + applications_and_url_filtering=dict(type="bool"), + content_awareness=dict(type="bool"), + detect_using_x_forward_for=dict(type="bool"), + firewall=dict(type="bool"), + implicit_cleanup_action=dict(type="str", choices=["drop", "accept"]), + mobile_access=dict(type="bool"), + shared=dict(type="bool"), + tags=dict(type="list", elements="str"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'access-layer' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "access-layer" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_layer_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_layer_facts.py index 40e98e990..999c9b8ff 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_layer_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_layer_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -98,30 +100,41 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )) + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "access-layer" api_call_object_plural_version = "access-layers" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_layers.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_layers.py new file mode 100644 index 000000000..78eeb2b70 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_layers.py @@ -0,0 +1,456 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright 2022 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +""" +The module file for cp_mgmt_add_access_layers +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +module: cp_mgmt_access_layers +short_description: Manages ACCESS LAYERS resource module +description: + - This resource module allows for addition, deletion, or modification of CP Access Layers. + - This resource module also takes care of gathering Access layer config facts +version_added: "5.0.0" +author: Ansible Security Automation Team (@justjais) <https://github.com/ansible-security> +options: + config: + description: A dictionary of ACCESS LAYERS options + type: dict + suboptions: + name: + description: Object name. Must be unique in the domain. + type: str + add_default_rule: + description: Indicates whether to include a cleanup rule in the new layer. + type: bool + applications_and_url_filtering: + description: Whether to enable Applications & URL Filtering blade on the layer. + type: bool + content_awareness: + description: Whether to enable Content Awareness blade on the layer. + type: bool + detect_using_x_forward_for: + description: Whether to use X-Forward-For HTTP header, which is added by the proxy + server to keep track of the original source IP. + type: bool + firewall: + description: Whether to enable Firewall blade on the layer. + type: bool + implicit_cleanup_action: + description: The default "catch-all" action for traffic that does not match + any explicit or implied rules in the layer. + type: str + choices: + - drop + - accept + mobile_access: + description: Whether to enable Mobile Access blade on the layer. + type: bool + shared: + description: Whether this layer is shared. + type: bool + tags: + description: Collection of tag identifiers. + type: list + elements: str + color: + description: Color of the object. Should be one of existing colors. + type: str + choices: + - aquamarine + - black + - blue + - crete blue + - burlywood + - cyan + - dark green + - khaki + - orchid + - dark orange + - dark sea green + - pink + - turquoise + - dark blue + - firebrick + - brown + - forest green + - gold + - dark gold + - gray + - dark gray + - light green + - lemon chiffon + - coral + - sea green + - sky blue + - magenta + - purple + - slate blue + - violet red + - navy blue + - olive + - orange + - red + - sienna + - yellow + comments: + description: Comments string. + type: str + details_level: + description: The level of detail for some of the fields in the response can + vary from showing only the UID value of the object to a fully detailed representation + of the object. + type: str + choices: + - uid + - standard + - full + ignore_warnings: + description: Apply changes ignoring warnings. + type: bool + ignore_errors: + description: Apply changes ignoring errors. You won't be able to publish such + a changes. If ignore-warnings flag was omitted - warnings will also be ignored. + type: bool + limit: + description: + - The maximal number of returned results. + - NOTE, this parameter is a valid parameter only for the GATHERED state, for config states + like, MERGED, REPLACED, and DELETED state it won't be applicable. + type: int + offset: + description: + - Number of the results to initially skip. + - NOTE, this parameter is a valid parameter only for the GATHERED state, for config states + like, MERGED, REPLACED, and DELETED state it won't be applicable. + type: int + order: + description: + - Sorts results by the given field. By default the results are sorted in the ascending order by name. + This parameter is relevant only for getting few objects. + - NOTE, this parameter is a valid parameter only for the GATHERED state, for config states + like, MERGED, REPLACED, and DELETED state it won't be applicable. + type: list + elements: dict + suboptions: + ASC: + description: + - Sorts results by the given field in ascending order. + type: str + DESC: + description: + - Sorts results by the given field in descending order. + type: str + round_trip: + description: + - If set to True, the round trip will filter out the module parameters from the response param, + which will enable the user to fire the config request using the structured gathered data. + - NOTE, this parameter makes relevance only with the GATHERED state, as for config states like, + MERGED, REPLACED, and DELETED state it won't make any config updates, + as it's not a module config parameter. + type: bool + auto_publish_session: + description: + - Publish the current session if changes have been performed + after task completes. + type: bool + version: + description: + - Version of checkpoint. If not given one, the latest version taken. + type: str + state: + description: + - The state the configuration should be left in + - The state I(gathered) will get the module API configuration from the device + and transform it into structured data in the format as per the module argspec + and the value is returned in the I(gathered) key within the result. + type: str + choices: + - merged + - replaced + - gathered + - deleted +""" + +EXAMPLES = """ + +# Using MERGED state +# ------------------- + +- name: Merge Access-layer config + cp_mgmt_access_layers: + state: merged + config: + name: New Layer 1 + add_default_rule: true + applications_and_url_filtering: true + content_awareness: true + detect_using_x_forward_for: false + firewall: true + implicit_cleanup_action: drop + mobile_access: true + shared: false + tags: + - test_layer + color: aquamarine + comments: test description + details_level: full + ignore_warnings: false + ignore_errors: false + round_trip: true + +# RUN output: +# ----------- + +# mgmt_access_layers: +# after: +# applications_and_url_filtering: true +# color: aquamarine +# comments: test description +# content_awareness: true +# detect_using_x_forward_for: false +# domain: SMC User +# firewall: true +# icon: ApplicationFirewall/rulebase +# implicit_cleanup_action: drop +# mobile_access: true +# name: New Layer 1 +# shared: false +# tags: +# - test_layer +# uid: eb74d7fe-81a6-4e6c-aedb-d2d6599f965e +# before: {} + +# Using REPLACED state +# -------------------- + +- name: Replace Access-layer config + cp_mgmt_access_layers: + state: replaced + config: + name: New Layer 1 + add_default_rule: true + applications_and_url_filtering: true + content_awareness: false + detect_using_x_forward_for: false + firewall: true + implicit_cleanup_action: drop + mobile_access: true + shared: true + tags: + - test_layer_replaced + color: cyan + comments: test REPLACE description + details_level: full + ignore_warnings: false + ignore_errors: false + round_trip: true + +# RUN output: +# ----------- + +# mgmt_access_layers: +# after: +# applications_and_url_filtering: true +# color: cyan +# comments: test REPLACE description +# content_awareness: false +# detect_using_x_forward_for: false +# domain: SMC User +# firewall: true +# icon: ApplicationFirewall/sharedrulebase +# implicit_cleanup_action: drop +# mobile_access: true +# name: New Layer 1 +# shared: true +# tags: +# - test_layer_replaced +# uid: a4e2bbc1-ec94-4b85-9b00-07ad1279ac12 +# before: +# applications_and_url_filtering: true +# color: aquamarine +# comments: test description +# content_awareness: true +# detect_using_x_forward_for: false +# firewall: true +# icon: ApplicationFirewall/rulebase +# implicit_cleanup_action: drop +# mobile_access: true +# name: New Layer 1 +# shared: false +# tags: +# - test_layer + +# Using GATHERED state +# -------------------- + +# 1. With Round Trip set to True + +- name: Gather Access-layers config by Name + cp_mgmt_access_layers: + state: gathered + config: + name: New Layer 1 + round_trip: true + +# RUN output: +# ----------- + +# gathered: +# applications_and_url_filtering: true +# color: aquamarine +# comments: test description +# content_awareness: true +# detect_using_x_forward_for: false +# domain: SMC User +# firewall: true +# icon: ApplicationFirewall/rulebase +# implicit_cleanup_action: drop +# mobile_access: true +# name: New Layer 1 +# shared: false +# tags: +# - test_layer +# uid: eb74d7fe-81a6-4e6c-aedb-d2d6599f965e + +# 2. With Round Trip set to False which is the default behaviour + +- name: Gather Access-layers config by Name + cp_mgmt_access_layers: + state: gathered + config: + name: New Layer 1 + +# RUN output: +# ----------- + +# gathered: +# applications_and_url_filtering: true +# color: turquoise +# comments: test description +# content_awareness: true +# detect_using_x_forward_for: false +# domain: +# domain-type: domain +# name: SMC User +# uid: 41e821a0-3720-11e3-aa6e-0800200c9fde +# firewall: true +# icon: ApplicationFirewall/rulebase +# implicit_cleanup_action: drop +# meta-info: +# creation-time: +# iso-8601: 2022-11-21T07:34+0000 +# posix: 1669016073937 +# creator: admin +# last-modifier: admin +# last-modify-time: +# iso-8601: 2022-11-21T07:34+0000 +# posix: 1669016074765 +# lock: unlocked +# validation-state: ok +# mobile_access: true +# name: New Layer 1 +# read-only: false +# shared: false +# tags: +# - domain: +# domain-type: domain +# name: SMC User +# uid: 41e821a0-3720-11e3-aa6e-0800200c9fde +# name: test_layer +# type: tag +# uid: 22cc8b0d-984f-47de-b1f6-276b3377eb0c +# type: access-layer +# uid: a54e47d3-22fc-4aff-90d9-f644aa4a1522 + +# 3. Gather ALL threat-layer config with DESC order filter + +- name: To Gather ALL access-layer and order by Name + cp_mgmt_access_layers: + config: + order: + - DESC: name + state: gathered + +# RUN output: +# ----------- + +# gathered: +# - domain: +# domain-type: domain +# name: SMC User +# uid: 41e821a0-3720-11e3-aa6e-0800200c9fde +# name: New Layer 1 +# type: access-layer +# uid: a54e47d3-22fc-4aff-90d9-f644aa4a1522 +# - domain: +# domain-type: domain +# name: SMC User +# uid: 41e821a0-3720-11e3-aa6e-0800200c9fde +# name: Network +# type: access-layer +# uid: 63b7fe60-76d2-4287-bca5-21af87337b0a + +# Using DELETED state +# ------------------- + +- name: Delete Access-layer config by Name + cp_mgmt_access_layers: + state: deleted + config: + name: New Layer 1 + +# RUN output: +# ----------- + +# mgmt_access_layers: +# after: {} +# before: +# applications_and_url_filtering: true +# color: cyan +# comments: test REPLACE description +# content_awareness: false +# detect_using_x_forward_for: false +# domain: SMC User +# firewall: true +# icon: ApplicationFirewall/sharedrulebase +# implicit_cleanup_action: drop +# mobile_access: true +# name: New Layer 1 +# shared: true +# tags: +# - test_layer_replaced +# uid: a4e2bbc1-ec94-4b85-9b00-07ad1279ac12 +""" + +RETURN = """ +before: + description: The configuration prior to the module execution. + returned: when state is I(merged), I(replaced), I(deleted) + type: dict + sample: > + This output will always be in the same format as the + module argspec. +after: + description: The resulting configuration after module execution. + returned: when changed + type: dict + sample: > + This output will always be in the same format as the + module argspec. +gathered: + description: Facts about the network resource gathered from the remote device as structured data. + returned: when state is I(gathered) + type: dict + sample: > + This output will always be in the same format as the + module argspec. +""" diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_point_name.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_point_name.py new file mode 100644 index 000000000..d32f0232d --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_point_name.py @@ -0,0 +1,165 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_access_point_name +short_description: Manages access-point-name objects on Checkpoint over Web Services API +description: + - Manages access-point-name objects on Checkpoint devices including creating, updating and removing objects. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + name: + description: + - Object name. + type: str + required: True + apn: + description: + - APN name. + type: str + enforce_end_user_domain: + description: + - Enable enforce end user domain. + type: bool + block_traffic_other_end_user_domains: + description: + - Block MS to MS traffic between this and other APN end user domains. + type: bool + block_traffic_this_end_user_domain: + description: + - Block MS to MS traffic within this end user domain. + type: bool + end_user_domain: + description: + - End user domain name or UID. + type: str + tags: + description: + - Collection of tag identifiers. + type: list + elements: str + color: + description: + - Color of the object. Should be one of existing colors. + type: str + choices: ['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green', + 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', + 'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', 'yellow'] + comments: + description: + - Comments string. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + groups: + description: + - Collection of group identifiers. + type: list + elements: str + ignore_warnings: + description: + - Apply changes ignoring warnings. + type: bool + ignore_errors: + description: + - Apply changes ignoring errors. You won't be able to publish such a changes. If ignore-warnings flag was omitted - warnings will also be ignored. + type: bool +extends_documentation_fragment: check_point.mgmt.checkpoint_objects +""" + +EXAMPLES = """ +- name: add-access-point-name + cp_mgmt_access_point_name: + name: myaccesspointname + apn: apnname + end_user_domain: All_Internet + enforce_end_user_domain: 'True' + state: present + +- name: set-access-point-name + cp_mgmt_access_point_name: + name: myaccesspointname + block_traffic_other_end_user_domains: 'False' + block_traffic_this_end_user_domain: 'False' + enforce_end_user_domain: 'True' + state: present + +- name: delete-access-point-name + cp_mgmt_access_point_name: + name: myaccesspointname + state: absent +""" + +RETURN = """ +cp_mgmt_access_point_name: + description: The checkpoint object created or updated. + returned: always, except when deleting the object. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call + + +def main(): + argument_spec = dict( + name=dict(type='str', required=True), + apn=dict(type='str'), + enforce_end_user_domain=dict(type='bool'), + block_traffic_other_end_user_domains=dict(type='bool'), + block_traffic_this_end_user_domain=dict(type='bool'), + end_user_domain=dict(type='str'), + tags=dict(type='list', elements='str'), + color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', + 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', + 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', + 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', + 'yellow']), + comments=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + groups=dict(type='list', elements='str'), + ignore_warnings=dict(type='bool'), + ignore_errors=dict(type='bool') + ) + argument_spec.update(checkpoint_argument_spec_for_objects) + + module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + api_call_object = 'access-point-name' + + result = api_call(module, api_call_object) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_point_name_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_point_name_facts.py new file mode 100644 index 000000000..7a242d8cd --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_point_name_facts.py @@ -0,0 +1,144 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_access_point_name_facts +short_description: Get access-point-name objects facts on Checkpoint over Web Services API +description: + - Get access-point-name objects facts on Checkpoint devices. + - All operations are performed over Web Services API. + - This module handles both operations, get a specific object and get several objects, + For getting a specific object use the parameter 'name'. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + name: + description: + - Object name. + This parameter is relevant only for getting a specific object. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + filter: + description: + - Search expression to filter objects by. The provided text should be exactly the same as it would be given in SmartConsole Object Explorer. The + logical operators in the expression ('AND', 'OR') should be provided in capital letters. The search involves both a IP search and a textual search in + name, comment, tags etc. + type: str + limit: + description: + - The maximal number of returned results. + This parameter is relevant only for getting few objects. + type: int + offset: + description: + - Number of the results to initially skip. + This parameter is relevant only for getting few objects. + type: int + order: + description: + - Sorts the results by search criteria. Automatically sorts the results by Name, in the ascending order. + This parameter is relevant only for getting few objects. + type: list + elements: dict + suboptions: + ASC: + description: + - Sorts results by the given field in ascending order. + type: str + choices: ['name'] + DESC: + description: + - Sorts results by the given field in descending order. + type: str + choices: ['name'] + show_membership: + description: + - Indicates whether to calculate and show "groups" field for every object in reply. + type: bool + domains_to_process: + description: + - Indicates which domains to process the commands on. It cannot be used with the details-level full, must be run from the System Domain only and + with ignore-warnings true. Valid values are, CURRENT_DOMAIN, ALL_DOMAINS_ON_THIS_SERVER. + type: list + elements: str +extends_documentation_fragment: check_point.mgmt.checkpoint_facts +""" + +EXAMPLES = """ +- name: show-access-point-name + cp_mgmt_access_point_name_facts: + name: myaccesspointname + +- name: show-access-point-names + cp_mgmt_access_point_name_facts: + limit: 10 +""" + +RETURN = """ +ansible_facts: + description: The checkpoint object facts. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts + + +def main(): + argument_spec = dict( + name=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + filter=dict(type='str'), + limit=dict(type='int'), + offset=dict(type='int'), + order=dict(type='list', elements="dict", options=dict( + ASC=dict(type='str', choices=['name']), + DESC=dict(type='str', choices=['name']) + )), + show_membership=dict(type='bool'), + domains_to_process=dict(type='list', elements="str") + ) + argument_spec.update(checkpoint_argument_spec_for_facts) + + module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + + api_call_object = "access-point-name" + api_call_object_plural_version = "access-point-names" + + result = api_call_facts(module, api_call_object, api_call_object_plural_version) + module.exit_json(ansible_facts=result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_role.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_role.py index 1c9114484..4f2a8259e 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_role.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_role.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -161,51 +163,104 @@ cp_mgmt_access_role: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - machines_list=dict(type='list', elements='dict', options=dict( - source=dict(type='str'), - selection=dict(type='list', elements='str'), - base_dn=dict(type='str') - )), - machines=dict(type='str', choices=['any', 'all identified']), - networks=dict(type='list', elements='str'), - remote_access_clients=dict(type='str'), - tags=dict(type='list', elements='str'), - users_list=dict(type='list', elements='dict', options=dict( - source=dict(type='str'), - selection=dict(type='list', elements='str'), - base_dn=dict(type='str') - )), - users=dict(type='str', choices=['any', 'all identified']), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + machines_list=dict( + type="list", + elements="dict", + options=dict( + source=dict(type="str"), + selection=dict(type="list", elements="str"), + base_dn=dict(type="str"), + ), + ), + machines=dict(type="str", choices=["any", "all identified"]), + networks=dict(type="list", elements="str"), + remote_access_clients=dict(type="str"), + tags=dict(type="list", elements="str"), + users_list=dict( + type="list", + elements="dict", + options=dict( + source=dict(type="str"), + selection=dict(type="list", elements="str"), + base_dn=dict(type="str"), + ), + ), + users=dict(type="str", choices=["any", "all identified"]), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'access-role' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "access-role" if module.params["machines_list"] is not None: if module.params["machines"] is not None: - raise AssertionError("The use of both 'machines_list' and 'machines' arguments isn't allowed") + raise AssertionError( + "The use of both 'machines_list' and 'machines' arguments isn't allowed" + ) module.params["machines"] = module.params["machines_list"] module.params.pop("machines_list") if module.params["users_list"] is not None: if module.params["users"] is not None: - raise AssertionError("The use of both 'users_list' and 'users' arguments isn't allowed") + raise AssertionError( + "The use of both 'users_list' and 'users' arguments isn't allowed" + ) module.params["users"] = module.params["users_list"] module.params.pop("users_list") @@ -213,5 +268,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_role_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_role_facts.py index 6a8805e8c..37dfd4529 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_role_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_role_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -96,30 +98,41 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )) + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "access-role" api_call_object_plural_version = "access-roles" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_rule.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_rule.py index 11f359fe0..ca26a2933 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_rule.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_rule.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -325,92 +327,158 @@ cp_mgmt_access_rule: from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.connection import Connection -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call, api_call_for_rule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, + api_call_for_rule, +) def main(): argument_spec = dict( - layer=dict(type='str'), - position=dict(type='str'), - relative_position=dict(type='dict', options=dict( - below=dict(type='str'), - above=dict(type='str'), - top=dict(type='str'), - bottom=dict(type='str') - )), - search_entire_rulebase=dict(type='bool', default=False), - name=dict(type='str', required=True), - action=dict(type='str'), - action_settings=dict(type='dict', options=dict( - enable_identity_captive_portal=dict(type='bool'), - limit=dict(type='str') - )), - content=dict(type='list', elements='dict'), - content_direction=dict(type='str', choices=['any', 'up', 'down']), - content_negate=dict(type='bool'), - custom_fields=dict(type='dict', options=dict( - field_1=dict(type='str'), - field_2=dict(type='str'), - field_3=dict(type='str') - )), - destination=dict(type='list', elements='str'), - destination_negate=dict(type='bool'), - enabled=dict(type='bool'), - inline_layer=dict(type='str'), - install_on=dict(type='list', elements='str'), - service=dict(type='list', elements='str'), - service_negate=dict(type='bool'), - source=dict(type='list', elements='str'), - source_negate=dict(type='bool'), - time=dict(type='list', elements='str'), - track=dict(type='dict', options=dict( - accounting=dict(type='bool'), - alert=dict(type='str', choices=['none', 'alert', 'snmp', 'mail', 'user alert 1', 'user alert 2', 'user alert 3']), - enable_firewall_session=dict(type='bool'), - per_connection=dict(type='bool'), - per_session=dict(type='bool'), - type=dict(type='str') - )), - user_check=dict(type='dict', options=dict( - confirm=dict(type='str', choices=['per rule', 'per category', 'per application/site', 'per data type']), - custom_frequency=dict(type='dict', options=dict( - every=dict(type='int'), - unit=dict(type='str', choices=['hours', 'days', 'weeks', 'months']) - )), - frequency=dict(type='str', choices=['once a day', 'once a week', 'once a month', 'custom frequency...']), - interaction=dict(type='str') - )), - vpn_list=dict(type='list', elements='dict', options=dict( - community=dict(type='list', elements='str'), - directional=dict(type='list', elements='dict', options=dict( - to=dict(type='str') - )) - )), - vpn=dict(type='str', choices=['Any', 'All_GwToGw']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + layer=dict(type="str"), + position=dict(type="str"), + relative_position=dict( + type="dict", + options=dict( + below=dict(type="str"), + above=dict(type="str"), + top=dict(type="str"), + bottom=dict(type="str"), + ), + ), + search_entire_rulebase=dict(type="bool", default=False), + name=dict(type="str", required=True), + action=dict(type="str"), + action_settings=dict( + type="dict", + options=dict( + enable_identity_captive_portal=dict(type="bool"), + limit=dict(type="str"), + ), + ), + content=dict(type="list", elements="dict"), + content_direction=dict(type="str", choices=["any", "up", "down"]), + content_negate=dict(type="bool"), + custom_fields=dict( + type="dict", + options=dict( + field_1=dict(type="str"), + field_2=dict(type="str"), + field_3=dict(type="str"), + ), + ), + destination=dict(type="list", elements="str"), + destination_negate=dict(type="bool"), + enabled=dict(type="bool"), + inline_layer=dict(type="str"), + install_on=dict(type="list", elements="str"), + service=dict(type="list", elements="str"), + service_negate=dict(type="bool"), + source=dict(type="list", elements="str"), + source_negate=dict(type="bool"), + time=dict(type="list", elements="str"), + track=dict( + type="dict", + options=dict( + accounting=dict(type="bool"), + alert=dict( + type="str", + choices=[ + "none", + "alert", + "snmp", + "mail", + "user alert 1", + "user alert 2", + "user alert 3", + ], + ), + enable_firewall_session=dict(type="bool"), + per_connection=dict(type="bool"), + per_session=dict(type="bool"), + type=dict(type="str"), + ), + ), + user_check=dict( + type="dict", + options=dict( + confirm=dict( + type="str", + choices=[ + "per rule", + "per category", + "per application/site", + "per data type", + ], + ), + custom_frequency=dict( + type="dict", + options=dict( + every=dict(type="int"), + unit=dict( + type="str", + choices=["hours", "days", "weeks", "months"], + ), + ), + ), + frequency=dict( + type="str", + choices=[ + "once a day", + "once a week", + "once a month", + "custom frequency...", + ], + ), + interaction=dict(type="str"), + ), + ), + vpn_list=dict( + type="list", + elements="dict", + options=dict( + community=dict(type="list", elements="str"), + directional=dict( + type="list", + elements="dict", + options=dict(to=dict(type="str")), + ), + ), + ), + vpn=dict(type="str", choices=["Any", "All_GwToGw"]), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) - argument_spec['vpn_list']['options']['directional']['options']['from'] = dict(type='str') + argument_spec["vpn_list"]["options"]["directional"]["options"][ + "from" + ] = dict(type="str") argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'access-rule' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "access-rule" if module.params["vpn_list"] is not None: if module.params["vpn"] is not None: - raise AssertionError("The use of both 'vpn_list' and 'vpn' arguments isn't allowed") + raise AssertionError( + "The use of both 'vpn_list' and 'vpn' arguments isn't allowed" + ) module.params["vpn"] = module.params["vpn_list"] module.params.pop("vpn_list") if module.params["relative_position"] is not None: if module.params["position"] is not None: - raise AssertionError("The use of both 'relative_position' and 'position' arguments isn't allowed") + raise AssertionError( + "The use of both 'relative_position' and 'position' arguments isn't allowed" + ) module.params["position"] = module.params["relative_position"] module.params.pop("relative_position") - if module.params['action'] is None and module.params['position'] is None: + if module.params["action"] is None and module.params["position"] is None: module.params.pop("search_entire_rulebase") result = api_call(module, api_call_object) else: @@ -419,5 +487,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_rule_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_rule_facts.py index 3519e6ba1..0d536ad19 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_rule_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_rule_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -193,53 +195,73 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts_for_rule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts_for_rule, +) def main(): argument_spec = dict( - name=dict(type='str'), - layer=dict(type='str'), - show_as_ranges=dict(type='bool'), - show_hits=dict(type='bool'), - hits_settings=dict(type='dict', options=dict( - from_date=dict(type='str'), - target=dict(type='str'), - to_date=dict(type='str') - )), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - filter=dict(type='str'), - filter_settings=dict(type='dict', options=dict( - search_mode=dict(type='str', choices=['general', 'packet']), - packet_search_settings=dict(type='dict', options=dict( - expand_group_members=dict(type='bool'), - expand_group_with_exclusion_members=dict(type='bool'), - match_on_any=dict(type='bool'), - match_on_group_with_exclusion=dict(type='bool'), - match_on_negate=dict(type='bool') - )) - )), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - package=dict(type='str'), - use_object_dictionary=dict(type='bool'), - dereference_group_members=dict(type='bool'), - show_membership=dict(type='bool') + name=dict(type="str"), + layer=dict(type="str"), + show_as_ranges=dict(type="bool"), + show_hits=dict(type="bool"), + hits_settings=dict( + type="dict", + options=dict( + from_date=dict(type="str"), + target=dict(type="str"), + to_date=dict(type="str"), + ), + ), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + filter=dict(type="str"), + filter_settings=dict( + type="dict", + options=dict( + search_mode=dict(type="str", choices=["general", "packet"]), + packet_search_settings=dict( + type="dict", + options=dict( + expand_group_members=dict(type="bool"), + expand_group_with_exclusion_members=dict(type="bool"), + match_on_any=dict(type="bool"), + match_on_group_with_exclusion=dict(type="bool"), + match_on_negate=dict(type="bool"), + ), + ), + ), + ), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + package=dict(type="str"), + use_object_dictionary=dict(type="bool"), + dereference_group_members=dict(type="bool"), + show_membership=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "access-rule" api_call_object_plural_version = "access-rulebase" - result = api_call_facts_for_rule(module, api_call_object, api_call_object_plural_version) + result = api_call_facts_for_rule( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_rules.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_rules.py index 1597ab281..cdc1f8aae 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_rules.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_rules.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -208,7 +210,7 @@ options: description: - N/A type: str - vpn: + vpn_list: description: - Communities or Directional. type: list @@ -218,7 +220,7 @@ options: description: - List of community name or UID. type: list - elements: dict + elements: str directional: description: - Communities directional match condition. @@ -233,6 +235,11 @@ options: description: - To community name or UID. type: str + vpn: + description: + - Any or All_GwToGw. + type: str + choices: ['Any', 'All_GwToGw'] comments: description: - Comments string. @@ -294,74 +301,144 @@ cp_mgmt_access_rules: from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.connection import Connection -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import \ - checkpoint_argument_spec_for_action_module +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_action_module, +) def main(): argument_spec = dict( - rules=dict(type='list', required=True, elements='dict', options=dict( - name=dict(type='str', required=True), - action=dict(type='str'), - action_settings=dict(type='dict', options=dict( - enable_identity_captive_portal=dict(type='bool'), - limit=dict(type='str') - )), - content=dict(type='list', elements='dict'), - content_direction=dict(type='str', choices=['any', 'up', 'down']), - content_negate=dict(type='bool'), - custom_fields=dict(type='dict', options=dict( - field_1=dict(type='str'), - field_2=dict(type='str'), - field_3=dict(type='str') - )), - destination=dict(type='list', elements='str'), - destination_negate=dict(type='bool'), - enabled=dict(type='bool'), - inline_layer=dict(type='str'), - install_on=dict(type='list', elements='str'), - service=dict(type='list', elements='str'), - service_negate=dict(type='bool'), - source=dict(type='list', elements='str'), - source_negate=dict(type='bool'), - time=dict(type='list', elements='str'), - track=dict(type='dict', options=dict( - accounting=dict(type='bool'), - alert=dict(type='str', - choices=['none', 'alert', 'snmp', 'mail', 'user alert 1', 'user alert 2', 'user alert 3']), - enable_firewall_session=dict(type='bool'), - per_connection=dict(type='bool'), - per_session=dict(type='bool'), - type=dict(type='str') - )), - user_check=dict(type='dict', options=dict( - confirm=dict(type='str', choices=['per rule', 'per category', 'per application/site', 'per data type']), - custom_frequency=dict(type='dict', options=dict( - every=dict(type='int'), - unit=dict(type='str', choices=['hours', 'days', 'weeks', 'months']) - )), - frequency=dict(type='str', - choices=['once a day', 'once a week', 'once a month', 'custom frequency...']), - interaction=dict(type='str') - )), - vpn=dict(type='list', elements='dict', options=dict( - community=dict(type='list', elements='dict'), - directional=dict(type='list', elements='dict', options=dict( - to=dict(type='str') - )) - )), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool'), - state=dict(type='str', choices=['present', 'absent'], default='present') - - )), - layer=dict(type='str', required=True), - details_level=dict(type='str', choices=['uid', 'standard', 'full']) + rules=dict( + type="list", + required=True, + elements="dict", + options=dict( + name=dict(type="str", required=True), + action=dict(type="str"), + action_settings=dict( + type="dict", + options=dict( + enable_identity_captive_portal=dict(type="bool"), + limit=dict(type="str"), + ), + ), + content=dict(type="list", elements="dict"), + content_direction=dict( + type="str", choices=["any", "up", "down"] + ), + content_negate=dict(type="bool"), + custom_fields=dict( + type="dict", + options=dict( + field_1=dict(type="str"), + field_2=dict(type="str"), + field_3=dict(type="str"), + ), + ), + destination=dict(type="list", elements="str"), + destination_negate=dict(type="bool"), + enabled=dict(type="bool"), + inline_layer=dict(type="str"), + install_on=dict(type="list", elements="str"), + service=dict(type="list", elements="str"), + service_negate=dict(type="bool"), + source=dict(type="list", elements="str"), + source_negate=dict(type="bool"), + time=dict(type="list", elements="str"), + track=dict( + type="dict", + options=dict( + accounting=dict(type="bool"), + alert=dict( + type="str", + choices=[ + "none", + "alert", + "snmp", + "mail", + "user alert 1", + "user alert 2", + "user alert 3", + ], + ), + enable_firewall_session=dict(type="bool"), + per_connection=dict(type="bool"), + per_session=dict(type="bool"), + type=dict(type="str"), + ), + ), + user_check=dict( + type="dict", + options=dict( + confirm=dict( + type="str", + choices=[ + "per rule", + "per category", + "per application/site", + "per data type", + ], + ), + custom_frequency=dict( + type="dict", + options=dict( + every=dict(type="int"), + unit=dict( + type="str", + choices=[ + "hours", + "days", + "weeks", + "months", + ], + ), + ), + ), + frequency=dict( + type="str", + choices=[ + "once a day", + "once a week", + "once a month", + "custom frequency...", + ], + ), + interaction=dict(type="str"), + ), + ), + vpn_list=dict( + type="list", + elements="dict", + options=dict( + community=dict(type="list", elements="str"), + directional=dict( + type="list", + elements="dict", + options=dict(to=dict(type="str")), + ), + ), + ), + vpn=dict(type="str", choices=["Any", "All_GwToGw"]), + comments=dict(type="str"), + details_level=dict( + type="str", choices=["uid", "standard", "full"] + ), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), + state=dict( + type="str", + choices=["present", "absent"], + default="present", + ), + ), + ), + layer=dict(type="str", required=True), + details_level=dict(type="str", choices=["uid", "standard", "full"]), ) - argument_spec['rules']['options']['vpn']['options']['directional']['options']['from'] = dict(type='str') + argument_spec["rules"]["options"]["vpn_list"]["options"]["directional"][ + "options" + ]["from"] = dict(type="str") argument_spec.update(checkpoint_argument_spec_for_action_module) module = AnsibleModule(argument_spec=argument_spec) @@ -369,5 +446,5 @@ def main(): module.exit_json() -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_section.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_section.py index 01a47a503..1a165cd89 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_section.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_section.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -94,26 +96,31 @@ cp_mgmt_access_section: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - layer=dict(type='str'), - position=dict(type='str'), - name=dict(type='str', required=True), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + layer=dict(type="str"), + position=dict(type="str"), + name=dict(type="str", required=True), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'access-section' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "access-section" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_add_api_key.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_add_api_key.py index 641cea5e9..a86ee2416 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_add_api_key.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_add_api_key.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -51,7 +53,6 @@ EXAMPLES = """ - name: add-api-key cp_mgmt_add_api_key: admin_name: admin - state: present """ RETURN = """ @@ -62,13 +63,15 @@ cp_mgmt_add_api_key: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): argument_spec = dict( - admin_uid=dict(type='str'), - admin_name=dict(type='str') + admin_uid=dict(type="str"), admin_name=dict(type="str") ) argument_spec.update(checkpoint_argument_spec_for_commands) @@ -80,5 +83,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_add_central_license.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_add_central_license.py new file mode 100644 index 000000000..909fcd333 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_add_central_license.py @@ -0,0 +1,78 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_add_central_license +short_description: Add central license. +description: + - Add central license. + - All operations are performed over Web Services API. +version_added: "5.2.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + license: + description: + - The license string received from the User Center - without 'cplic put'. + type: str +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: add-central-license + cp_mgmt_add_central_license: + license: 192.168.1.2 never dTTTTTT-WWWWWW-SSSSSSS-QQQQQQ CPSG-VE+3 CPBS-BECE CPSB-DFW CPSM-C-2 CPSB-VPN CPSB-NPM CPSB-LOGS CPSB-IA + CPSB-ADNC CPSB-SSLVWPN-5 CK-66666666 +""" + +RETURN = """ +cp_mgmt_add_central_license: + description: The checkpoint add-central-license output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + license=dict(type='str') + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "add-central-license" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_add_data_center_object.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_add_data_center_object.py index c4ad1d16f..f765cf8da 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_add_data_center_object.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_add_data_center_object.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -99,7 +101,6 @@ EXAMPLES = """ cp_mgmt_add_data_center_object: data_center_name: vCenter 1 name: VM1 mgmt name - state: present uri: /Datacenters/VMs/My VM1 """ @@ -111,27 +112,66 @@ cp_mgmt_add_data_center_object: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): argument_spec = dict( - data_center_name=dict(type='str'), - data_center_uid=dict(type='str'), - uri=dict(type='str'), - uid_in_data_center=dict(type='str'), - name=dict(type='str'), - tags=dict(type='list', elements='str'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - groups=dict(type='list', elements='str'), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + data_center_name=dict(type="str"), + data_center_uid=dict(type="str"), + uri=dict(type="str"), + uid_in_data_center=dict(type="str"), + name=dict(type="str"), + tags=dict(type="list", elements="str"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + groups=dict(type="list", elements="str"), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_commands) @@ -143,5 +183,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_add_domain.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_add_domain.py index bde1d9f4b..d6afde819 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_add_domain.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_add_domain.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -125,40 +127,86 @@ cp_mgmt_domain: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - servers=dict(type='list', elements='dict', options=dict( - name=dict(type='str'), - ip_address=dict(type='str'), - ipv4_address=dict(type='str'), - ipv6_address=dict(type='str'), - multi_domain_server=dict(type='str'), - active=dict(type='bool'), - skip_start_domain_server=dict(type='bool'), - type=dict(type='str', choices=['management server', 'log server', 'smc']) - )), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool'), + name=dict(type="str", required=True), + servers=dict( + type="list", + elements="dict", + options=dict( + name=dict(type="str"), + ip_address=dict(type="str"), + ipv4_address=dict(type="str"), + ipv6_address=dict(type="str"), + multi_domain_server=dict(type="str"), + active=dict(type="bool"), + skip_start_domain_server=dict(type="bool"), + type=dict( + type="str", + choices=["management server", "log server", "smc"], + ), + ), + ), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_commands) module = AnsibleModule(argument_spec=argument_spec) - command = 'add-domain' + command = "add-domain" result = api_command(module, command) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_add_nat_rule.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_add_nat_rule.py index 8b1151bd9..badb27822 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_add_nat_rule.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_add_nat_rule.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["deprecated"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -34,6 +36,10 @@ description: - All operations are performed over Web Services API. version_added: "2.0.0" author: "Or Soffer (@chkp-orso)" +deprecated: + alternative: cp_mgmt_nat_rule + why: Newer and updated module released with more functionality. + removed_at_date: '2024-11-01' options: package: description: @@ -113,7 +119,6 @@ EXAMPLES = """ original_source: Any package: standard position: 1 - state: present """ RETURN = """ @@ -124,26 +129,29 @@ cp_mgmt_add_nat_rule: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): argument_spec = dict( - package=dict(type='str'), - position=dict(type='str'), - enabled=dict(type='bool'), - install_on=dict(type='list', elements='str'), - method=dict(type='str', choices=['static', 'hide', 'nat64', 'nat46']), - original_destination=dict(type='str'), - original_service=dict(type='str'), - original_source=dict(type='str'), - translated_destination=dict(type='str'), - translated_service=dict(type='str'), - translated_source=dict(type='str'), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + package=dict(type="str"), + position=dict(type="str"), + enabled=dict(type="bool"), + install_on=dict(type="list", elements="str"), + method=dict(type="str", choices=["static", "hide", "nat64", "nat46"]), + original_destination=dict(type="str"), + original_service=dict(type="str"), + original_source=dict(type="str"), + translated_destination=dict(type="str"), + translated_service=dict(type="str"), + translated_source=dict(type="str"), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_commands) @@ -155,5 +163,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_add_repository_package.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_add_repository_package.py new file mode 100644 index 000000000..ae6d4bd39 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_add_repository_package.py @@ -0,0 +1,92 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_add_repository_package +short_description: Add the software package to the central repository. +description: + - Add the software package to the central repository. + - On Multi-Domain Server this command is available only after logging in to the Global domain. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Shiran Golzar (@chkp-shirango)" +options: + name: + description: + - The name of the repository package. + type: str + path: + description: + - The path of the repository package.<br><font color="red">Required only for</font> adding package from local. + type: str + source: + description: + - The source of the repository package. + type: str + choices: ['cloud', 'local'] +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: add-repository-package + cp_mgmt_add_repository_package: + name: Check_Point_R80_20_JUMBO_HF_Bundle_T118_sk137592_Security_Gateway_and_Standalone_2_6_18_FULL.tgz + path: /home/admin/ + source: local +""" + +RETURN = """ +cp_mgmt_add_repository_package: + description: The checkpoint add-repository-package output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, \ + api_command + + +def main(): + argument_spec = dict( + name=dict(type='str'), + path=dict(type='str'), + source=dict(type='str', choices=['cloud', 'local']) + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "add-repository-package" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_add_rules_batch.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_add_rules_batch.py index 58f7bb3bd..3ce0c18d8 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_add_rules_batch.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_add_rules_batch.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -109,18 +111,25 @@ cp_mgmt_add_rules_batch: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): argument_spec = dict( - objects=dict(type='list', elements='dict', options=dict( - layer=dict(type='str'), - type=dict(type='str'), - first_position=dict(type='str'), - list=dict(type='list', elements='dict') - )), - auto_publish_session=dict(type='bool') + objects=dict( + type="list", + elements="dict", + options=dict( + layer=dict(type="str"), + type=dict(type="str"), + first_position=dict(type="str"), + list=dict(type="list", elements="dict"), + ), + ), + auto_publish_session=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_commands) @@ -132,5 +141,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_add_updatable_object.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_add_updatable_object.py new file mode 100644 index 000000000..9b6190bd0 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_add_updatable_object.py @@ -0,0 +1,116 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_add_updatable_object +short_description: Import an updatable object from the repository to the management server. +description: + - Import an updatable object from the repository to the management server. This operation takes effect immediately and doesn't require publishing. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + uri: + description: + - URI of the updatable object in the Updatable Objects Repository. + type: str + uid_in_updatable_objects_repository: + description: + - Unique identifier of the updatable object in the Updatable Objects Repository. + type: str + color: + description: + - Color of the object. Should be one of existing colors. + type: str + choices: ['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green', + 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', + 'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', 'yellow'] + comments: + description: + - Comments string. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + ignore_warnings: + description: + - Apply changes ignoring warnings. + type: bool + ignore_errors: + description: + - Apply changes ignoring errors. You won't be able to publish such a changes. If ignore-warnings flag was omitted - warnings will also be ignored. + type: bool +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: add-updatable-object + cp_mgmt_add_updatable_object: + uri: '{{uri}}' +""" + +RETURN = """ +cp_mgmt_add_updatable_object: + description: The checkpoint add-updatable-object output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + uri=dict(type='str'), + uid_in_updatable_objects_repository=dict(type='str'), + color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', + 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', + 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', + 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', + 'yellow']), + comments=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + ignore_warnings=dict(type='bool'), + ignore_errors=dict(type='bool') + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "add-updatable-object" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_address_range.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_address_range.py index c678eb832..44ef44a02 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_address_range.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_address_range.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -169,47 +171,93 @@ cp_mgmt_address_range: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - ip_address_first=dict(type='str'), - ipv4_address_first=dict(type='str'), - ipv6_address_first=dict(type='str'), - ip_address_last=dict(type='str'), - ipv4_address_last=dict(type='str'), - ipv6_address_last=dict(type='str'), - nat_settings=dict(type='dict', options=dict( - auto_rule=dict(type='bool'), - ip_address=dict(type='str'), - ipv4_address=dict(type='str'), - ipv6_address=dict(type='str'), - hide_behind=dict(type='str', choices=['gateway', 'ip-address']), - install_on=dict(type='str'), - method=dict(type='str', choices=['hide', 'static']) - )), - tags=dict(type='list', elements='str'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - groups=dict(type='list', elements='str'), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + ip_address_first=dict(type="str"), + ipv4_address_first=dict(type="str"), + ipv6_address_first=dict(type="str"), + ip_address_last=dict(type="str"), + ipv4_address_last=dict(type="str"), + ipv6_address_last=dict(type="str"), + nat_settings=dict( + type="dict", + options=dict( + auto_rule=dict(type="bool"), + ip_address=dict(type="str"), + ipv4_address=dict(type="str"), + ipv6_address=dict(type="str"), + hide_behind=dict( + type="str", choices=["gateway", "ip-address"] + ), + install_on=dict(type="str"), + method=dict(type="str", choices=["hide", "static"]), + ), + ), + tags=dict(type="list", elements="str"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + groups=dict(type="list", elements="str"), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'address-range' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "address-range" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_address_range_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_address_range_facts.py index f9032eef1..2e41e94ba 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_address_range_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_address_range_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -102,31 +104,42 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - show_membership=dict(type='bool') + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + show_membership=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "address-range" api_call_object_plural_version = "address-ranges" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_administrator.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_administrator.py index 7568f742c..2b6cbba00 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_administrator.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_administrator.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -179,53 +181,110 @@ cp_mgmt_administrator: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - authentication_method=dict(type='str', choices=['undefined', 'check point password', - 'os password', 'securid', 'radius', 'tacacs', 'ad authentication', 'api key']), - email=dict(type='str'), - expiration_date=dict(type='str'), - multi_domain_profile=dict(type='str'), - must_change_password=dict(type='bool'), - password=dict(type='str', no_log=True), - password_hash=dict(type='str', no_log=True), - permissions_profile=dict(type='str'), - permissions_profile_list=dict(type='list', elements='dict', options=dict( - profile=dict(type='str'), - domain=dict(type='str') - )), - phone_number=dict(type='str'), - radius_server=dict(type='str'), - tacacs_server=dict(type='str'), - tags=dict(type='list', elements='str'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + authentication_method=dict( + type="str", + choices=[ + "undefined", + "check point password", + "os password", + "securid", + "radius", + "tacacs", + "ad authentication", + "api key", + ], + ), + email=dict(type="str"), + expiration_date=dict(type="str"), + multi_domain_profile=dict(type="str"), + must_change_password=dict(type="bool", no_log=False), + password=dict(type="str", no_log=True), + password_hash=dict(type="str", no_log=True), + permissions_profile=dict(type="str"), + permissions_profile_list=dict( + type="list", + elements="dict", + options=dict(profile=dict(type="str"), domain=dict(type="str")), + ), + phone_number=dict(type="str"), + radius_server=dict(type="str"), + tacacs_server=dict(type="str"), + tags=dict(type="list", elements="str"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'administrator' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "administrator" if module.params["permissions_profile_list"] is not None: if module.params["permissions_profile"] is not None: - raise AssertionError("The use of both 'permissions_profile_list' and 'permissions_profile' arguments isn't allowed") - module.params["permissions_profile"] = module.params["permissions_profile_list"] + raise AssertionError( + "The use of both 'permissions_profile_list' and 'permissions_profile' arguments isn't allowed" + ) + module.params["permissions_profile"] = module.params[ + "permissions_profile_list" + ] module.params.pop("permissions_profile_list") result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_administrator_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_administrator_facts.py index affd2febe..995362860 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_administrator_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_administrator_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -98,30 +100,41 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )) + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "administrator" api_call_object_plural_version = "administrators" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_application_site.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_application_site.py index 36b042a10..5b097cedf 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_application_site.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_application_site.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -143,38 +145,79 @@ cp_mgmt_application_site: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - primary_category=dict(type='str'), - url_list=dict(type='list', elements='str'), - application_signature=dict(type='str'), - additional_categories=dict(type='list', elements='str'), - description=dict(type='str'), - tags=dict(type='list', elements='str'), - urls_defined_as_regular_expression=dict(type='bool'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - groups=dict(type='list', elements='str'), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + primary_category=dict(type="str"), + url_list=dict(type="list", elements="str"), + application_signature=dict(type="str"), + additional_categories=dict(type="list", elements="str"), + description=dict(type="str"), + tags=dict(type="list", elements="str"), + urls_defined_as_regular_expression=dict(type="bool"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + groups=dict(type="list", elements="str"), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'application-site' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "application-site" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_application_site_category.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_application_site_category.py index 4c3d94d13..de822141c 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_application_site_category.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_application_site_category.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -109,33 +111,74 @@ cp_mgmt_application_site_category: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - description=dict(type='str'), - tags=dict(type='list', elements='str'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - groups=dict(type='list', elements='str'), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + description=dict(type="str"), + tags=dict(type="list", elements="str"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + groups=dict(type="list", elements="str"), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'application-site-category' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "application-site-category" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_application_site_category_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_application_site_category_facts.py index 3c3653b5b..cfdc977e9 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_application_site_category_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_application_site_category_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -98,30 +100,41 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )) + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "application-site-category" api_call_object_plural_version = "application-site-categories" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_application_site_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_application_site_facts.py index 2618cf6fb..d931dc1b5 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_application_site_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_application_site_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -106,32 +108,43 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - application_id=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - show_membership=dict(type='bool') + name=dict(type="str"), + application_id=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + show_membership=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "application-site" api_call_object_plural_version = "application-sites" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_application_site_group.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_application_site_group.py index 58c072771..b39c33db8 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_application_site_group.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_application_site_group.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -115,33 +117,74 @@ cp_mgmt_application_site_group: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - members=dict(type='list', elements='str'), - tags=dict(type='list', elements='str'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - groups=dict(type='list', elements='str'), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + members=dict(type="list", elements="str"), + tags=dict(type="list", elements="str"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + groups=dict(type="list", elements="str"), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'application-site-group' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "application-site-group" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_application_site_group_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_application_site_group_facts.py index 8a7ac74d4..aac26e00e 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_application_site_group_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_application_site_group_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -106,32 +108,43 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - dereference_group_members=dict(type='bool'), - show_membership=dict(type='bool') + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + dereference_group_members=dict(type="bool"), + show_membership=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "application-site-group" api_call_object_plural_version = "application-site-groups" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_approve_session.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_approve_session.py index d87b5738d..29ab8695b 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_approve_session.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_approve_session.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -56,13 +58,14 @@ cp_mgmt_approve_session: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): - argument_spec = dict( - uid=dict(type='str') - ) + argument_spec = dict(uid=dict(type="str")) argument_spec.update(checkpoint_argument_spec_for_commands) module = AnsibleModule(argument_spec=argument_spec) @@ -73,5 +76,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_assign_global_assignment.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_assign_global_assignment.py index f1b1df75d..96d3ff36a 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_assign_global_assignment.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_assign_global_assignment.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -69,14 +71,17 @@ cp_mgmt_assign_global_assignment: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): argument_spec = dict( - dependent_domains=dict(type='list', elements='str'), - global_domains=dict(type='list', elements='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']) + dependent_domains=dict(type="list", elements="str"), + global_domains=dict(type="list", elements="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), ) argument_spec.update(checkpoint_argument_spec_for_commands) @@ -88,5 +93,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_central_license_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_central_license_facts.py new file mode 100644 index 000000000..d53212ce7 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_central_license_facts.py @@ -0,0 +1,86 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_central_license_facts +short_description: Get central-license objects facts on Checkpoint over Web Services API +description: + - Get central-license objects facts on Checkpoint devices. + - All operations are performed over Web Services API. + - This module handles both operations, get a specific object and get several objects, + For getting a specific object use the parameter 'signature'. +version_added: "5.2.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + signature: + description: + - The license's signature. This parameter is relevant only for getting a specific object. + type: str +extends_documentation_fragment: checkpoint_facts +""" + +EXAMPLES = """ +- name: show-central-license + cp_mgmt_central_license_facts: + signature: dLLLLL-WWWWWW-ZZZZZZ-QQQQQQ + +- name: show-central-licenses + cp_mgmt_show_central_licenses: +""" + +RETURN = """ +ansible_facts: + description: The checkpoint object facts. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) + + +def main(): + argument_spec = dict( + signature=dict(type='str') + ) + argument_spec.update(checkpoint_argument_spec_for_facts) + + module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + + api_call_object = "central-license" + api_call_object_plural_version = "central-licenses" + + result = api_call_facts(module, api_call_object, api_call_object_plural_version) + module.exit_json(ansible_facts=result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_check_network_feed.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_check_network_feed.py index 8c93bf16f..c29b9cdc7 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_check_network_feed.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_check_network_feed.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -157,37 +159,51 @@ cp_mgmt_check_network_feed: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): argument_spec = dict( - targets=dict(type='list', elements='str'), - network_feed=dict(type='dict', options=dict( - name=dict(type='str'), - feed_url=dict(type='str'), - certificate_id=dict(type='str'), - feed_format=dict(type='str', choices=['Flat List', 'JSON']), - feed_type=dict(type='str', choices=['Domain', 'IP Address', 'IP Address/Domain']), - password=dict(type='str', no_log=True), - username=dict(type='str'), - custom_header=dict(type='list', elements='dict', options=dict( - header_name=dict(type='str'), - header_value=dict(type='str') - )), - update_interval=dict(type='int'), - data_column=dict(type='int'), - fields_delimiter=dict(type='str'), - ignore_lines_that_start_with=dict(type='str'), - json_query=dict(type='str'), - use_gateway_proxy=dict(type='bool'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - domains_to_process=dict(type='list', elements='str'), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool'), - )), - auto_publish_session=dict(type='bool') - + targets=dict(type="list", elements="str"), + network_feed=dict( + type="dict", + options=dict( + name=dict(type="str"), + feed_url=dict(type="str"), + certificate_id=dict(type="str"), + feed_format=dict(type="str", choices=["Flat List", "JSON"]), + feed_type=dict( + type="str", + choices=["Domain", "IP Address", "IP Address/Domain"], + ), + password=dict(type="str", no_log=True), + username=dict(type="str"), + custom_header=dict( + type="list", + elements="dict", + options=dict( + header_name=dict(type="str"), + header_value=dict(type="str"), + ), + ), + update_interval=dict(type="int"), + data_column=dict(type="int"), + fields_delimiter=dict(type="str"), + ignore_lines_that_start_with=dict(type="str"), + json_query=dict(type="str"), + use_gateway_proxy=dict(type="bool"), + details_level=dict( + type="str", choices=["uid", "standard", "full"] + ), + domains_to_process=dict(type="list", elements="str"), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), + ), + ), + auto_publish_session=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_commands) @@ -199,5 +215,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_check_threat_ioc_feed.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_check_threat_ioc_feed.py index 933349c9e..c85f1e421 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_check_threat_ioc_feed.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_check_threat_ioc_feed.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -173,41 +175,69 @@ cp_mgmt_check_threat_ioc_feed: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): argument_spec = dict( - ioc_feed=dict(type='dict', options=dict( - name=dict(type='str'), - feed_url=dict(type='str'), - action=dict(type='str', choices=['Prevent', 'Detect']), - certificate_id=dict(type='str'), - custom_comment=dict(type='int'), - custom_confidence=dict(type='int'), - custom_header=dict(type='list', elements='dict', options=dict( - header_name=dict(type='str'), - header_value=dict(type='str') - )), - custom_name=dict(type='int'), - custom_severity=dict(type='int'), - custom_type=dict(type='int'), - custom_value=dict(type='int'), - enabled=dict(type='bool'), - feed_type=dict(type='str', choices=['any type', 'domain', 'ip address', 'md5', 'url', 'ip range', - 'mail subject', 'mail from', 'mail to', 'mail reply to', 'mail cc', 'sha1', 'sha256']), - password=dict(type='str', no_log=True), - use_custom_feed_settings=dict(type='bool'), - username=dict(type='str'), - fields_delimiter=dict(type='str'), - ignore_lines_that_start_with=dict(type='str'), - use_gateway_proxy=dict(type='bool'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') - )), - targets=dict(type='list', elements='str'), - auto_publish_session=dict(type='bool') + ioc_feed=dict( + type="dict", + options=dict( + name=dict(type="str"), + feed_url=dict(type="str"), + action=dict(type="str", choices=["Prevent", "Detect"]), + certificate_id=dict(type="str"), + custom_comment=dict(type="int"), + custom_confidence=dict(type="int"), + custom_header=dict( + type="list", + elements="dict", + options=dict( + header_name=dict(type="str"), + header_value=dict(type="str"), + ), + ), + custom_name=dict(type="int"), + custom_severity=dict(type="int"), + custom_type=dict(type="int"), + custom_value=dict(type="int"), + enabled=dict(type="bool"), + feed_type=dict( + type="str", + choices=[ + "any type", + "domain", + "ip address", + "md5", + "url", + "ip range", + "mail subject", + "mail from", + "mail to", + "mail reply to", + "mail cc", + "sha1", + "sha256", + ], + ), + password=dict(type="str", no_log=True), + use_custom_feed_settings=dict(type="bool"), + username=dict(type="str"), + fields_delimiter=dict(type="str"), + ignore_lines_that_start_with=dict(type="str"), + use_gateway_proxy=dict(type="bool"), + details_level=dict( + type="str", choices=["uid", "standard", "full"] + ), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), + ), + ), + targets=dict(type="list", elements="str"), + auto_publish_session=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_commands) @@ -219,5 +249,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_checkpoint_host.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_checkpoint_host.py new file mode 100644 index 000000000..5b3189c5f --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_checkpoint_host.py @@ -0,0 +1,528 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_checkpoint_host +short_description: Manages checkpoint-host objects on Checkpoint over Web Services API +description: + - Manages checkpoint-host objects on Checkpoint devices including creating, updating and removing objects. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + name: + description: + - Object name. + type: str + required: True + ip_address: + description: + - IPv4 or IPv6 address. If both addresses are required use ipv4-address and ipv6-address fields explicitly. + type: str + ipv4_address: + description: + - IPv4 address. + type: str + ipv6_address: + description: + - IPv6 address. + type: str + interfaces: + description: + - Check Point host interfaces. + type: list + elements: dict + suboptions: + name: + description: + - Interface name. + type: str + subnet: + description: + - IPv4 or IPv6 network address. If both addresses are required use subnet4 and subnet6 fields explicitly. + type: str + subnet4: + description: + - IPv4 network address. + type: str + subnet6: + description: + - IPv6 network address. + type: str + mask_length: + description: + - IPv4 or IPv6 network mask length. If both masks are required use mask-length4 and mask-length6 fields explicitly. Instead of IPv4 mask + length it is possible to specify IPv4 mask itself in subnet-mask field. + type: int + mask_length4: + description: + - IPv4 network mask length. + type: int + mask_length6: + description: + - IPv6 network mask length. + type: int + subnet_mask: + description: + - IPv4 network mask. + type: str + color: + description: + - Color of the object. Should be one of existing colors. + type: str + choices: ['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', + 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', + 'light green', 'lemon chiffon', 'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', + 'orange', 'red', 'sienna', 'yellow'] + comments: + description: + - Comments string. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + ignore_warnings: + description: + - Apply changes ignoring warnings. + type: bool + ignore_errors: + description: + - Apply changes ignoring errors. You won't be able to publish such a changes. If ignore-warnings flag was omitted - warnings will also be ignored. + type: bool + nat_settings: + description: + - NAT settings. + type: dict + suboptions: + auto_rule: + description: + - Whether to add automatic address translation rules. + type: bool + ip_address: + description: + - IPv4 or IPv6 address. If both addresses are required use ipv4-address and ipv6-address fields explicitly. This parameter is not + required in case "method" parameter is "hide" and "hide-behind" parameter is "gateway". + type: str + ipv4_address: + description: + - IPv4 address. + type: str + ipv6_address: + description: + - IPv6 address. + type: str + hide_behind: + description: + - Hide behind method. This parameter is forbidden in case "method" parameter is "static". + type: str + choices: ['gateway', 'ip-address'] + install_on: + description: + - Which gateway should apply the NAT translation. + type: str + method: + description: + - NAT translation method. + type: str + choices: ['hide', 'static'] + one_time_password: + description: + - Secure internal connection one time password. + type: str + hardware: + description: + - Hardware name. + type: str + os: + description: + - Operating system name. + type: str + check_point_host_version: + description: + - Check Point host platform version. + type: str + management_blades: + description: + - Management blades. + type: dict + suboptions: + network_policy_management: + description: + - Enable Network Policy Management. + type: bool + logging_and_status: + description: + - Enable Logging & Status. + type: bool + smart_event_server: + description: + - Enable SmartEvent server. </br>When activating SmartEvent server, blades 'logging-and-status' and 'smart-event-correlation' should be + set to True. </br>To complete SmartEvent configuration, perform Install Database or Install Policy on your Security Management servers and Log + servers. </br>Activating SmartEvent Server is not recommended in Management High Availability environment. For more information refer to sk25164. + type: bool + smart_event_correlation: + description: + - Enable SmartEvent Correlation Unit. + type: bool + endpoint_policy: + description: + - Enable Endpoint Policy. </br>To complete Endpoint Security Management configuration, perform Install Database on your Endpoint + Management Server. </br>Field is not supported on Multi Domain Server environment. + type: bool + compliance: + description: + - Compliance blade. Can be set when 'network-policy-management' was selected to be True. + type: bool + user_directory: + description: + - Enable User Directory. Can be set when 'network-policy-management' was selected to be True. + type: bool + logs_settings: + description: + - Logs settings. + type: dict + suboptions: + free_disk_space_metrics: + description: + - Free disk space metrics. + type: str + choices: ['mbytes', 'percent'] + accept_syslog_messages: + description: + - Enable accept syslog messages. + type: bool + alert_when_free_disk_space_below: + description: + - Enable alert when free disk space is below threshold. + type: bool + alert_when_free_disk_space_below_threshold: + description: + - Alert when free disk space below threshold. + type: int + alert_when_free_disk_space_below_type: + description: + - Alert when free disk space below type. + type: str + choices: ['none', 'log', 'popup alert', 'mail alert', 'snmp trap alert', 'user defined alert no.1', 'user defined alert no.2', + 'user defined alert no.3'] + before_delete_keep_logs_from_the_last_days: + description: + - Enable before delete keep logs from the last days. + type: bool + before_delete_keep_logs_from_the_last_days_threshold: + description: + - Before delete keep logs from the last days threshold. + type: int + before_delete_run_script: + description: + - Enable Before delete run script. + type: bool + before_delete_run_script_command: + description: + - Before delete run script command. + type: str + delete_index_files_older_than_days: + description: + - Enable delete index files older than days. + type: bool + delete_index_files_older_than_days_threshold: + description: + - Delete index files older than days threshold. + type: int + delete_when_free_disk_space_below: + description: + - Enable delete when free disk space below. + type: bool + delete_when_free_disk_space_below_threshold: + description: + - Delete when free disk space below threshold. + type: int + detect_new_citrix_ica_application_names: + description: + - Enable detect new Citrix ICA application names. + type: bool + distribute_logs_between_all_active_servers: + description: + - Distribute logs between all active servers. + type: bool + enable_log_indexing: + description: + - Enable log indexing. + type: bool + forward_logs_to_log_server: + description: + - Enable forward logs to log server. + type: bool + forward_logs_to_log_server_name: + description: + - Forward logs to log server name. + type: str + forward_logs_to_log_server_schedule_name: + description: + - Forward logs to log server schedule name. + type: str + rotate_log_by_file_size: + description: + - Enable rotate log by file size. + type: bool + rotate_log_file_size_threshold: + description: + - Log file size threshold. + type: int + rotate_log_on_schedule: + description: + - Enable rotate log on schedule. + type: bool + rotate_log_schedule_name: + description: + - Rotate log schedule name. + type: str + smart_event_intro_correletion_unit: + description: + - Enable SmartEvent intro correlation unit. + type: bool + stop_logging_when_free_disk_space_below: + description: + - Enable stop logging when free disk space below. + type: bool + stop_logging_when_free_disk_space_below_threshold: + description: + - Stop logging when free disk space below threshold. + type: int + turn_on_qos_logging: + description: + - Enable turn on QoS Logging. + type: bool + update_account_log_every: + description: + - Update account log in every amount of seconds. + type: int + save_logs_locally: + description: + - Enable save logs locally. + type: bool + send_alerts_to_server: + description: + - Collection of Server(s) to send alerts to identified by the name or UID. + type: list + elements: str + send_logs_to_backup_server: + description: + - Collection of Backup server(s) to send logs to identified by the name or UID. + type: list + elements: str + send_logs_to_server: + description: + - Collection of Server(s) to send logs to identified by the name or UID. + type: list + elements: str + tags: + description: + - Collection of tag identifiers. + type: list + elements: str + color: + description: + - Color of the object. Should be one of existing colors. + type: str + choices: ['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green', + 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', + 'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', 'yellow'] + comments: + description: + - Comments string. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + groups: + description: + - Collection of group identifiers. + type: list + elements: str + ignore_warnings: + description: + - Apply changes ignoring warnings. + type: bool + ignore_errors: + description: + - Apply changes ignoring errors. You won't be able to publish such a changes. If ignore-warnings flag was omitted - warnings will also be ignored. + type: bool +extends_documentation_fragment: check_point.mgmt.checkpoint_objects +""" + +EXAMPLES = """ +- name: add-checkpoint-host + cp_mgmt_checkpoint_host: + ipv4_address: 5.5.5.5 + management_blades: + logging_and_status: true + network_policy_management: true + name: secondarylogserver + state: present + +- name: set-checkpoint-host + cp_mgmt_checkpoint_host: + hardware: Smart-1 + management_blades: + compliance: true + network_policy_management: true + user_directory: true + name: secondarylogserver + os: Linux + state: present + +- name: delete-checkpoint-host + cp_mgmt_checkpoint_host: + name: secondarylogserver + state: absent +""" + +RETURN = """ +cp_mgmt_checkpoint_host: + description: The checkpoint object created or updated. + returned: always, except when deleting the object. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call + + +def main(): + argument_spec = dict( + name=dict(type='str', required=True), + ip_address=dict(type='str'), + ipv4_address=dict(type='str'), + ipv6_address=dict(type='str'), + interfaces=dict(type='list', elements='dict', options=dict( + name=dict(type='str'), + subnet=dict(type='str'), + subnet4=dict(type='str'), + subnet6=dict(type='str'), + mask_length=dict(type='int'), + mask_length4=dict(type='int'), + mask_length6=dict(type='int'), + subnet_mask=dict(type='str'), + color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', + 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', + 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', + 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', + 'sienna', 'yellow']), + comments=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + ignore_warnings=dict(type='bool'), + ignore_errors=dict(type='bool') + )), + nat_settings=dict(type='dict', options=dict( + auto_rule=dict(type='bool'), + ip_address=dict(type='str'), + ipv4_address=dict(type='str'), + ipv6_address=dict(type='str'), + hide_behind=dict(type='str', choices=['gateway', 'ip-address']), + install_on=dict(type='str'), + method=dict(type='str', choices=['hide', 'static']) + )), + one_time_password=dict(type='str', no_log=True), + hardware=dict(type='str'), + os=dict(type='str'), + check_point_host_version=dict(type='str'), + management_blades=dict(type='dict', options=dict( + network_policy_management=dict(type='bool'), + logging_and_status=dict(type='bool'), + smart_event_server=dict(type='bool'), + smart_event_correlation=dict(type='bool'), + endpoint_policy=dict(type='bool'), + compliance=dict(type='bool'), + user_directory=dict(type='bool') + )), + logs_settings=dict(type='dict', options=dict( + free_disk_space_metrics=dict(type='str', choices=['mbytes', 'percent']), + accept_syslog_messages=dict(type='bool'), + alert_when_free_disk_space_below=dict(type='bool'), + alert_when_free_disk_space_below_threshold=dict(type='int'), + alert_when_free_disk_space_below_type=dict(type='str', choices=['none', + 'log', 'popup alert', 'mail alert', 'snmp trap alert', 'user defined alert no.1', + 'user defined alert no.2', 'user defined alert no.3']), + before_delete_keep_logs_from_the_last_days=dict(type='bool'), + before_delete_keep_logs_from_the_last_days_threshold=dict(type='int'), + before_delete_run_script=dict(type='bool'), + before_delete_run_script_command=dict(type='str'), + delete_index_files_older_than_days=dict(type='bool'), + delete_index_files_older_than_days_threshold=dict(type='int'), + delete_when_free_disk_space_below=dict(type='bool'), + delete_when_free_disk_space_below_threshold=dict(type='int'), + detect_new_citrix_ica_application_names=dict(type='bool'), + distribute_logs_between_all_active_servers=dict(type='bool'), + enable_log_indexing=dict(type='bool'), + forward_logs_to_log_server=dict(type='bool'), + forward_logs_to_log_server_name=dict(type='str'), + forward_logs_to_log_server_schedule_name=dict(type='str'), + rotate_log_by_file_size=dict(type='bool'), + rotate_log_file_size_threshold=dict(type='int'), + rotate_log_on_schedule=dict(type='bool'), + rotate_log_schedule_name=dict(type='str'), + smart_event_intro_correletion_unit=dict(type='bool'), + stop_logging_when_free_disk_space_below=dict(type='bool'), + stop_logging_when_free_disk_space_below_threshold=dict(type='int'), + turn_on_qos_logging=dict(type='bool'), + update_account_log_every=dict(type='int') + )), + save_logs_locally=dict(type='bool'), + send_alerts_to_server=dict(type='list', elements='str'), + send_logs_to_backup_server=dict(type='list', elements='str'), + send_logs_to_server=dict(type='list', elements='str'), + tags=dict(type='list', elements='str'), + color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', + 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', + 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', + 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', + 'yellow']), + comments=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + groups=dict(type='list', elements='str'), + ignore_warnings=dict(type='bool'), + ignore_errors=dict(type='bool') + ) + argument_spec.update(checkpoint_argument_spec_for_objects) + + module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + api_call_object = 'checkpoint-host' + + result = api_call(module, api_call_object) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_checkpoint_host_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_checkpoint_host_facts.py new file mode 100644 index 000000000..2ec9f8809 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_checkpoint_host_facts.py @@ -0,0 +1,144 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_checkpoint_host_facts +short_description: Get checkpoint-host objects facts on Checkpoint over Web Services API +description: + - Get checkpoint-host objects facts on Checkpoint devices. + - All operations are performed over Web Services API. + - This module handles both operations, get a specific object and get several objects, + For getting a specific object use the parameter 'name'. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + name: + description: + - Object name. + This parameter is relevant only for getting a specific object. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + filter: + description: + - Search expression to filter objects by. The provided text should be exactly the same as it would be given in SmartConsole Object Explorer. The + logical operators in the expression ('AND', 'OR') should be provided in capital letters. The search involves both a IP search and a textual search in + name, comment, tags etc. + type: str + limit: + description: + - The maximal number of returned results. + This parameter is relevant only for getting few objects. + type: int + offset: + description: + - Number of the results to initially skip. + This parameter is relevant only for getting few objects. + type: int + order: + description: + - Sorts the results by search criteria. Automatically sorts the results by Name, in the ascending order. + This parameter is relevant only for getting few objects. + type: list + elements: dict + suboptions: + ASC: + description: + - Sorts results by the given field in ascending order. + type: str + choices: ['name'] + DESC: + description: + - Sorts results by the given field in descending order. + type: str + choices: ['name'] + show_membership: + description: + - Indicates whether to calculate and show "groups" field for every object in reply. + type: bool + domains_to_process: + description: + - Indicates which domains to process the commands on. It cannot be used with the details-level full, must be run from the System Domain only and + with ignore-warnings true. Valid values are, CURRENT_DOMAIN, ALL_DOMAINS_ON_THIS_SERVER. + type: list + elements: str +extends_documentation_fragment: check_point.mgmt.checkpoint_facts +""" + +EXAMPLES = """ +- name: show-checkpoint-host + cp_mgmt_checkpoint_host_facts: + name: CP Host 1 + +- name: show-checkpoint-hosts + cp_mgmt_checkpoint_host_facts: + limit: 10 +""" + +RETURN = """ +ansible_facts: + description: The checkpoint object facts. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts + + +def main(): + argument_spec = dict( + name=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + filter=dict(type='str'), + limit=dict(type='int'), + offset=dict(type='int'), + order=dict(type='list', elements='dict', options=dict( + ASC=dict(type='str', choices=['name']), + DESC=dict(type='str', choices=['name']) + )), + show_membership=dict(type='bool'), + domains_to_process=dict(type='list', elements='str') + ) + argument_spec.update(checkpoint_argument_spec_for_facts) + + module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + + api_call_object = "checkpoint-host" + api_call_object_plural_version = "checkpoint-hosts" + + result = api_call_facts(module, api_call_object, api_call_object_plural_version) + module.exit_json(ansible_facts=result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_cluster_members_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_cluster_members_facts.py index 203ce487e..a99e16634 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_cluster_members_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_cluster_members_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -114,34 +116,45 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - uid=dict(type='str'), - limit_interfaces=dict(type='int'), - filter=dict(type='str'), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - show_membership=dict(type='bool'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - domains_to_process=dict(type='list', elements='str') + uid=dict(type="str"), + limit_interfaces=dict(type="int"), + filter=dict(type="str"), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + show_membership=dict(type="bool"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + domains_to_process=dict(type="list", elements="str"), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "cluster-member" api_call_object_plural_version = "cluster-members" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_connect_cloud_services.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_connect_cloud_services.py index 9194f9a0f..a19f1f57f 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_connect_cloud_services.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_connect_cloud_services.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -61,13 +63,14 @@ cp_mgmt_connect_cloud_services: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): - argument_spec = dict( - auth_token=dict(type='str', no_log=True) - ) + argument_spec = dict(auth_token=dict(type="str", no_log=True)) argument_spec.update(checkpoint_argument_spec_for_commands) module = AnsibleModule(argument_spec=argument_spec) @@ -78,5 +81,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_data_center_object_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_data_center_object_facts.py index 41400cf0a..5489850bd 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_data_center_object_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_data_center_object_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -99,31 +101,42 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - show_membership=dict(type='bool') + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + show_membership=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "data-center-object" api_call_object_plural_version = "data-center-objects" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_delete_api_key.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_delete_api_key.py index 4839a1f27..b590b7b8e 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_delete_api_key.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_delete_api_key.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -55,7 +57,6 @@ EXAMPLES = """ cp_mgmt_delete_api_key: #sgignore next_line api_key: eea3be76f4a8eb740ee872bcedc692748ff256a2d21c9ffd2754facbde046d00 - state: absent """ RETURN = """ @@ -66,14 +67,17 @@ cp_mgmt_delete_api_key: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): argument_spec = dict( - api_key=dict(type='str', no_log=True), - admin_uid=dict(type='str'), - admin_name=dict(type='str') + api_key=dict(type="str", no_log=True), + admin_uid=dict(type="str"), + admin_name=dict(type="str"), ) argument_spec.update(checkpoint_argument_spec_for_commands) @@ -85,5 +89,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_delete_central_license.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_delete_central_license.py new file mode 100644 index 000000000..e08a9f96a --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_delete_central_license.py @@ -0,0 +1,77 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_delete_central_license +short_description: Delete central license. +description: + - Delete central license. + - All operations are performed over Web Services API. +version_added: "5.2.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + signature: + description: + - The license's signature to be deleted. + type: str +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: delete-central-license + cp_mgmt_delete_central_license: + signature: dTTTTTT-WWWWWW-SSSSSSS-QQQQQQ +""" + +RETURN = """ +cp_mgmt_delete_central_license: + description: The checkpoint delete-central-license output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + signature=dict(type='str') + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "delete-central-license" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_delete_data_center_object.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_delete_data_center_object.py index 52f4b6633..e3cdf8c78 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_delete_data_center_object.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_delete_data_center_object.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -60,7 +62,6 @@ EXAMPLES = """ - name: delete-data-center-object cp_mgmt_delete_data_center_object: name: VM1 mgmt name - state: absent """ RETURN = """ @@ -71,15 +72,18 @@ cp_mgmt_delete_data_center_object: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_commands) @@ -91,5 +95,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_delete_domain.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_delete_domain.py index 4b356fd49..550cb5009 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_delete_domain.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_delete_domain.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -71,24 +73,27 @@ cp_mgmt_domain: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool'), + name=dict(type="str", required=True), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_commands) module = AnsibleModule(argument_spec=argument_spec) - command = 'delete-domain' + command = "delete-domain" result = api_command(module, command) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_delete_nat_rule.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_delete_nat_rule.py index 2915667f3..88416c82f 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_delete_nat_rule.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_delete_nat_rule.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["deprecated"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -34,6 +36,10 @@ description: - All operations are performed over Web Services API. version_added: "2.0.0" author: "Or Soffer (@chkp-orso)" +deprecated: + alternative: cp_mgmt_nat_rule + why: Newer and updated module released with more functionality. + removed_at_date: '2024-11-01' options: rule_number: description: @@ -56,7 +62,6 @@ EXAMPLES = """ - name: delete-nat-rule cp_mgmt_delete_nat_rule: package: standard - state: absent """ RETURN = """ @@ -67,14 +72,17 @@ cp_mgmt_delete_nat_rule: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): argument_spec = dict( - rule_number=dict(type='str'), - package=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']) + rule_number=dict(type="str"), + package=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), ) argument_spec.update(checkpoint_argument_spec_for_commands) @@ -86,5 +94,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_delete_repository_package.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_delete_repository_package.py new file mode 100644 index 000000000..6a8401022 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_delete_repository_package.py @@ -0,0 +1,79 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_delete_repository_package +short_description: Delete the repository software package from the central repository. +description: + - Delete the repository software package from the central repository. + - On Multi-Domain Server this command is available only after logging in to the Global domain. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Shiran Golzar (@chkp-shirango)" +options: + name: + description: + - The name of the software package. + type: str +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: delete-repository-package + cp_mgmt_delete_repository_package: + name: Check_Point_R80_20_JUMBO_HF_Bundle_T118_sk137592_Security_Gateway_and_Standalone_2_6_18_FULL.tgz +""" + +RETURN = """ +cp_mgmt_delete_repository_package: + description: The checkpoint delete-repository-package output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, \ + api_command + + +def main(): + argument_spec = dict( + name=dict(type='str') + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "delete-repository-package" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_delete_rules_batch.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_delete_rules_batch.py index 8e17898be..6e9f632ce 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_delete_rules_batch.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_delete_rules_batch.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -86,7 +88,6 @@ EXAMPLES = """ - rule_number: 1 - rule_number: 2 type: https-rule - state: absent """ RETURN = """ @@ -97,17 +98,24 @@ cp_mgmt_delete_rules_batch: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): argument_spec = dict( - objects=dict(type='list', elements='dict', options=dict( - layer=dict(type='str'), - type=dict(type='str'), - list=dict(type='list', elements='dict') - )), - auto_publish_session=dict(type='bool') + objects=dict( + type="list", + elements="dict", + options=dict( + layer=dict(type="str"), + type=dict(type="str"), + list=dict(type="list", elements="dict"), + ), + ), + auto_publish_session=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_commands) @@ -119,5 +127,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_delete_updatable_object.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_delete_updatable_object.py new file mode 100644 index 000000000..2310c6894 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_delete_updatable_object.py @@ -0,0 +1,94 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_delete_updatable_object +short_description: Delete existing object using object name or uid. +description: + - Delete existing object using object name or uid. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + name: + description: + - Object name. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + ignore_warnings: + description: + - Apply changes ignoring warnings. + type: bool + ignore_errors: + description: + - Apply changes ignoring errors. You won't be able to publish such a changes. If ignore-warnings flag was omitted - warnings will also be ignored. + type: bool +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: delete-updatable-object + cp_mgmt_delete_updatable_object: + name: CodeBuild US East 1 +""" + +RETURN = """ +cp_mgmt_delete_updatable_object: + description: The checkpoint delete-updatable-object output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + name=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + ignore_warnings=dict(type='bool'), + ignore_errors=dict(type='bool') + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "delete-updatable-object" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_discard.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_discard.py index 7dc4844e9..4fe8d1051 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_discard.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_discard.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -55,13 +57,14 @@ cp_mgmt_discard: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): - argument_spec = dict( - uid=dict(type='str') - ) + argument_spec = dict(uid=dict(type="str")) argument_spec.update(checkpoint_argument_spec_for_commands) module = AnsibleModule(argument_spec=argument_spec) @@ -72,5 +75,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_disconnect_cloud_services.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_disconnect_cloud_services.py index 82073cc7a..a6197cd09 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_disconnect_cloud_services.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_disconnect_cloud_services.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -57,13 +59,14 @@ cp_mgmt_disconnect_cloud_services: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): - argument_spec = dict( - force=dict(type='bool') - ) + argument_spec = dict(force=dict(type="bool")) argument_spec.update(checkpoint_argument_spec_for_commands) module = AnsibleModule(argument_spec=argument_spec) @@ -74,5 +77,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_distribute_cloud_licenses.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_distribute_cloud_licenses.py new file mode 100644 index 000000000..a381ccc00 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_distribute_cloud_licenses.py @@ -0,0 +1,82 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_distribute_cloud_licenses +short_description: Distribute licenses to target CloudGuard gateways. +description: + - Distribute licenses to target CloudGuard gateways. For more information, see the <A HREF = + "https://sc1.checkpoint.com/documents/IaaS/WebAdminGuides/EN/CP_CloudGuard_Central_License_Tool_Admin_Guide/Content/Topics-Central-License-Tool/Overview.h + m?tocpath=Overview%7C_____0#Overview"><b>Central License Administration Guide</b></A>. + - All operations are performed over Web Services API. +version_added: "5.2.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + targets: + description: + - Targets are uid or name of the security gateway(s). In case no target specified, the license will be distributed to all CloudGuard security gateways. + type: list + elements: str +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: distribute-cloud-licenses + cp_mgmt_distribute_cloud_licenses: + targets: + - GW1 + - GW2 +""" + +RETURN = """ +cp_mgmt_distribute_cloud_licenses: + description: The checkpoint distribute-cloud-licenses output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + targets=dict(type='list', elements='str') + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "distribute-cloud-licenses" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_dns_domain.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_dns_domain.py index 127dce067..2a4bf5886 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_dns_domain.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_dns_domain.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -104,32 +106,73 @@ cp_mgmt_dns_domain: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - is_sub_domain=dict(type='bool'), - tags=dict(type='list', elements='str'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + is_sub_domain=dict(type="bool"), + tags=dict(type="list", elements="str"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'dns-domain' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "dns-domain" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_dns_domain_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_dns_domain_facts.py index 87ab82c46..b716d5a21 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_dns_domain_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_dns_domain_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -102,31 +104,42 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - show_membership=dict(type='bool') + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + show_membership=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "dns-domain" api_call_object_plural_version = "dns-domains" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_domain_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_domain_facts.py index e6fab1445..5072e60bc 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_domain_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_domain_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -104,31 +106,42 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - filter=dict(type='str'), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )) + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + filter=dict(type="str"), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "domain" api_call_object_plural_version = "domains" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_domain_permissions_profile.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_domain_permissions_profile.py index d327f30f6..d3798798a 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_domain_permissions_profile.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_domain_permissions_profile.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -459,7 +461,8 @@ EXAMPLES = """ - name: set-domain-permissions-profile cp_mgmt_domain_permissions_profile: - access_control.policy_layers: By Selected Profile In A Layer Editor + access_control: + policy_layers: By Selected Profile In A Layer Editor name: read profile permission_type: customized state: present @@ -478,121 +481,249 @@ cp_mgmt_domain_permissions_profile: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - permission_type=dict(type='str', choices=['read write all', 'read only all', 'customized']), - edit_common_objects=dict(type='bool'), - access_control=dict(type='dict', options=dict( - show_policy=dict(type='bool'), - policy_layers=dict(type='dict', options=dict( - edit_layers=dict(type='str', choices=['By Software Blades', 'By Selected Profile In A Layer Editor']), - app_control_and_url_filtering=dict(type='bool'), - content_awareness=dict(type='bool'), - firewall=dict(type='bool'), - mobile_access=dict(type='bool') - )), - dlp_policy=dict(type='str', choices=['read', 'write', 'disabled']), - geo_control_policy=dict(type='str', choices=['read', 'write', 'disabled']), - nat_policy=dict(type='str', choices=['read', 'write', 'disabled']), - qos_policy=dict(type='str', choices=['read', 'write', 'disabled']), - access_control_objects_and_settings=dict(type='str', choices=['read', 'write', 'disabled']), - app_control_and_url_filtering_update=dict(type='bool'), - install_policy=dict(type='bool') - )), - endpoint=dict(type='dict', options=dict( - manage_policies_and_software_deployment=dict(type='bool'), - edit_endpoint_policies=dict(type='bool'), - policies_installation=dict(type='bool'), - edit_software_deployment=dict(type='bool'), - software_deployment_installation=dict(type='bool'), - allow_executing_push_operations=dict(type='bool'), - authorize_preboot_users=dict(type='bool'), - recovery_media=dict(type='bool'), - remote_help=dict(type='bool'), - reset_computer_data=dict(type='bool') - )), - events_and_reports=dict(type='dict', options=dict( - smart_event=dict(type='str', choices=['custom', 'app control and url filtering reports only']), - events=dict(type='str', choices=['read', 'write', 'disabled']), - policy=dict(type='str', choices=['read', 'write', 'disabled']), - reports=dict(type='bool') - )), - gateways=dict(type='dict', options=dict( - smart_update=dict(type='str', choices=['read', 'write', 'disabled']), - lsm_gw_db=dict(type='str', choices=['read', 'write', 'disabled']), - manage_provisioning_profiles=dict(type='str', choices=['read', 'write', 'disabled']), - vsx_provisioning=dict(type='bool'), - system_backup=dict(type='bool'), - system_restore=dict(type='bool'), - open_shell=dict(type='bool'), - run_one_time_script=dict(type='bool'), - run_repository_script=dict(type='bool'), - manage_repository_scripts=dict(type='str', choices=['read', 'write', 'disabled']) - )), - management=dict(type='dict', options=dict( - cme_operations=dict(type='str', choices=['read', 'write', 'disabled']), - manage_admins=dict(type='bool'), - management_api_login=dict(type='bool'), - manage_sessions=dict(type='bool'), - high_availability_operations=dict(type='bool'), - approve_or_reject_sessions=dict(type='bool'), - publish_sessions=dict(type='bool'), - manage_integration_with_cloud_services=dict(type='bool') - )), - monitoring_and_logging=dict(type='dict', options=dict( - monitoring=dict(type='str', choices=['read', 'write', 'disabled']), - management_logs=dict(type='str', choices=['read', 'write', 'disabled']), - track_logs=dict(type='str', choices=['read', 'write', 'disabled']), - app_and_url_filtering_logs=dict(type='bool'), - https_inspection_logs=dict(type='bool'), - packet_capture_and_forensics=dict(type='bool'), - show_packet_capture_by_default=dict(type='bool'), - identities=dict(type='bool'), - show_identities_by_default=dict(type='bool'), - dlp_logs_including_confidential_fields=dict(type='bool'), - manage_dlp_messages=dict(type='bool') - )), - threat_prevention=dict(type='dict', options=dict( - policy_layers=dict(type='str', choices=['read', 'write', 'disabled']), - edit_layers=dict(type='str', choices=['By Selected Profile In A Layer Editor', 'All']), - edit_settings=dict(type='bool'), - policy_exceptions=dict(type='str', choices=['read', 'write', 'disabled']), - profiles=dict(type='str', choices=['read', 'write', 'disabled']), - protections=dict(type='str', choices=['read', 'write', 'disabled']), - install_policy=dict(type='bool'), - ips_update=dict(type='bool') - )), - others=dict(type='dict', options=dict( - client_certificates=dict(type='bool'), - edit_cp_users_db=dict(type='bool'), - https_inspection=dict(type='str', choices=['read', 'write', 'disabled']), - ldap_users_db=dict(type='str', choices=['read', 'write', 'disabled']), - user_authority_access=dict(type='str', choices=['read', 'write', 'disabled']), - user_device_mgmt_conf=dict(type='str', choices=['read', 'write', 'disabled']) - )), - tags=dict(type='list', elements='str'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + permission_type=dict( + type="str", + choices=["read write all", "read only all", "customized"], + ), + edit_common_objects=dict(type="bool"), + access_control=dict( + type="dict", + options=dict( + show_policy=dict(type="bool"), + policy_layers=dict( + type="dict", + options=dict( + edit_layers=dict( + type="str", + choices=[ + "By Software Blades", + "By Selected Profile In A Layer Editor", + ], + ), + app_control_and_url_filtering=dict(type="bool"), + content_awareness=dict(type="bool"), + firewall=dict(type="bool"), + mobile_access=dict(type="bool"), + ), + ), + dlp_policy=dict( + type="str", choices=["read", "write", "disabled"] + ), + geo_control_policy=dict( + type="str", choices=["read", "write", "disabled"] + ), + nat_policy=dict( + type="str", choices=["read", "write", "disabled"] + ), + qos_policy=dict( + type="str", choices=["read", "write", "disabled"] + ), + access_control_objects_and_settings=dict( + type="str", choices=["read", "write", "disabled"] + ), + app_control_and_url_filtering_update=dict(type="bool"), + install_policy=dict(type="bool"), + ), + ), + endpoint=dict( + type="dict", + options=dict( + manage_policies_and_software_deployment=dict(type="bool"), + edit_endpoint_policies=dict(type="bool"), + policies_installation=dict(type="bool"), + edit_software_deployment=dict(type="bool"), + software_deployment_installation=dict(type="bool"), + allow_executing_push_operations=dict(type="bool"), + authorize_preboot_users=dict(type="bool"), + recovery_media=dict(type="bool"), + remote_help=dict(type="bool"), + reset_computer_data=dict(type="bool"), + ), + ), + events_and_reports=dict( + type="dict", + options=dict( + smart_event=dict( + type="str", + choices=[ + "custom", + "app control and url filtering reports only", + ], + ), + events=dict(type="str", choices=["read", "write", "disabled"]), + policy=dict(type="str", choices=["read", "write", "disabled"]), + reports=dict(type="bool"), + ), + ), + gateways=dict( + type="dict", + options=dict( + smart_update=dict( + type="str", choices=["read", "write", "disabled"] + ), + lsm_gw_db=dict( + type="str", choices=["read", "write", "disabled"] + ), + manage_provisioning_profiles=dict( + type="str", choices=["read", "write", "disabled"] + ), + vsx_provisioning=dict(type="bool"), + system_backup=dict(type="bool"), + system_restore=dict(type="bool"), + open_shell=dict(type="bool"), + run_one_time_script=dict(type="bool"), + run_repository_script=dict(type="bool"), + manage_repository_scripts=dict( + type="str", choices=["read", "write", "disabled"] + ), + ), + ), + management=dict( + type="dict", + options=dict( + cme_operations=dict( + type="str", choices=["read", "write", "disabled"] + ), + manage_admins=dict(type="bool"), + management_api_login=dict(type="bool"), + manage_sessions=dict(type="bool"), + high_availability_operations=dict(type="bool"), + approve_or_reject_sessions=dict(type="bool"), + publish_sessions=dict(type="bool"), + manage_integration_with_cloud_services=dict(type="bool"), + ), + ), + monitoring_and_logging=dict( + type="dict", + options=dict( + monitoring=dict( + type="str", choices=["read", "write", "disabled"] + ), + management_logs=dict( + type="str", choices=["read", "write", "disabled"] + ), + track_logs=dict( + type="str", choices=["read", "write", "disabled"] + ), + app_and_url_filtering_logs=dict(type="bool"), + https_inspection_logs=dict(type="bool"), + packet_capture_and_forensics=dict(type="bool"), + show_packet_capture_by_default=dict(type="bool"), + identities=dict(type="bool"), + show_identities_by_default=dict(type="bool"), + dlp_logs_including_confidential_fields=dict(type="bool"), + manage_dlp_messages=dict(type="bool"), + ), + ), + threat_prevention=dict( + type="dict", + options=dict( + policy_layers=dict( + type="str", choices=["read", "write", "disabled"] + ), + edit_layers=dict( + type="str", + choices=["By Selected Profile In A Layer Editor", "All"], + ), + edit_settings=dict(type="bool"), + policy_exceptions=dict( + type="str", choices=["read", "write", "disabled"] + ), + profiles=dict( + type="str", choices=["read", "write", "disabled"] + ), + protections=dict( + type="str", choices=["read", "write", "disabled"] + ), + install_policy=dict(type="bool"), + ips_update=dict(type="bool"), + ), + ), + others=dict( + type="dict", + options=dict( + client_certificates=dict(type="bool"), + edit_cp_users_db=dict(type="bool"), + https_inspection=dict( + type="str", choices=["read", "write", "disabled"] + ), + ldap_users_db=dict( + type="str", choices=["read", "write", "disabled"] + ), + user_authority_access=dict( + type="str", choices=["read", "write", "disabled"] + ), + user_device_mgmt_conf=dict( + type="str", choices=["read", "write", "disabled"] + ), + ), + ), + tags=dict(type="list", elements="str"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'domain-permissions-profile' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "domain-permissions-profile" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_domain_permissions_profile_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_domain_permissions_profile_facts.py index b923f3939..b3e2e8368 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_domain_permissions_profile_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_domain_permissions_profile_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -110,32 +112,43 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - filter=dict(type='str'), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - domains_to_process=dict(type='list', elements='str') + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + filter=dict(type="str"), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + domains_to_process=dict(type="list", elements="str"), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "domain-permissions-profile" api_call_object_plural_version = "domain-permissions-profiles" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_dynamic_global_network_object.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_dynamic_global_network_object.py new file mode 100644 index 000000000..63d904ca0 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_dynamic_global_network_object.py @@ -0,0 +1,136 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_dynamic_global_network_object +short_description: Manages dynamic-global-network-object objects on Checkpoint over Web Services API +description: + - Manages dynamic-global-network-object objects on Checkpoint devices including creating, updating and removing objects. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + name: + description: + - Object name. + type: str + required: True + tags: + description: + - Collection of tag identifiers. + type: list + elements: str + color: + description: + - Color of the object. Should be one of existing colors. + type: str + choices: ['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green', + 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', + 'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', 'yellow'] + comments: + description: + - Comments string. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + groups: + description: + - Collection of group identifiers. + type: list + elements: str + ignore_warnings: + description: + - Apply changes ignoring warnings. + type: bool + ignore_errors: + description: + - Apply changes ignoring errors. You won't be able to publish such a changes. If ignore-warnings flag was omitted - warnings will also be ignored. + type: bool +extends_documentation_fragment: check_point.mgmt.checkpoint_objects +""" + +EXAMPLES = """ +- name: add-dynamic-global-network-object + cp_mgmt_dynamic_global_network_object: + name: obj_global + state: present + +- name: set-dynamic-global-network-object + cp_mgmt_dynamic_global_network_object: + name: obj_global + tags: + - tag1 + state: present + +- name: delete-dynamic-global-network-object + cp_mgmt_dynamic_global_network_object: + name: obj_global + state: absent +""" + +RETURN = """ +cp_mgmt_dynamic_global_network_object: + description: The checkpoint object created or updated. + returned: always, except when deleting the object. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call + + +def main(): + argument_spec = dict( + name=dict(type='str', required=True), + tags=dict(type='list', elements='str'), + color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', + 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', + 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', + 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', + 'yellow']), + comments=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + groups=dict(type='list', elements='str'), + ignore_warnings=dict(type='bool'), + ignore_errors=dict(type='bool') + ) + argument_spec.update(checkpoint_argument_spec_for_objects) + + module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + api_call_object = 'dynamic-global-network-object' + + result = api_call(module, api_call_object) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_dynamic_global_network_object_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_dynamic_global_network_object_facts.py new file mode 100644 index 000000000..c850a614a --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_dynamic_global_network_object_facts.py @@ -0,0 +1,144 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_dynamic_global_network_object_facts +short_description: Get dynamic-global-network-object objects facts on Checkpoint over Web Services API +description: + - Get dynamic-global-network-object objects facts on Checkpoint devices. + - All operations are performed over Web Services API. + - This module handles both operations, get a specific object and get several objects, + For getting a specific object use the parameter 'name'. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + name: + description: + - Object name. + This parameter is relevant only for getting a specific object. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + filter: + description: + - Search expression to filter objects by. The provided text should be exactly the same as it would be given in SmartConsole Object Explorer. The + logical operators in the expression ('AND', 'OR') should be provided in capital letters. The search involves both a IP search and a textual search in + name, comment, tags etc. + type: str + limit: + description: + - The maximal number of returned results. + This parameter is relevant only for getting few objects. + type: int + offset: + description: + - Number of the results to initially skip. + This parameter is relevant only for getting few objects. + type: int + order: + description: + - Sorts the results by search criteria. Automatically sorts the results by Name, in the ascending order. + This parameter is relevant only for getting few objects. + type: list + elements: dict + suboptions: + ASC: + description: + - Sorts results by the given field in ascending order. + type: str + choices: ['name'] + DESC: + description: + - Sorts results by the given field in descending order. + type: str + choices: ['name'] + show_membership: + description: + - Indicates whether to calculate and show "groups" field for every object in reply. + type: bool + domains_to_process: + description: + - Indicates which domains to process the commands on. It cannot be used with the details-level full, must be run from the System Domain only and + with ignore-warnings true. Valid values are, CURRENT_DOMAIN, ALL_DOMAINS_ON_THIS_SERVER. + type: list + elements: str +extends_documentation_fragment: check_point.mgmt.checkpoint_facts +""" + +EXAMPLES = """ +- name: show-dynamic-global-network-object + cp_mgmt_dynamic_global_network_object_facts: + name: obj_global + +- name: show-dynamic-global-network-objects + cp_mgmt_dynamic_global_network_object_facts: + details_level: full +""" + +RETURN = """ +ansible_facts: + description: The checkpoint object facts. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts + + +def main(): + argument_spec = dict( + name=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + filter=dict(type='str'), + limit=dict(type='int'), + offset=dict(type='int'), + order=dict(type='list', elements='dict', options=dict( + ASC=dict(type='str', choices=['name']), + DESC=dict(type='str', choices=['name']) + )), + show_membership=dict(type='bool'), + domains_to_process=dict(type='list', elements='str') + ) + argument_spec.update(checkpoint_argument_spec_for_facts) + + module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + + api_call_object = "dynamic-global-network-object" + api_call_object_plural_version = "dynamic-global-network-objects" + + result = api_call_facts(module, api_call_object, api_call_object_plural_version) + module.exit_json(ansible_facts=result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_dynamic_object.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_dynamic_object.py index 1a7ce5fa5..9c5f908be 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_dynamic_object.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_dynamic_object.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -95,31 +97,72 @@ cp_mgmt_dynamic_object: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - tags=dict(type='list', elements='str'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + tags=dict(type="list", elements="str"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'dynamic-object' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "dynamic-object" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_dynamic_object_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_dynamic_object_facts.py index c049e0407..3cec1e3a9 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_dynamic_object_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_dynamic_object_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -99,31 +101,42 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - show_membership=dict(type='bool') + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + show_membership=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "dynamic-object" api_call_object_plural_version = "dynamic-objects" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_exception_group.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_exception_group.py index 025061d73..d7eda1482 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_exception_group.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_exception_group.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -139,41 +141,96 @@ cp_mgmt_exception_group: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - applied_profile=dict(type='str'), - applied_threat_rules=dict(type='dict', options=dict( - add=dict(type='list', elements='dict', options=dict( - layer=dict(type='str'), - name=dict(type='str'), - rule_number=dict(type='str'), - position=dict(type='str') - )) - )), - apply_on=dict(type='str', choices=['all-threat-rules', 'all-threat-rules-with-specific-profile', 'manually-select-threat-rules']), - tags=dict(type='list', elements='str'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + applied_profile=dict(type="str"), + applied_threat_rules=dict( + type="dict", + options=dict( + add=dict( + type="list", + elements="dict", + options=dict( + layer=dict(type="str"), + name=dict(type="str"), + rule_number=dict(type="str"), + position=dict(type="str"), + ), + ) + ), + ), + apply_on=dict( + type="str", + choices=[ + "all-threat-rules", + "all-threat-rules-with-specific-profile", + "manually-select-threat-rules", + ], + ), + tags=dict(type="list", elements="str"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'exception-group' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "exception-group" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_exception_group_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_exception_group_facts.py index cc88a3ab5..4ac4b11ba 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_exception_group_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_exception_group_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -98,30 +100,41 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )) + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "exception-group" api_call_object_plural_version = "exception-groups" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_export_management.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_export_management.py new file mode 100644 index 000000000..b8e111911 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_export_management.py @@ -0,0 +1,131 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_export_management +short_description: Export the primary Security Management Server database or the primary Multi-Domain Server database or the single Domain database and the + applicable Check Point configuration. +description: + - Export the primary Security Management Server database or the primary Multi-Domain Server database or the single Domain database and the applicable + Check Point configuration. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + file_path: + description: + - Path in which the exported database file is saved.<br><font color="red">Required only</font> when not using pre-export-verification-only flag. + type: str + domain_name: + description: + - Domain name to be exported.<br><font color="red">Required only for</font> exporting a Domain from the Multi-Domain Server or backing up Domain. + type: str + target_version: + description: + - Target version. + type: str + include_logs: + description: + - Export logs without log indexes. + type: bool + include_logs_indexes: + description: + - Export logs with log indexes. + type: bool + include_endpoint_configuration: + description: + - Include export of the Endpoint Security Management configuration files. + type: bool + include_endpoint_database: + description: + - Include export of the Endpoint Security Management database. + type: bool + is_domain_backup: + description: + - If true, the exported Domain will be suitable for import on the same Multi-Domain Server only. + type: bool + is_smc_to_mds: + description: + - If true, the exported Security Management Server will be suitable for import on the Multi-Domain Server only. + type: bool + pre_export_verification_only: + description: + - If true, only runs the pre-export verifications instead of the full export. + type: bool + ignore_warnings: + description: + - Ignoring the verification warnings. By Setting this parameter to 'true' export will not be blocked by warnings. + type: bool +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: export-management + cp_mgmt_export_management: + domain_name: domain1 + file_path: /var/log/domain1_backup.tgz + is_domain_backup: true +""" + +RETURN = """ +cp_mgmt_export_management: + description: The checkpoint export-management output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + file_path=dict(type='str'), + domain_name=dict(type='str',), + target_version=dict(type='str'), + include_logs=dict(type='bool'), + include_logs_indexes=dict(type='bool'), + include_endpoint_configuration=dict(type='bool'), + include_endpoint_database=dict(type='bool'), + is_domain_backup=dict(type='bool'), + is_smc_to_mds=dict(type='bool'), + pre_export_verification_only=dict(type='bool'), + ignore_warnings=dict(type='bool') + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "export-management" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_export_smart_task.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_export_smart_task.py new file mode 100644 index 000000000..e3cc8aee0 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_export_smart_task.py @@ -0,0 +1,85 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_export_smart_task +short_description: Export SmartTask to a file. +description: + - Export SmartTask to a file. <br>This command is available only in a Security Management environment or in Multi-Domain environment when logged into + local domain. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + name: + description: + - Name of task to be exported. + type: str + required: True + file_path: + description: + - Path to the SmartTask file to be exported. <br>Should be the full file path (example, "/home/admin/exported-smart-task.txt)".<br>If no path + was inserted the default will be, "/var/log/<task_name>.txt". + type: str +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: export-smart-task + cp_mgmt_export_smart_task: + name: Validate Session Name Before Publish +""" + +RETURN = """ +cp_mgmt_export_smart_task: + description: The checkpoint export-smart-task output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + name=dict(type='str', required=True), + file_path=dict(type='str') + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "export-smart-task" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_get_attachment.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_get_attachment.py new file mode 100644 index 000000000..452d1cf6f --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_get_attachment.py @@ -0,0 +1,82 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_get_attachment +short_description: Retrieves a packet capture or blob data, according to the attributes of a log record. +description: + - Retrieves a packet capture or blob data, according to the attributes of a log record. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + attachment_id: + description: + - Attachment identifier from a log record. + type: str + id: + description: + - Log id from a log record. + type: str +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: get-attachment + cp_mgmt_get_attachment: + attachment_id: MjY5HlNtYXJ0RGVmZW5zZR5jbj1jcF9tZ210LG89aHVnbzEtYmxvYkFwaS1uZXctdGFrZS0yLmNoZWNrcG9pbnQuY29tLnM2MjdvMx57MHg1OTg4 +""" + +RETURN = """ +cp_mgmt_get_attachment: + description: The checkpoint get-attachment output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + attachment_id=dict(type='str'), + id=dict(type='str') + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "get-attachment" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_get_interfaces.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_get_interfaces.py new file mode 100644 index 000000000..ad40a78e6 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_get_interfaces.py @@ -0,0 +1,99 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_get_interfaces +short_description: Get physical interfaces with or without their topology from a Gaia Security Gateway or Cluster. +description: + - Get physical interfaces with or without their topology from a Gaia Security Gateway or Cluster. + - The fetched topology is based on static routes. + - SIC must be established in the Security Gateway or Cluster Member object. + - Security Gateway or Cluster Members must be up and running. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + target_name: + description: + - Target name. + type: str + group_interfaces_by_subnet: + description: + - Specify whether to group the cluster interfaces by a subnet. + Otherwise, group the cluster interfaces by their names. + type: bool + use_defined_by_routes: + description: + - Specify whether to configure the topology "Defined by Routes" where applicable. + Otherwise, configure the topology to "This Network" as default for internal interfaces. + type: bool + with_topology: + description: + - Specify whether to fetch the interfaces with their topology. Otherwise, the Management Server fetches + the interfaces without their topology. + type: bool +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: get-interfaces + cp_mgmt_get_interfaces: + target_name: gw1 + with_topology: true +""" + +RETURN = """ +cp_mgmt_get_interfaces: + description: The checkpoint get-interfaces output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + target_name=dict(type='str'), + group_interfaces_by_subnet=dict(type='bool'), + use_defined_by_routes=dict(type='bool'), + with_topology=dict(type='bool') + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "get-interfaces" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_get_platform.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_get_platform.py index 21c5fb23b..c15f10cc2 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_get_platform.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_get_platform.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -60,13 +62,15 @@ cp_mgmt_get_platform: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): argument_spec = dict( - name=dict(type='str'), - auto_publish_session=dict(type='bool') + name=dict(type="str"), auto_publish_session=dict(type="bool") ) argument_spec.update(checkpoint_argument_spec_for_commands) @@ -78,5 +82,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_global_assignment.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_global_assignment.py index 08bce2b9b..c92404847 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_global_assignment.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_global_assignment.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -105,28 +107,33 @@ cp_mgmt_global_assignment: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - dependent_domain=dict(type='str'), - global_access_policy=dict(type='str'), - global_domain=dict(type='str'), - global_threat_prevention_policy=dict(type='str'), - manage_protection_actions=dict(type='bool'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + dependent_domain=dict(type="str"), + global_access_policy=dict(type="str"), + global_domain=dict(type="str"), + global_threat_prevention_policy=dict(type="str"), + manage_protection_actions=dict(type="bool"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'global-assignment' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "global-assignment" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_global_assignment_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_global_assignment_facts.py index be5c11788..e12fcbc48 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_global_assignment_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_global_assignment_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -102,31 +104,42 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - dependent_domain=dict(type='str'), - global_domain=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )) + dependent_domain=dict(type="str"), + global_domain=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "global-assignment" api_call_object_plural_version = "global-assignments" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_group.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_group.py index fd134ff1a..ca6f2fbd5 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_group.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_group.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -111,33 +113,74 @@ cp_mgmt_group: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - members=dict(type='list', elements='str'), - tags=dict(type='list', elements='str'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - groups=dict(type='list', elements='str'), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + members=dict(type="list", elements="str"), + tags=dict(type="list", elements="str"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + groups=dict(type="list", elements="str"), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'group' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "group" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_group_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_group_facts.py index baa5b2763..99ba466f1 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_group_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_group_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -112,33 +114,44 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - show_as_ranges=dict(type='bool'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - dereference_group_members=dict(type='bool'), - show_membership=dict(type='bool') + name=dict(type="str"), + show_as_ranges=dict(type="bool"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + dereference_group_members=dict(type="bool"), + show_membership=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "group" api_call_object_plural_version = "groups" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_group_with_exclusion.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_group_with_exclusion.py index 8497cd60d..ff9c6c561 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_group_with_exclusion.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_group_with_exclusion.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -115,34 +117,75 @@ cp_mgmt_group_with_exclusion: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - include=dict(type='str'), - tags=dict(type='list', elements='str'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - groups=dict(type='list', elements='str'), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + include=dict(type="str"), + tags=dict(type="list", elements="str"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + groups=dict(type="list", elements="str"), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) - argument_spec['except'] = dict(type='str') + argument_spec["except"] = dict(type="str") argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'group-with-exclusion' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "group-with-exclusion" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_group_with_exclusion_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_group_with_exclusion_facts.py index d2443e1cc..fe64b95be 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_group_with_exclusion_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_group_with_exclusion_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -104,31 +106,42 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - show_as_ranges=dict(type='bool'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )) + name=dict(type="str"), + show_as_ranges=dict(type="bool"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "group-with-exclusion" api_call_object_plural_version = "groups-with-exclusion" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_gsn_handover_group.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_gsn_handover_group.py new file mode 100644 index 000000000..8af0fee77 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_gsn_handover_group.py @@ -0,0 +1,155 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_gsn_handover_group +short_description: Manages gsn-handover-group objects on Checkpoint over Web Services API +description: + - Manages gsn-handover-group objects on Checkpoint devices including creating, updating and removing objects. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + name: + description: + - Object name. + type: str + required: True + enforce_gtp: + description: + - Enable enforce GTP signal packet rate limit from this group. + type: bool + gtp_rate: + description: + - Limit of the GTP rate in PDU/sec. + type: int + members: + description: + - Collection of GSN handover group members identified by the name or UID. + type: list + elements: str + tags: + description: + - Collection of tag identifiers. + type: list + elements: str + color: + description: + - Color of the object. Should be one of existing colors. + type: str + choices: ['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green', + 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', + 'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', 'yellow'] + comments: + description: + - Comments string. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + groups: + description: + - Collection of group identifiers. + type: list + elements: str + ignore_warnings: + description: + - Apply changes ignoring warnings. + type: bool + ignore_errors: + description: + - Apply changes ignoring errors. You won't be able to publish such a changes. If ignore-warnings flag was omitted - warnings will also be ignored. + type: bool +extends_documentation_fragment: check_point.mgmt.checkpoint_objects +""" + +EXAMPLES = """ +- name: add-gsn-handover-group + cp_mgmt_gsn_handover_group: + enforce_gtp: true + gtp_rate: 2048 + members: + - All_Internet + name: gsnhandovergroup + state: present + +- name: set-gsn-handover-group + cp_mgmt_gsn_handover_group: + enforce_gtp: false + name: gsnhandovergroup + state: present + +- name: delete-gsn-handover-group + cp_mgmt_gsn_handover_group: + name: gsnhandovergroup + state: absent +""" + +RETURN = """ +cp_mgmt_gsn_handover_group: + description: The checkpoint object created or updated. + returned: always, except when deleting the object. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call + + +def main(): + argument_spec = dict( + name=dict(type='str', required=True), + enforce_gtp=dict(type='bool'), + gtp_rate=dict(type='int'), + members=dict(type='list', elements='str'), + tags=dict(type='list', elements='str'), + color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', + 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', + 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', + 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', + 'yellow']), + comments=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + groups=dict(type='list', elements='str'), + ignore_warnings=dict(type='bool'), + ignore_errors=dict(type='bool') + ) + argument_spec.update(checkpoint_argument_spec_for_objects) + + module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + api_call_object = 'gsn-handover-group' + + result = api_call(module, api_call_object) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_gsn_handover_group_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_gsn_handover_group_facts.py new file mode 100644 index 000000000..0d01bbf15 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_gsn_handover_group_facts.py @@ -0,0 +1,149 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_gsn_handover_group_facts +short_description: Get gsn-handover-group objects facts on Checkpoint over Web Services API +description: + - Get gsn-handover-group objects facts on Checkpoint devices. + - All operations are performed over Web Services API. + - This module handles both operations, get a specific object and get several objects, + For getting a specific object use the parameter 'name'. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + name: + description: + - Object name. + This parameter is relevant only for getting a specific object. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + filter: + description: + - Search expression to filter objects by. The provided text should be exactly the same as it would be given in SmartConsole Object Explorer. The + logical operators in the expression ('AND', 'OR') should be provided in capital letters. The search involves both a IP search and a textual search in + name, comment, tags etc. + type: str + limit: + description: + - The maximal number of returned results. + This parameter is relevant only for getting few objects. + type: int + offset: + description: + - Number of the results to initially skip. + This parameter is relevant only for getting few objects. + type: int + order: + description: + - Sorts the results by search criteria. Automatically sorts the results by Name, in the ascending order. + This parameter is relevant only for getting few objects. + type: list + elements: dict + suboptions: + ASC: + description: + - Sorts results by the given field in ascending order. + type: str + choices: ['name'] + DESC: + description: + - Sorts results by the given field in descending order. + type: str + choices: ['name'] + dereference_group_members: + description: + - Indicates whether to dereference "members" field by details level for every object in reply. + type: bool + show_membership: + description: + - Indicates whether to calculate and show "groups" field for every object in reply. + type: bool + domains_to_process: + description: + - Indicates which domains to process the commands on. It cannot be used with the details-level full, must be run from the System Domain only and + with ignore-warnings true. Valid values are, CURRENT_DOMAIN, ALL_DOMAINS_ON_THIS_SERVER. + type: list + elements: str +extends_documentation_fragment: check_point.mgmt.checkpoint_facts +""" + +EXAMPLES = """ +- name: show-gsn-handover-group + cp_mgmt_gsn_handover_group_facts: + name: gsnhandovergroup + +- name: show-gsn-handover-groups + cp_mgmt_gsn_handover_group_facts: + details_level: full +""" + +RETURN = """ +ansible_facts: + description: The checkpoint object facts. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts + + +def main(): + argument_spec = dict( + name=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + filter=dict(type='str'), + limit=dict(type='int'), + offset=dict(type='int'), + order=dict(type='list', elements='dict', options=dict( + ASC=dict(type='str', choices=['name']), + DESC=dict(type='str', choices=['name']) + )), + dereference_group_members=dict(type='bool'), + show_membership=dict(type='bool'), + domains_to_process=dict(type='list', elements='str') + ) + argument_spec.update(checkpoint_argument_spec_for_facts) + + module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + + api_call_object = "gsn-handover-group" + api_call_object_plural_version = "gsn-handover-groups" + + result = api_call_facts(module, api_call_object, api_call_object_plural_version) + module.exit_json(ansible_facts=result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_ha_full_sync.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_ha_full_sync.py new file mode 100644 index 000000000..b53c45b42 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_ha_full_sync.py @@ -0,0 +1,83 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_ha_full_sync +short_description: Perform full sync from active server to standby peer. +description: + - Perform full sync from active server to standby peer. <br>Run this command from the active server. <br>When performing a full sync on the global + domain, use the Multi Domain Server name of the standby global domain. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + name: + description: + - Peer name (Multi Domain Server, Domain Server or Security Management Server). + type: str + ignore_errors: + description: + - Apply changes ignoring errors. + type: bool +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: ha-full-sync + cp_mgmt_ha_full_sync: + name: mypeer +""" + +RETURN = """ +cp_mgmt_ha_full_sync: + description: The checkpoint ha-full-sync output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + name=dict(type='str'), + ignore_errors=dict(type='bool') + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "ha-full-sync" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_host.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_host.py index 5ec16c1f7..acceffd16 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_host.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_host.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["deprecated"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -34,6 +36,10 @@ description: - All operations are performed over Web Services API. version_added: "1.0.0" author: "Or Soffer (@chkp-orso)" +deprecated: + alternative: cp_mgmt_hosts + why: Newer and updated modules released with more functionality. + removed_at_date: '2024-11-01' options: name: description: @@ -264,75 +270,178 @@ cp_mgmt_host: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - ip_address=dict(type='str'), - ipv4_address=dict(type='str'), - ipv6_address=dict(type='str'), - interfaces=dict(type='list', elements='dict', options=dict( - name=dict(type='str'), - subnet=dict(type='str'), - subnet4=dict(type='str'), - subnet6=dict(type='str'), - mask_length=dict(type='int'), - mask_length4=dict(type='int'), - mask_length6=dict(type='int'), - subnet_mask=dict(type='str'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', - 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', - 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', - 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', - 'sienna', 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') - )), - nat_settings=dict(type='dict', options=dict( - auto_rule=dict(type='bool'), - ip_address=dict(type='str'), - ipv4_address=dict(type='str'), - ipv6_address=dict(type='str'), - hide_behind=dict(type='str', choices=['gateway', 'ip-address']), - install_on=dict(type='str'), - method=dict(type='str', choices=['hide', 'static']) - )), - tags=dict(type='list', elements='str'), - host_servers=dict(type='dict', options=dict( - dns_server=dict(type='bool'), - mail_server=dict(type='bool'), - web_server=dict(type='bool'), - web_server_config=dict(type='dict', options=dict( - additional_ports=dict(type='list', elements='str'), - application_engines=dict(type='list', elements='str'), - listen_standard_port=dict(type='bool'), - operating_system=dict(type='str', choices=['sparc linux', 'windows', 'other', 'x86 linux', 'sparc solaris']), - protected_by=dict(type='str') - )) - )), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - groups=dict(type='list', elements='str'), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + ip_address=dict(type="str"), + ipv4_address=dict(type="str"), + ipv6_address=dict(type="str"), + interfaces=dict( + type="list", + elements="dict", + options=dict( + name=dict(type="str"), + subnet=dict(type="str"), + subnet4=dict(type="str"), + subnet6=dict(type="str"), + mask_length=dict(type="int"), + mask_length4=dict(type="int"), + mask_length6=dict(type="int"), + subnet_mask=dict(type="str"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict( + type="str", choices=["uid", "standard", "full"] + ), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), + ), + ), + nat_settings=dict( + type="dict", + options=dict( + auto_rule=dict(type="bool"), + ip_address=dict(type="str"), + ipv4_address=dict(type="str"), + ipv6_address=dict(type="str"), + hide_behind=dict( + type="str", choices=["gateway", "ip-address"] + ), + install_on=dict(type="str"), + method=dict(type="str", choices=["hide", "static"]), + ), + ), + tags=dict(type="list", elements="str"), + host_servers=dict( + type="dict", + options=dict( + dns_server=dict(type="bool"), + mail_server=dict(type="bool"), + web_server=dict(type="bool"), + web_server_config=dict( + type="dict", + options=dict( + additional_ports=dict(type="list", elements="str"), + application_engines=dict(type="list", elements="str"), + listen_standard_port=dict(type="bool"), + operating_system=dict( + type="str", + choices=[ + "sparc linux", + "windows", + "other", + "x86 linux", + "sparc solaris", + ], + ), + protected_by=dict(type="str"), + ), + ), + ), + ), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + groups=dict(type="list", elements="str"), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'host' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "host" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_host_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_host_facts.py index 597b817f6..fc54164d2 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_host_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_host_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -102,31 +104,42 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - show_membership=dict(type='bool') + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + show_membership=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "host" api_call_object_plural_version = "hosts" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_hosts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_hosts.py new file mode 100644 index 000000000..61d0ae53e --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_hosts.py @@ -0,0 +1,581 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright 2022 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +""" +The module file for cp_mgmt_hosts +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +module: cp_mgmt_hosts +short_description: Manages HOSTS resource module +description: + - This resource module allows for addition, deletion, or modification of CP MGMT Hosts. + - This resource module also takes care of gathering Hosts config facts +version_added: "5.0.0" +author: Ansible Security Automation Team (@justjais) <https://github.com/ansible-security>- +options: + config: + description: A dictionary of HOSTS options + type: dict + suboptions: + name: + description: Object name. Must be unique in the domain. + type: str + ip_address: + description: IPv4 or IPv6 address. If both addresses are required use ipv4-address + and ipv6-address fields explicitly. + type: str + ipv4_address: + description: IPv4 address. + type: str + ipv6_address: + description: IPv4 address. + type: str + interfaces: + description: Host interfaces. + type: list + elements: dict + suboptions: + name: + description: + - Interface name. + type: str + subnet: + description: + - IPv4 or IPv6 network address. + - If both addresses are required use subnet4 and subnet6 fields explicitly. + type: str + subnet4: + description: + - IPv4 network address. + type: str + subnet6: + description: + - IPv6 network address. + type: str + mask_length: + description: + - IPv4 or IPv6 network mask length. If both masks are required use mask-length4 and + mask-length6 fields explicitly. + - Instead of IPv4 mask length it is possible to specify IPv4 mask itself in subnet-mask field. + type: int + mask_length4: + description: + - IPv4 network mask length. + type: int + mask_length6: + description: + - IPv6 network mask length. + type: int + subnet_mask: + description: + - IPv4 network mask. + type: str + color: + description: + - Color of the object. Should be one of existing colors. + type: str + choices: + - 'aquamarine' + - 'black' + - 'blue' + - 'crete blue' + - 'burlywood' + - 'cyan' + - 'dark green' + - 'khaki' + - 'orchid' + - 'dark orange' + - 'dark sea green' + - 'pink' + - 'turquoise' + - 'dark blue' + - 'firebrick' + - 'brown' + - 'forest green' + - 'gold' + - 'dark gold' + - 'gray' + - 'dark gray' + - 'light green' + - 'lemon chiffon' + - 'coral' + - 'sea green' + - 'sky blue' + - 'magenta' + - 'purple' + - 'slate blue' + - 'violet red' + - 'navy blue' + - 'olive' + - 'orange' + - 'red' + - 'sienna' + - 'yellow' + comments: + description: + - Comments string. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing + only the UID value of the object to a fully detailed representation of the object. + type: str + choices: + - 'uid' + - 'standard' + - 'full' + ignore_warnings: + description: + - Apply changes ignoring warnings. + type: bool + ignore_errors: + description: + - Apply changes ignoring errors. You won't be able to publish such a changes. + - If ignore-warnings flag was omitted - warnings will also be ignored. + type: bool + nat_settings: + description: NAT settings. + type: dict + suboptions: + auto_rule: + description: + - Whether to add automatic address translation rules. + type: bool + ip_address: + description: + - IPv4 or IPv6 address. If both addresses are required use ipv4-address and ipv6-address fields explicitly. + - This parameter is not required in case "method" parameter is "hide" and "hide-behind" parameter is "gateway". + type: str + ipv4_address: + description: + - IPv4 address. + type: str + ipv6_address: + description: + - IPv6 address. + type: str + hide_behind: + description: + - Hide behind method. This parameter is not required in case "method" parameter is "static". + type: str + choices: + - 'gateway' + - 'ip-address' + install_on: + description: + - Which gateway should apply the NAT translation. + type: str + method: + description: + - NAT translation method. + type: str + choices: + - 'hide' + - 'static' + tags: + description: Collection of tag identifiers. + type: list + elements: str + host_servers: + description: Servers Configuration. + type: dict + suboptions: + dns_server: + description: Gets True if this server is a DNS Server. + type: bool + mail_server: + description: Gets True if this server is a Mail Server. + type: bool + web_server: + description: Gets True if this server is a Web Server. + type: bool + web_server_config: + description: Web Server configuration. + type: dict + suboptions: + additional_ports: + description: + - Server additional ports. + type: list + elements: str + application_engines: + description: + - Application engines of this web server. + type: list + elements: str + listen_standard_port: + description: + - Whether server listens to standard port. + type: bool + operating_system: + description: + - Operating System. + type: str + choices: + - 'sparc linux' + - 'windows' + - 'other' + - 'x86 linux' + - 'sparc solaris' + protected_by: + description: + - Network object which protects this server identified by the name or UID. + type: str + color: + description: Color of the object. Should be one of existing colors. + type: str + choices: + - aquamarine + - black + - blue + - crete blue + - burlywood + - cyan + - dark green + - khaki + - orchid + - dark orange + - dark sea green + - pink + - turquoise + - dark blue + - firebrick + - brown + - forest green + - gold + - dark gold + - gray + - dark gray + - light green + - lemon chiffon + - coral + - sea green + - sky blue + - magenta + - purple + - slate blue + - violet red + - navy blue + - olive + - orange + - red + - sienna + - yellow + comments: + description: Comments string. + type: str + details_level: + description: The level of detail for some of the fields in the response can + vary from showing only the UID value of the object to a fully detailed representation + of the object. + type: str + choices: + - uid + - standard + - full + groups: + description: Collection of group identifiers. + type: list + elements: str + ignore_warnings: + description: Apply changes ignoring warnings. + type: bool + ignore_errors: + description: Apply changes ignoring errors. You won't be able to publish such + a changes. If ignore-warnings flag was omitted - warnings will also be ignored. + type: bool + limit: + description: + - The maximal number of returned results. + - NOTE, this parameter is a valid parameter only for the GATHERED state, for config states + like, MERGED, REPLACED, and DELETED state it won't be applicable. + type: int + offset: + description: + - Number of the results to initially skip. + - NOTE, this parameter is a valid parameter only for the GATHERED state, for config states + like, MERGED, REPLACED, and DELETED state it won't be applicable. + type: int + order: + description: + - Sorts results by the given field. By default the results are sorted in the ascending order by name. + This parameter is relevant only for getting few objects. + - NOTE, this parameter is a valid parameter only for the GATHERED state, for config states + like, MERGED, REPLACED, and DELETED state it won't be applicable. + type: list + elements: dict + suboptions: + ASC: + description: + - Sorts results by the given field in ascending order. + type: str + DESC: + description: + - Sorts results by the given field in descending order. + type: str + round_trip: + description: + - If set to True, the round trip will filter out the module parameters from the response param, + which will enable the user to fire the config request using the structured gathered data. + - NOTE, this parameter makes relevance only with the GATHERED state, as for config states like, + MERGED, REPLACED, and DELETED state it won't make any config updates, + as it's not a module config parameter. + type: bool + auto_publish_session: + description: + - Publish the current session if changes have been performed + after task completes. + type: bool + version: + description: + - Version of checkpoint. If not given one, the latest version taken. + type: str + state: + description: + - The state the configuration should be left in + - The state I(gathered) will get the module API configuration from the device + and transform it into structured data in the format as per the module argspec + and the value is returned in the I(gathered) key within the result. + type: str + choices: + - merged + - replaced + - gathered + - deleted +""" + +EXAMPLES = """ + +# Using MERGED state +# ------------------- + +- name: Merge MGMT Hosts config + cp_mgmt_hosts: + state: merged + config: + color: cyan + ip_address: 192.0.2.1 + name: New Host 1 + auto_publish_session: true + tags: + - New Host + round_trip: true + +# RUN output: +# ----------- + +# mgmt_hosts: +# after: +# color: cyan +# comments: '' +# groups: [] +# icon: Objects/host +# interfaces: [] +# ipv4-address: 192.0.2.1 +# name: New Host 1 +# nat_settings: {} +# tags: +# - New Host +# before: {} + +# Using REPLACED state +# -------------------- + +- name: Replace MGMT Host config + cp_mgmt_hosts: + state: replaced + config: + name: New Host 1 + tags: + - New Replaced Host + color: aquamarine + ip_address: 198.51.110.0 + comments: REPLACED description + ignore_warnings: true + ignore_errors: false + auto_publish_session: true + round_trip: true + +# RUN output: +# ----------- + +# mgmt_hosts: +# after: +# color: aquamarine +# comments: REPLACED description +# groups: [] +# icon: Objects/host +# interfaces: [] +# ipv4-address: 198.51.110.0 +# name: New Host 1 +# nat_settings: {} +# tags: +# - New Replaced Host +# before: +# color: cyan +# comments: '' +# groups: [] +# icon: Objects/host +# interfaces: [] +# ipv4-address: 192.0.2.1 +# name: New Host 1 +# nat_settings: {} +# tags: +# - New Host + +# Using GATHERED state +# -------------------- + +# 1. With Round Trip set to True + +- name: Gather MGMT Host config by Name + cp_mgmt_hosts: + state: gathered + config: + name: New Host 1 + +# RUN output: +# ----------- + +# gathered: +# color: cyan +# comments: REPLACED description +# domain: SMC User +# groups: [] +# icon: Objects/host +# interfaces: [] +# ipv4-address: 192.0.2.1 +# name: New Host 1 +# nat_settings: {} +# read-only: false +# tags: +# - New Host +# uid: 63b868bb-d300-47f4-b97a-c465a56fe9c7 + +# 2. With Round Trip set to False which is the default behaviour + +- name: Gather MGMT Host config by Name + cp_mgmt_hosts: + state: gathered + config: + name: New Host 1 + +# RUN output: +# ----------- + +# gathered: +# color: cyan +# comments: '' +# domain: +# domain-type: domain +# name: SMC User +# uid: 41e821a0-3720-11e3-aa6e-0800200c9fde +# groups: [] +# icon: Objects/host +# interfaces: [] +# ipv4-address: 192.0.2.1 +# meta-info: +# creation-time: +# iso-8601: 2022-11-21T08:31+0000 +# posix: 1669019480328 +# creator: admin +# last-modifier: admin +# last-modify-time: +# iso-8601: 2022-11-21T08:31+0000 +# posix: 1669019480328 +# lock: unlocked +# validation-state: ok +# name: New Host 1 +# nat_settings: {} +# read-only: false +# tags: +# - domain: +# domain-type: domain +# name: SMC User +# uid: 41e821a0-3720-11e3-aa6e-0800200c9fde +# name: New Host +# type: tag +# uid: 94d53896-3cee-4e1f-a83b-3abac80bf512 +# type: host +# uid: 8f23a44b-d9d2-4242-8a9e-2a4cbb6723ff + +# 3. Gather ALL threat-layer config with DESC order filter + +- name: Gather All hosts on the MGMT instance + cp_mgmt_hosts: + config: + details_level: full + state: gathered + +# RUN output: +# ----------- + +# gathered: +# - domain: +# domain-type: domain +# name: SMC User +# uid: 41e821a0-3720-11e3-aa6e-0800200c9fde +# ipv4-address: 192.0.2.1 +# name: New Host 1 +# type: host +# uid: 8f23a44b-d9d2-4242-8a9e-2a4cbb6723ff + +# Using DELETED state +# ------------------- + +- name: Delete MGMT Host config by Name + cp_mgmt_hosts: + state: deleted + config: + name: New Host 1 + round_trip: true + +# RUN output: +# ----------- + +# mgmt_hosts: +# after: {} +# before: +# color: cyan +# comments: REPLACED description +# groups: [] +# icon: Objects/host +# interfaces: [] +# ipv4-address: 192.0.2.1 +# name: New Host 1 +# nat_settings: {} +# tags: +# - New Host +""" + +RETURN = """ +before: + description: The configuration prior to the module execution. + returned: when state is I(merged), I(replaced), I(deleted) + type: dict + sample: > + This output will always be in the same format as the + module argspec. +after: + description: The resulting configuration after module execution. + returned: when changed + type: dict + sample: > + This output will always be in the same format as the + module argspec. +gathered: + description: Facts about the network resource gathered from the remote device as structured data. + returned: when state is I(gathered) + type: dict + sample: > + This output will always be in the same format as the + module argspec. +""" diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_https_layer.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_https_layer.py new file mode 100644 index 000000000..697a922c1 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_https_layer.py @@ -0,0 +1,134 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_https_layer +short_description: Manages https-layer objects on Checkpoint over Web Services API +description: + - Manages https-layer objects on Checkpoint devices including creating, updating and removing objects. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + name: + description: + - Object name. + type: str + required: True + shared: + description: + - Define the Layer as Shared (TRUE/FALSE). + type: bool + tags: + description: + - Collection of tag identifiers. + type: list + elements: str + color: + description: + - Color of the object. Should be one of existing colors. + type: str + choices: ['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green', + 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', + 'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', 'yellow'] + comments: + description: + - Comments string. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + ignore_warnings: + description: + - Apply changes ignoring warnings. + type: bool + ignore_errors: + description: + - Apply changes ignoring errors. You won't be able to publish such a changes. If ignore-warnings flag was omitted - warnings will also be ignored. + type: bool +extends_documentation_fragment: check_point.mgmt.checkpoint_objects +""" + +EXAMPLES = """ +- name: add-https-layer + cp_mgmt_https_layer: + name: New Layer 1 + state: present + +- name: set-https-layer + cp_mgmt_https_layer: + name: New Layer 1 + shared: true + state: present + +- name: delete-https-layer + cp_mgmt_https_layer: + name: New Layer 2 + state: absent +""" + +RETURN = """ +cp_mgmt_https_layer: + description: The checkpoint object created or updated. + returned: always, except when deleting the object. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call + + +def main(): + argument_spec = dict( + name=dict(type='str', required=True), + shared=dict(type='bool'), + tags=dict(type='list', elements="str"), + color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', + 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', + 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', + 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', + 'yellow']), + comments=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + ignore_warnings=dict(type='bool'), + ignore_errors=dict(type='bool') + ) + argument_spec.update(checkpoint_argument_spec_for_objects) + + module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + api_call_object = 'https-layer' + + result = api_call(module, api_call_object) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_https_layer_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_https_layer_facts.py new file mode 100644 index 000000000..0b74766c3 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_https_layer_facts.py @@ -0,0 +1,141 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_https_layer_facts +short_description: Get https-layer objects facts on Checkpoint over Web Services API +description: + - Get https-layer objects facts on Checkpoint devices. + - All operations are performed over Web Services API. + - This module handles both operations, get a specific object and get several objects, + For getting a specific object use the parameter 'name'. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + name: + description: + - Object name. + This parameter is relevant only for getting a specific object. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + filter: + description: + - Search expression to filter objects by. The provided text should be exactly the same as it would be given in SmartConsole Object Explorer. The + logical operators in the expression ('AND', 'OR') should be provided in capital letters. The search involves both a IP search and a textual search in + name, comment, tags etc. + type: str + limit: + description: + - The maximal number of returned results. + This parameter is relevant only for getting few objects. + type: int + offset: + description: + - Number of the results to initially skip. + This parameter is relevant only for getting few objects. + type: int + order: + description: + - Sorts the results by search criteria. Automatically sorts the results by Name, in the ascending order. + This parameter is relevant only for getting few objects. + type: list + elements: dict + suboptions: + ASC: + description: + - Sorts results by the given field in ascending order. + type: str + choices: ['name'] + DESC: + description: + - Sorts results by the given field in descending order. + type: str + choices: ['name'] + domains_to_process: + description: + - Indicates which domains to process the commands on. It cannot be used with the details-level full, must be run from the System Domain only and + with ignore-warnings true. Valid values are, CURRENT_DOMAIN, ALL_DOMAINS_ON_THIS_SERVER. + type: list + elements: str +extends_documentation_fragment: check_point.mgmt.checkpoint_facts +""" + +EXAMPLES = """ +- name: show-https-layer + cp_mgmt_https_layer_facts: + name: New Layer 1 + +- name: show-https-layers + cp_mgmt_https_layer_facts: + details_level: standard + limit: 50 + offset: 0 +""" + +RETURN = """ +ansible_facts: + description: The checkpoint object facts. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts + + +def main(): + argument_spec = dict( + name=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + filter=dict(type='str'), + limit=dict(type='int'), + offset=dict(type='int'), + order=dict(type='list', elements="dict", options=dict( + ASC=dict(type='str', choices=['name']), + DESC=dict(type='str', choices=['name']) + )), + domains_to_process=dict(type='list', elements="str") + ) + argument_spec.update(checkpoint_argument_spec_for_facts) + + module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + + api_call_object = "https-layer" + api_call_object_plural_version = "https-layers" + + result = api_call_facts(module, api_call_object, api_call_object_plural_version) + module.exit_json(ansible_facts=result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_https_section.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_https_section.py index aba2a6a89..bdc3f3ff5 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_https_section.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_https_section.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -94,26 +96,31 @@ cp_mgmt_https_section: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - layer=dict(type='str'), - position=dict(type='str'), - name=dict(type='str', required=True), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + layer=dict(type="str"), + position=dict(type="str"), + name=dict(type="str", required=True), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'https-section' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "https-section" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_identity_tag.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_identity_tag.py index 782375d67..b0f45a656 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_identity_tag.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_identity_tag.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -104,32 +106,73 @@ cp_mgmt_identity_tag: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - external_identifier=dict(type='str'), - tags=dict(type='list', elements='str'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + external_identifier=dict(type="str"), + tags=dict(type="list", elements="str"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'identity-tag' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "identity-tag" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_identity_tag_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_identity_tag_facts.py index 07618264b..107d6cceb 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_identity_tag_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_identity_tag_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -108,32 +110,43 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - filter=dict(type='str'), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - domains_to_process=dict(type='list', elements='str') + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + filter=dict(type="str"), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + domains_to_process=dict(type="list", elements="str"), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "identity-tag" api_call_object_plural_version = "identity-tags" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_idp_administrator_group.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_idp_administrator_group.py index ec08c8f3b..788111440 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_idp_administrator_group.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_idp_administrator_group.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -124,37 +126,79 @@ cp_mgmt_idp_administrator_group: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - group_id=dict(type='str'), - multi_domain_profile=dict(type='str'), - permissions_profile=dict(type='list', elements='dict', options=dict( - domain=dict(type='str'), - profile=dict(type='str') - )), - tags=dict(type='list', elements='str'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + group_id=dict(type="str"), + multi_domain_profile=dict(type="str"), + permissions_profile=dict( + type="list", + elements="dict", + options=dict(domain=dict(type="str"), profile=dict(type="str")), + ), + tags=dict(type="list", elements="str"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'idp-administrator-group' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "idp-administrator-group" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_idp_administrator_group_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_idp_administrator_group_facts.py index bbe358d71..7df43f693 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_idp_administrator_group_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_idp_administrator_group_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -107,32 +109,43 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - filter=dict(type='str'), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - domains_to_process=dict(type='list', elements='str') + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + filter=dict(type="str"), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + domains_to_process=dict(type="list", elements="str"), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "idp-administrator-group" api_call_object_plural_version = "idp-administrator-groups" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_idp_to_domain_assignment_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_idp_to_domain_assignment_facts.py index 41f30a52e..a1fb64a98 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_idp_to_domain_assignment_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_idp_to_domain_assignment_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -95,30 +97,41 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - assigned_domain=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )) + assigned_domain=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "idp-to-domain-assignment" api_call_object_plural_version = "idp-to-domain-assignments" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_import_management.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_import_management.py new file mode 100644 index 000000000..fbc45a1b6 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_import_management.py @@ -0,0 +1,139 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_import_management +short_description: Import the primary Security Management Server database or the primary Multi-Domain Server database or the single Domain database and the + applicable Check Point configuration. +description: + - Import the primary Security Management Server database or the primary Multi-Domain Server database or the single Domain database and the applicable + Check Point configuration. <br/>After the import starts, the session expires and you must login again. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + file_path: + description: + - Path to the exported database file to be imported. + type: str + required: True + domain_name: + description: + - Domain name to be imported. Must be unique in the Multi-Domain Server.<br><font color="red">Required only for</font> importing the Security + Management Server into the Multi-Domain Server. + type: str + domain_ip_address: + description: + - IPv4 address for the imported Domain.<br><font color="red">Required only for</font> importing the Security Management Server into the + Multi-Domain Server. + type: str + domain_server_name: + description: + - Multi-Domain Server name for the imported Domain.<br><font color="red">Required only for</font> importing the Security Management Server into + the Multi-Domain Server. + type: str + include_logs: + description: + - Import logs without log indexes. + type: bool + include_logs_indexes: + description: + - Import logs with log indexes. + type: bool + keep_cloud_sharing: + description: + - Preserve the connection of the Management Server to Check Point's Infinity Portal.<br>Use this flag after ensuring that the original + Management Server does not communicate with Infinity Portal.<br>Note, resuming the connection is also possible after import with set-cloud-services. + type: bool + include_endpoint_configuration: + description: + - Include import of the Endpoint Security Management configuration files. + type: bool + include_endpoint_database: + description: + - Include import of the Endpoint Security Management database. + type: bool + verify_domain_restore: + description: + - If true, verify that the restore operation is valid for this input file and this environment. <br>Note, Restore operation will not be executed. + type: bool + pre_import_verification_only: + description: + - If true, only runs the pre-import verifications instead of the full import. + type: bool + ignore_warnings: + description: + - Ignoring the verification warnings. By Setting this parameter to 'true' import will not be blocked by warnings. + type: bool +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: import-management + cp_mgmt_import_management: + file_path: /var/log/domain1_exported.tgz +""" + +RETURN = """ +cp_mgmt_import_management: + description: The checkpoint import-management output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + file_path=dict(type='str', required=True), + domain_name=dict(type='str'), + domain_ip_address=dict(type='str'), + domain_server_name=dict(type='str'), + include_logs=dict(type='bool'), + include_logs_indexes=dict(type='bool'), + keep_cloud_sharing=dict(type='bool'), + include_endpoint_configuration=dict(type='bool'), + include_endpoint_database=dict(type='bool'), + verify_domain_restore=dict(type='bool'), + pre_import_verification_only=dict(type='bool'), + ignore_warnings=dict(type='bool') + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "import-management" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_import_smart_task.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_import_smart_task.py new file mode 100644 index 000000000..712a8bdfd --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_import_smart_task.py @@ -0,0 +1,79 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_import_smart_task +short_description: Import SmartTask from a file. +description: + - Import SmartTask from a file. <br>This command is available only in a Security Management environment or in Multi-Domain environment when logged into + local domain. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + file_path: + description: + - Path to the SmartTask file to be imported. <br>Should be the full file path (example, "/home/admin/exported-smart-task.txt"). + type: str + required: True +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: import-smart-task + cp_mgmt_import_smart_task: + file_path: /home/admin/smart-task.txt +""" + +RETURN = """ +cp_mgmt_import_smart_task: + description: The checkpoint import-smart-task output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + file_path=dict(type='str', required=True) + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "import-smart-task" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_install_database.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_install_database.py index aba149118..e256c7063 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_install_database.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_install_database.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -59,13 +61,14 @@ cp_mgmt_install_database: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): - argument_spec = dict( - targets=dict(type='list', elements='str') - ) + argument_spec = dict(targets=dict(type="list", elements="str")) argument_spec.update(checkpoint_argument_spec_for_commands) module = AnsibleModule(argument_spec=argument_spec) @@ -76,5 +79,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_install_lsm_policy.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_install_lsm_policy.py index 60cc030dd..bc04c467e 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_install_lsm_policy.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_install_lsm_policy.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -59,13 +61,14 @@ cp_mgmt_install_lsm_policy: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): - argument_spec = dict( - targets=dict(type='list', elements='str') - ) + argument_spec = dict(targets=dict(type="list", elements="str")) argument_spec.update(checkpoint_argument_spec_for_commands) module = AnsibleModule(argument_spec=argument_spec) @@ -76,5 +79,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_install_lsm_settings.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_install_lsm_settings.py index 53fba12d1..b3fd2e4f5 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_install_lsm_settings.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_install_lsm_settings.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -59,13 +61,14 @@ cp_mgmt_install_lsm_settings: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): - argument_spec = dict( - targets=dict(type='list', elements='str') - ) + argument_spec = dict(targets=dict(type="list", elements="str")) argument_spec.update(checkpoint_argument_spec_for_commands) module = AnsibleModule(argument_spec=argument_spec) @@ -76,5 +79,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_install_policy.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_install_policy.py index 4a14111d2..56c70b5ad 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_install_policy.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_install_policy.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -98,20 +100,23 @@ cp_mgmt_install_policy: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): argument_spec = dict( - policy_package=dict(type='str'), - targets=dict(type='list', elements='str'), - access=dict(type='bool'), - desktop_security=dict(type='bool'), - qos=dict(type='bool'), - threat_prevention=dict(type='bool'), - install_on_all_cluster_members_or_fail=dict(type='bool'), - prepare_only=dict(type='bool'), - revision=dict(type='str') + policy_package=dict(type="str"), + targets=dict(type="list", elements="str"), + access=dict(type="bool"), + desktop_security=dict(type="bool"), + qos=dict(type="bool"), + threat_prevention=dict(type="bool"), + install_on_all_cluster_members_or_fail=dict(type="bool"), + prepare_only=dict(type="bool"), + revision=dict(type="str"), ) argument_spec.update(checkpoint_argument_spec_for_commands) @@ -123,5 +128,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_install_software_package.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_install_software_package.py index 3a967e6cb..93bc9f371 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_install_software_package.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_install_software_package.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -92,20 +94,28 @@ cp_mgmt_install_software_package: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): argument_spec = dict( - name=dict(type='str'), - targets=dict(type='list', elements='str'), - cluster_installation_settings=dict(type='dict', options=dict( - cluster_delay=dict(type='int'), - cluster_strategy=dict(type='str') - )), - concurrency_limit=dict(type='int'), - method=dict(type='str', choices=['install', 'upgrade']), - package_location=dict(type='str', choices=['automatic', 'target-machine', 'central']) + name=dict(type="str"), + targets=dict(type="list", elements="str"), + cluster_installation_settings=dict( + type="dict", + options=dict( + cluster_delay=dict(type="int"), + cluster_strategy=dict(type="str"), + ), + ), + concurrency_limit=dict(type="int"), + method=dict(type="str", choices=["install", "upgrade"]), + package_location=dict( + type="str", choices=["automatic", "target-machine", "central"] + ), ) argument_spec.update(checkpoint_argument_spec_for_commands) @@ -117,5 +127,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_interoperable_device.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_interoperable_device.py index 9416e810e..cd3fd2636 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_interoperable_device.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_interoperable_device.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -249,71 +251,169 @@ cp_mgmt_interoperable_device: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - ip_address=dict(type='str'), - ipv4_address=dict(type='str'), - ipv6_address=dict(type='str'), - interfaces=dict(type='list', elements='dict', options=dict( - name=dict(type='str'), - ip_address=dict(type='str'), - ipv4_address=dict(type='str'), - ipv6_address=dict(type='str'), - network_mask=dict(type='str'), - ipv4_network_mask=dict(type='str'), - ipv6_network_mask=dict(type='str'), - mask_length=dict(type='str'), - ipv4_mask_length=dict(type='str'), - ipv6_mask_length=dict(type='str'), - tags=dict(type='list', elements='str'), - topology=dict(type='str', choices=['external', 'internal']), - topology_settings=dict(type='dict', options=dict( - interface_leads_to_dmz=dict(type='bool'), - ip_address_behind_this_interface=dict(type='str', choices=['not defined', 'network defined by the interface ip and net mask', - 'network defined by routing', 'specific']), - specific_network=dict(type='str') - )), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', - 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', - 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', - 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', - 'sienna', 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - domains_to_process=dict(type='list', elements='str'), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') - )), - vpn_settings=dict(type='dict', options=dict( - vpn_domain=dict(type='str'), - vpn_domain_exclude_external_ip_addresses=dict(type='bool'), - vpn_domain_type=dict(type='str', choices=['manual', 'addresses_behind_gw']) - )), - tags=dict(type='list', elements='str'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - domains_to_process=dict(type='list', elements='str'), - ignore_warnings=dict(type='bool'), - groups=dict(type='list', elements='str'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + ip_address=dict(type="str"), + ipv4_address=dict(type="str"), + ipv6_address=dict(type="str"), + interfaces=dict( + type="list", + elements="dict", + options=dict( + name=dict(type="str"), + ip_address=dict(type="str"), + ipv4_address=dict(type="str"), + ipv6_address=dict(type="str"), + network_mask=dict(type="str"), + ipv4_network_mask=dict(type="str"), + ipv6_network_mask=dict(type="str"), + mask_length=dict(type="str"), + ipv4_mask_length=dict(type="str"), + ipv6_mask_length=dict(type="str"), + tags=dict(type="list", elements="str"), + topology=dict(type="str", choices=["external", "internal"]), + topology_settings=dict( + type="dict", + options=dict( + interface_leads_to_dmz=dict(type="bool"), + ip_address_behind_this_interface=dict( + type="str", + choices=[ + "not defined", + "network defined by the interface ip and net mask", + "network defined by routing", + "specific", + ], + ), + specific_network=dict(type="str"), + ), + ), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict( + type="str", choices=["uid", "standard", "full"] + ), + domains_to_process=dict(type="list", elements="str"), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), + ), + ), + vpn_settings=dict( + type="dict", + options=dict( + vpn_domain=dict(type="str"), + vpn_domain_exclude_external_ip_addresses=dict(type="bool"), + vpn_domain_type=dict( + type="str", choices=["manual", "addresses_behind_gw"] + ), + ), + ), + tags=dict(type="list", elements="str"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + domains_to_process=dict(type="list", elements="str"), + ignore_warnings=dict(type="bool"), + groups=dict(type="list", elements="str"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'interoperable-device' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "interoperable-device" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_interoperable_device_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_interoperable_device_facts.py index bbc70da9d..595e52ebe 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_interoperable_device_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_interoperable_device_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -107,32 +109,43 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - filter=dict(type='str'), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - domains_to_process=dict(type='list', elements='str') + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + filter=dict(type="str"), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + domains_to_process=dict(type="list", elements="str"), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "interoperable-device" api_call_object_plural_version = "interoperable-devices" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_ips_protection_extended_attribute_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_ips_protection_extended_attribute_facts.py new file mode 100644 index 000000000..de8103d69 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_ips_protection_extended_attribute_facts.py @@ -0,0 +1,131 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_ips_protection_extended_attribute_facts +short_description: Get ips-protection-extended-attribute objects facts on Checkpoint over Web Services API +description: + - Get ips-protection-extended-attribute objects facts on Checkpoint devices. + - All operations are performed over Web Services API. + - This module handles both operations, get a specific object and get several objects, + For getting a specific object use the parameter 'name'. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + name: + description: + - Object name. + This parameter is relevant only for getting a specific object. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + filter: + description: + - Search expression to filter objects by. The provided text should be exactly the same as it would be given in SmartConsole Object Explorer. The + logical operators in the expression ('AND', 'OR') should be provided in capital letters. The search involves both a IP search and a textual search in + name, comment, tags etc. + type: str + limit: + description: + - The maximal number of returned results. + This parameter is relevant only for getting few objects. + type: int + offset: + description: + - Number of the results to initially skip. + This parameter is relevant only for getting few objects. + type: int + order: + description: + - Sorts the results by search criteria. Automatically sorts the results by Name, in the ascending order. + This parameter is relevant only for getting few objects. + type: list + elements: dict + suboptions: + ASC: + description: + - Sorts results by the given field in ascending order. + type: str + choices: ['name'] + DESC: + description: + - Sorts results by the given field in descending order. + type: str + choices: ['name'] +extends_documentation_fragment: check_point.mgmt.checkpoint_facts +""" + +EXAMPLES = """ +- name: show-ips-protection-extended-attribute + cp_mgmt_ips_protection_extended_attribute_facts: + name: Vulnerability Effect + +- name: show-ips-protection-extended-attributes + cp_mgmt_ips_protection_extended_attribute_facts: +""" + +RETURN = """ +ansible_facts: + description: The checkpoint object facts. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts + + +def main(): + argument_spec = dict( + name=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + filter=dict(type='str'), + limit=dict(type='int'), + offset=dict(type='int'), + order=dict(type='list', elements='dict', options=dict( + ASC=dict(type='str', choices=['name']), + DESC=dict(type='str', choices=['name']) + )) + ) + argument_spec.update(checkpoint_argument_spec_for_facts) + + module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + + api_call_object = "ips-protection-extended-attribute" + api_call_object_plural_version = "ips-protection-extended-attributes" + + result = api_call_facts(module, api_call_object, api_call_object_plural_version) + module.exit_json(ansible_facts=result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_lock_object.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_lock_object.py new file mode 100644 index 000000000..b55b50d6e --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_lock_object.py @@ -0,0 +1,96 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_lock_object +short_description: Lock object using name and type. +description: + - Lock object using name and type. Can lock object only if the object is not locked by another session. + - The object can be unlocked by the unlock, publish or discard commands. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + name: + description: + - Object name. Must be unique in the domain. + type: str + type: + description: + - Object type. + type: str + layer: + description: + - Object layer, need to specify the layer if the object is rule/section and uid is not supplied. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: lock-object + cp_mgmt_lock_object: + name: host5 + type: host +""" + +RETURN = """ +cp_mgmt_lock_object: + description: The checkpoint lock-object output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + name=dict(type='str'), + type=dict(type='str'), + layer=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']) + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "lock-object" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_lsm_cluster.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_lsm_cluster.py index 422d31424..3ba3fff11 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_lsm_cluster.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_lsm_cluster.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -221,66 +223,157 @@ cp_mgmt_lsm_cluster: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - main_ip_address=dict(type='str'), - name_prefix=dict(type='str'), - name_suffix=dict(type='str'), - security_profile=dict(type='str', required=True), - interfaces=dict(type='list', elements='dict', options=dict( - name=dict(type='str'), - ip_address_override=dict(type='str'), - member_network_override=dict(type='str') - )), - members=dict(type='list', elements='dict', options=dict( - name=dict(type='str'), - provisioning_settings=dict(type='dict', options=dict( - provisioning_profile=dict(type='str') - )), - provisioning_state=dict(type='str', choices=['off', 'manual', 'using-profile']), - sic=dict(type='dict', options=dict( - ip_address=dict(type='str'), - one_time_password=dict(type='str', no_log=True) - )), - tags=dict(type='list', elements='str'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', - 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', - 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', - 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', - 'sienna', 'yellow']), - comments=dict(type='str') - )), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool'), + main_ip_address=dict(type="str"), + name_prefix=dict(type="str"), + name_suffix=dict(type="str"), + security_profile=dict(type="str", required=True), + interfaces=dict( + type="list", + elements="dict", + options=dict( + name=dict(type="str"), + ip_address_override=dict(type="str"), + member_network_override=dict(type="str"), + ), + ), + members=dict( + type="list", + elements="dict", + options=dict( + name=dict(type="str"), + provisioning_settings=dict( + type="dict", + options=dict(provisioning_profile=dict(type="str")), + ), + provisioning_state=dict( + type="str", choices=["off", "manual", "using-profile"] + ), + sic=dict( + type="dict", + options=dict( + ip_address=dict(type="str"), + one_time_password=dict(type="str", no_log=True), + ), + ), + tags=dict(type="list", elements="str"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + ), + ), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) # Create lsm-cluster name - name = module.params['security_profile'] + name = module.params["security_profile"] - if module.params['name_prefix']: - name = module.params['name_prefix'] + name - if module.params['name_suffix']: - name = name + module.params['name_suffix'] - module.params['name'] = name + if module.params["name_prefix"]: + name = module.params["name_prefix"] + name + if module.params["name_suffix"]: + name = name + module.params["name_suffix"] + module.params["name"] = name - api_call_object = 'lsm-cluster' + api_call_object = "lsm-cluster" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_lsm_cluster_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_lsm_cluster_facts.py index 1c7fbec44..58816abfe 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_lsm_cluster_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_lsm_cluster_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -114,33 +116,44 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - filter=dict(type='str'), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - show_membership=dict(type='bool'), - domains_to_process=dict(type='list', elements='str') + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + filter=dict(type="str"), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + show_membership=dict(type="bool"), + domains_to_process=dict(type="list", elements="str"), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "lsm-cluster" api_call_object_plural_version = "lsm-clusters" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_lsm_cluster_profile_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_lsm_cluster_profile_facts.py index 384c5b218..b87c92a0e 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_lsm_cluster_profile_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_lsm_cluster_profile_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -114,33 +116,44 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - filter=dict(type='str'), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - show_membership=dict(type='bool'), - domains_to_process=dict(type='list', elements='str') + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + filter=dict(type="str"), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + show_membership=dict(type="bool"), + domains_to_process=dict(type="list", elements="str"), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "lsm-cluster-profile" api_call_object_plural_version = "lsm-cluster-profiles" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_lsm_gateway.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_lsm_gateway.py index 21fc7ce5a..704a0f74d 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_lsm_gateway.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_lsm_gateway.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -140,39 +142,85 @@ cp_mgmt_lsm_gateway: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - security_profile=dict(type='str'), - provisioning_settings=dict(type='dict', options=dict( - provisioning_profile=dict(type='str') - )), - provisioning_state=dict(type='str', choices=['off', 'manual', 'using-profile']), - sic=dict(type='dict', options=dict( - ip_address=dict(type='str'), - one_time_password=dict(type='str', no_log=True) - )), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + security_profile=dict(type="str"), + provisioning_settings=dict( + type="dict", options=dict(provisioning_profile=dict(type="str")) + ), + provisioning_state=dict( + type="str", choices=["off", "manual", "using-profile"] + ), + sic=dict( + type="dict", + options=dict( + ip_address=dict(type="str"), + one_time_password=dict(type="str", no_log=True), + ), + ), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'lsm-gateway' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "lsm-gateway" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_lsm_gateway_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_lsm_gateway_facts.py index b13444e96..150ca4b7e 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_lsm_gateway_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_lsm_gateway_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -114,33 +116,44 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - filter=dict(type='str'), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - show_membership=dict(type='bool'), - domains_to_process=dict(type='list', elements='str') + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + filter=dict(type="str"), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + show_membership=dict(type="bool"), + domains_to_process=dict(type="list", elements="str"), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "lsm-gateway" api_call_object_plural_version = "lsm-gateways" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_lsm_gateway_profile_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_lsm_gateway_profile_facts.py index 6778f237c..e46f1f0ee 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_lsm_gateway_profile_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_lsm_gateway_profile_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -114,33 +116,44 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - filter=dict(type='str'), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - show_membership=dict(type='bool'), - domains_to_process=dict(type='list', elements='str') + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + filter=dict(type="str"), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + show_membership=dict(type="bool"), + domains_to_process=dict(type="list", elements="str"), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "lsm-gateway-profile" api_call_object_plural_version = "lsm-gateway-profiles" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_lsm_run_script.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_lsm_run_script.py index d3828262d..434e814d9 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_lsm_run_script.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_lsm_run_script.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -67,14 +69,17 @@ cp_mgmt_lsm_run_script: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): argument_spec = dict( - script_base64=dict(type='str'), - script=dict(type='str'), - targets=dict(type='list', elements='str') + script_base64=dict(type="str"), + script=dict(type="str"), + targets=dict(type="list", elements="str"), ) argument_spec.update(checkpoint_argument_spec_for_commands) @@ -86,5 +91,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_lsv_profile.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_lsv_profile.py new file mode 100644 index 000000000..eb43a20b6 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_lsv_profile.py @@ -0,0 +1,173 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_lsv_profile +short_description: Manages lsv-profile objects on Checkpoint over Web Services API +description: + - Manages lsv-profile objects on Checkpoint devices including creating, updating and removing objects. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + name: + description: + - Object name. + type: str + required: True + certificate_authority: + description: + - Trusted Certificate authority for establishing trust between VPN peers, identified by name or UID. + type: str + allowed_ip_addresses: + description: + - Collection of network objects identified by name or UID that represent IP addresses allowed in profile's VPN domain. + type: list + elements: str + restrict_allowed_addresses: + description: + - Indicate whether the IP addresses allowed in the VPN Domain will be restricted or not, according to allowed-ip-addresses field. + type: bool + tags: + description: + - Collection of tag identifiers. + type: list + elements: str + vpn_domain: + description: + - peers' VPN Domain properties. + type: dict + suboptions: + limit_peer_domain_size: + description: + - Use this parameter to limit the number of IP addresses in the VPN Domain of each peer according to the value in the max-allowed-addresses field. + type: bool + max_allowed_addresses: + description: + - Maximum number of IP addresses in the VPN Domain of each peer. This value will be enforced only when limit-peer-domain-size field is + set to true. Select a value between 1 and 256. Default value is 256. + type: int + color: + description: + - Color of the object. Should be one of existing colors. + type: str + choices: ['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green', + 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', + 'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', 'yellow'] + comments: + description: + - Comments string. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + groups: + description: + - Collection of group identifiers. + type: list + elements: str + ignore_warnings: + description: + - Apply changes ignoring warnings. + type: bool + ignore_errors: + description: + - Apply changes ignoring errors. You won't be able to publish such a changes. If ignore-warnings flag was omitted - warnings will also be ignored. + type: bool +extends_documentation_fragment: check_point.mgmt.checkpoint_objects +""" + +EXAMPLES = """ +- name: add-lsv-profile + cp_mgmt_lsv_profile: + certificate_authority: dedicated_profile_certificate + name: New lsv-profile + state: present + +- name: set-lsv-profile + cp_mgmt_lsv_profile: + certificate_authority: another CA + name: existing lsv-profile + restrict_allowed_addresses: 'false' + state: present + vpn_domain: + limit_peer_domain_size: 'false' + +- name: delete-lsv-profile + cp_mgmt_lsv_profile: + name: existing lsv-profile + state: absent +""" + +RETURN = """ +cp_mgmt_lsv_profile: + description: The checkpoint object created or updated. + returned: always, except when deleting the object. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call + + +def main(): + argument_spec = dict( + name=dict(type='str', required=True), + certificate_authority=dict(type='str'), + allowed_ip_addresses=dict(type='list', elements='str'), + restrict_allowed_addresses=dict(type='bool'), + tags=dict(type='list', elements='str'), + vpn_domain=dict(type='dict', options=dict( + limit_peer_domain_size=dict(type='bool'), + max_allowed_addresses=dict(type='int') + )), + color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', + 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', + 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', + 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', + 'yellow']), + comments=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + groups=dict(type='list', elements='str'), + ignore_warnings=dict(type='bool'), + ignore_errors=dict(type='bool') + ) + argument_spec.update(checkpoint_argument_spec_for_objects) + + module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + api_call_object = 'lsv-profile' + + result = api_call(module, api_call_object) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_lsv_profile_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_lsv_profile_facts.py new file mode 100644 index 000000000..d755a4a7f --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_lsv_profile_facts.py @@ -0,0 +1,141 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_lsv_profile_facts +short_description: Get lsv-profile objects facts on Checkpoint over Web Services API +description: + - Get lsv-profile objects facts on Checkpoint devices. + - All operations are performed over Web Services API. + - This module handles both operations, get a specific object and get several objects, + For getting a specific object use the parameter 'name'. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + name: + description: + - Object name. + This parameter is relevant only for getting a specific object. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + filter: + description: + - Search expression to filter objects by. The provided text should be exactly the same as it would be given in SmartConsole Object Explorer. The + logical operators in the expression ('AND', 'OR') should be provided in capital letters. The search involves both a IP search and a textual search in + name, comment, tags etc. + type: str + limit: + description: + - The maximal number of returned results. + This parameter is relevant only for getting few objects. + type: int + offset: + description: + - Number of the results to initially skip. + This parameter is relevant only for getting few objects. + type: int + order: + description: + - Sorts the results by search criteria. Automatically sorts the results by Name, in the ascending order. + This parameter is relevant only for getting few objects. + type: list + elements: dict + suboptions: + ASC: + description: + - Sorts results by the given field in ascending order. + type: str + choices: ['name'] + DESC: + description: + - Sorts results by the given field in descending order. + type: str + choices: ['name'] + domains_to_process: + description: + - Indicates which domains to process the commands on. It cannot be used with the details-level full, must be run from the System Domain only and + with ignore-warnings true. Valid values are, CURRENT_DOMAIN, ALL_DOMAINS_ON_THIS_SERVER. + type: list + elements: str +extends_documentation_fragment: check_point.mgmt.checkpoint_facts +""" + +EXAMPLES = """ +- name: show-lsv-profile + cp_mgmt_lsv_profile_facts: + name: existing lsv-profile + +- name: show-lsv-profiles + cp_mgmt_lsv_profile_facts: + details_level: standard + limit: 50 + offset: 0 +""" + +RETURN = """ +ansible_facts: + description: The checkpoint object facts. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts + + +def main(): + argument_spec = dict( + name=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + filter=dict(type='str'), + limit=dict(type='int'), + offset=dict(type='int'), + order=dict(type='list', elements='dict', options=dict( + ASC=dict(type='str', choices=['name']), + DESC=dict(type='str', choices=['name']) + )), + domains_to_process=dict(type='list', elements='str') + ) + argument_spec.update(checkpoint_argument_spec_for_facts) + + module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + + api_call_object = "lsv-profile" + api_call_object_plural_version = "lsv-profiles" + + result = api_call_facts(module, api_call_object, api_call_object_plural_version) + module.exit_json(ansible_facts=result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_md_permissions_profile.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_md_permissions_profile.py index 01f52aafe..1439e06e7 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_md_permissions_profile.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_md_permissions_profile.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -166,45 +168,88 @@ cp_mgmt_md_permissions_profile: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - permission_level=dict(type='str', choices=['super user', 'manager', 'domain level only']), - mds_provisioning=dict(type='bool'), - manage_admins=dict(type='bool'), - manage_sessions=dict(type='bool'), - management_api_login=dict(type='bool'), - cme_operations=dict(type='str', choices=['read', 'write', 'disabled']), - global_vpn_management=dict(type='bool'), - manage_global_assignments=dict(type='bool'), - enable_default_profile_for_global_domains=dict(type='bool'), - default_profile_global_domains=dict(type='str'), - view_global_objects_in_domain=dict(type='bool'), - enable_default_profile_for_local_domains=dict(type='bool'), - default_profile_local_domains=dict(type='str'), - tags=dict(type='list', elements='str'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - domains_to_process=dict(type='list', elements='str'), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + permission_level=dict( + type="str", choices=["super user", "manager", "domain level only"] + ), + mds_provisioning=dict(type="bool"), + manage_admins=dict(type="bool"), + manage_sessions=dict(type="bool"), + management_api_login=dict(type="bool"), + cme_operations=dict(type="str", choices=["read", "write", "disabled"]), + global_vpn_management=dict(type="bool"), + manage_global_assignments=dict(type="bool"), + enable_default_profile_for_global_domains=dict(type="bool"), + default_profile_global_domains=dict(type="str"), + view_global_objects_in_domain=dict(type="bool"), + enable_default_profile_for_local_domains=dict(type="bool"), + default_profile_local_domains=dict(type="str"), + tags=dict(type="list", elements="str"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + domains_to_process=dict(type="list", elements="str"), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'md-permissions-profile' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "md-permissions-profile" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_md_permissions_profile_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_md_permissions_profile_facts.py index 285752fd7..338ef5920 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_md_permissions_profile_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_md_permissions_profile_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -110,32 +112,43 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - filter=dict(type='str'), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - domains_to_process=dict(type='list', elements='str') + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + filter=dict(type="str"), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + domains_to_process=dict(type="list", elements="str"), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "md-permissions-profile" api_call_object_plural_version = "md-permissions-profiles" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_mds.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_mds.py index 726164ba5..017d49857 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_mds.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_mds.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -164,45 +166,89 @@ cp_mgmt_mds: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - ip_address=dict(type='str'), - ipv4_address=dict(type='str'), - ipv6_address=dict(type='str'), - hardware=dict(type='str'), - os=dict(type='str'), - version=dict(type='str'), - one_time_password=dict(type='str', no_log=True), - server_type=dict(type='str', choices=['multi-domain server', 'multi-domain log server']), - ip_pool_first=dict(type='str'), - ipv4_pool_first=dict(type='str'), - ipv6_pool_first=dict(type='str'), - ip_pool_last=dict(type='str'), - ipv4_pool_last=dict(type='str'), - ipv6_pool_last=dict(type='str'), - tags=dict(type='list', elements='str'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + ip_address=dict(type="str"), + ipv4_address=dict(type="str"), + ipv6_address=dict(type="str"), + hardware=dict(type="str"), + os=dict(type="str"), + version=dict(type="str"), + one_time_password=dict(type="str", no_log=True), + server_type=dict( + type="str", + choices=["multi-domain server", "multi-domain log server"], + ), + ip_pool_first=dict(type="str"), + ipv4_pool_first=dict(type="str"), + ipv6_pool_first=dict(type="str"), + ip_pool_last=dict(type="str"), + ipv4_pool_last=dict(type="str"), + ipv6_pool_last=dict(type="str"), + tags=dict(type="list", elements="str"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'mds' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "mds" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_mds_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_mds_facts.py index 46bca5be4..3cbaedda9 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_mds_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_mds_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -95,30 +97,41 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )) + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "mds" api_call_object_plural_version = "mdss" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_multicast_address_range.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_multicast_address_range.py index 04cc7a72f..4441b0fce 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_multicast_address_range.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_multicast_address_range.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -143,41 +145,82 @@ cp_mgmt_multicast_address_range: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - ip_address=dict(type='str'), - ipv4_address=dict(type='str'), - ipv6_address=dict(type='str'), - ip_address_first=dict(type='str'), - ipv4_address_first=dict(type='str'), - ipv6_address_first=dict(type='str'), - ip_address_last=dict(type='str'), - ipv4_address_last=dict(type='str'), - ipv6_address_last=dict(type='str'), - tags=dict(type='list', elements='str'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - groups=dict(type='list', elements='str'), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + ip_address=dict(type="str"), + ipv4_address=dict(type="str"), + ipv6_address=dict(type="str"), + ip_address_first=dict(type="str"), + ipv4_address_first=dict(type="str"), + ipv6_address_first=dict(type="str"), + ip_address_last=dict(type="str"), + ipv4_address_last=dict(type="str"), + ipv6_address_last=dict(type="str"), + tags=dict(type="list", elements="str"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + groups=dict(type="list", elements="str"), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'multicast-address-range' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "multicast-address-range" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_multicast_address_range_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_multicast_address_range_facts.py index c32390e6d..b98fa2525 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_multicast_address_range_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_multicast_address_range_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -100,31 +102,42 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - show_membership=dict(type='bool') + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + show_membership=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "multicast-address-range" api_call_object_plural_version = "multicast-address-ranges" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_nat_rule.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_nat_rule.py new file mode 100644 index 000000000..d187200f8 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_nat_rule.py @@ -0,0 +1,227 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_nat_rule +short_description: Manages nat-rule objects on Checkpoint over Web Services API. +description: + - Manages nat-rule objects on Checkpoint devices including creating, updating and removing objects. + - Minimum version required is 1.7.1 and JHF with PMTR-88097. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + package: + description: + - Name of the package. + type: str + position: + description: + - Position in the rulebase. The use of values "top" and "bottom" may not be idempotent. + type: str + relative_position: + description: + - Position in the rulebase. + - Use of this field may not be idempotent. + type: dict + suboptions: + below: + description: + - Add rule below specific rule/section identified by name (limited to 50 rules if + search_entire_rulebase is False). + type: str + above: + description: + - Add rule above specific rule/section identified by name (limited to 50 rules if + search_entire_rulebase is False). + type: str + top: + description: + - Add rule to the top of a specific section identified by name (limited to 50 rules if + search_entire_rulebase is False). + type: str + bottom: + description: + - Add rule to the bottom of a specific section identified by name (limited to 50 rules if + search_entire_rulebase is False). + type: str + search_entire_rulebase: + description: + - Whether to search the entire rulebase for a rule that's been edited in its relative_position field to make sure + there indeed has been a change in its position or the section it might be in. + type: bool + default: False + name: + description: + - Rule name. + type: str + required: True + enabled: + description: + - Enable/Disable the rule. + type: bool + install_on: + description: + - Which Gateways identified by the name or UID to install the policy on. + type: list + elements: str + method: + description: + - Nat method. + type: str + choices: ['static', 'hide', 'nat64', 'nat46', 'cgnat'] + original_destination: + description: + - Original destination. + type: str + original_service: + description: + - Original service. + type: str + original_source: + description: + - Original source. + type: str + translated_destination: + description: + - Translated destination. + type: str + translated_service: + description: + - Translated service. + type: str + translated_source: + description: + - Translated source. + type: str + comments: + description: + - Comments string. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + ignore_warnings: + description: + - Apply changes ignoring warnings. + type: bool + ignore_errors: + description: + - Apply changes ignoring errors. You won't be able to publish such a changes. If ignore-warnings flag was omitted - warnings will also be ignored. + type: bool +extends_documentation_fragment: check_point.mgmt.checkpoint_objects +""" + +EXAMPLES = """ +- name: add-nat-rule + cp_mgmt_nat_rule: + name: nat_rule1 + comments: comment example1 nat999 + enabled: false + install_on: + - Policy Targets + original_destination: All_Internet + original_source: Any + package: standard + position: 1 + state: present + +- name: set-nat-rule + cp_mgmt_nat_rule: + name: nat_rule1 + comments: rule for RND members RNDNetwork-> RND to Internal Network + enabled: false + original_service: ssh_version_2 + original_source: Any + package: standard + state: present + +- name: delete-nat-rule + cp_mgmt_nat_rule: + name: nat_rule1 + package: standard + state: absent +""" + +RETURN = """ +cp_mgmt_nat_rule: + description: The checkpoint object created or updated. + returned: always, except when deleting the object. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call_for_rule + + +def main(): + argument_spec = dict( + package=dict(type='str'), + position=dict(type='str'), + relative_position=dict(type='dict', options=dict( + below=dict(type='str'), + above=dict(type='str'), + top=dict(type='str'), + bottom=dict(type='str') + )), + search_entire_rulebase=dict(type='bool', default=False), + name=dict(type='str', required=True), + enabled=dict(type='bool'), + install_on=dict(type='list', elements='str'), + method=dict(type='str', choices=['static', 'hide', 'nat64', 'nat46', 'cgnat']), + original_destination=dict(type='str'), + original_service=dict(type='str'), + original_source=dict(type='str'), + translated_destination=dict(type='str'), + translated_service=dict(type='str'), + translated_source=dict(type='str'), + comments=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + ignore_warnings=dict(type='bool'), + ignore_errors=dict(type='bool') + ) + argument_spec.update(checkpoint_argument_spec_for_objects) + + module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + api_call_object = 'nat-rule' + + if module.params["relative_position"] is not None: + if module.params["position"] is not None: + raise AssertionError("The use of both 'relative_position' and 'position' arguments isn't allowed") + module.params["position"] = module.params["relative_position"] + module.params.pop("relative_position") + + result = api_call_for_rule(module, api_call_object) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_nat_rule_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_nat_rule_facts.py index c1c4465bd..6474b2af1 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_nat_rule_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_nat_rule_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -41,6 +43,11 @@ options: description: - Rule number. type: str + name: + description: + - Rule name. + This parameter is relevant only for getting a specific object. Minimum version required is 1.7.1. + type: str package: description: - Name of the package. @@ -141,6 +148,7 @@ EXAMPLES = """ - name: show-nat-rule cp_mgmt_nat_rule_facts: package: standard + name: nat_rule1 - name: show-nat-rulebase cp_mgmt_nat_rule_facts: @@ -159,45 +167,63 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts_for_rule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts_for_rule, +) def main(): argument_spec = dict( - rule_number=dict(type='str'), - package=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - filter=dict(type='str'), - filter_settings=dict(type='dict', options=dict( - search_mode=dict(type='str', choices=['general', 'packet']), - packet_search_settings=dict(type='dict', options=dict( - expand_group_members=dict(type='bool'), - expand_group_with_exclusion_members=dict(type='bool'), - match_on_any=dict(type='bool'), - match_on_group_with_exclusion=dict(type='bool'), - match_on_negate=dict(type='bool') - )) - )), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - use_object_dictionary=dict(type='bool'), - dereference_group_members=dict(type='bool'), - show_membership=dict(type='bool') + rule_number=dict(type="str"), + name=dict(type='str'), + package=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + filter=dict(type="str"), + filter_settings=dict( + type="dict", + options=dict( + search_mode=dict(type="str", choices=["general", "packet"]), + packet_search_settings=dict( + type="dict", + options=dict( + expand_group_members=dict(type="bool"), + expand_group_with_exclusion_members=dict(type="bool"), + match_on_any=dict(type="bool"), + match_on_group_with_exclusion=dict(type="bool"), + match_on_negate=dict(type="bool"), + ), + ), + ), + ), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + use_object_dictionary=dict(type="bool"), + dereference_group_members=dict(type="bool"), + show_membership=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "nat-rule" api_call_object_plural_version = "nat-rulebase" - result = api_call_facts_for_rule(module, api_call_object, api_call_object_plural_version) + result = api_call_facts_for_rule( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_nat_section.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_nat_section.py index d81d2609d..f59c4a803 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_nat_section.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_nat_section.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -94,26 +96,31 @@ cp_mgmt_nat_section: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - package=dict(type='str'), - position=dict(type='str'), - name=dict(type='str', required=True), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + package=dict(type="str"), + position=dict(type="str"), + name=dict(type="str", required=True), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'nat-section' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "nat-section" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_network.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_network.py index 1fc5e0489..6faf9e6fd 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_network.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_network.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -179,49 +181,95 @@ cp_mgmt_network: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - subnet=dict(type='str'), - subnet4=dict(type='str'), - subnet6=dict(type='str'), - mask_length=dict(type='int'), - mask_length4=dict(type='int'), - mask_length6=dict(type='int'), - subnet_mask=dict(type='str'), - nat_settings=dict(type='dict', options=dict( - auto_rule=dict(type='bool'), - ip_address=dict(type='str'), - ipv4_address=dict(type='str'), - ipv6_address=dict(type='str'), - hide_behind=dict(type='str', choices=['gateway', 'ip-address']), - install_on=dict(type='str'), - method=dict(type='str', choices=['hide', 'static']) - )), - tags=dict(type='list', elements='str'), - broadcast=dict(type='str', choices=['disallow', 'allow']), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - groups=dict(type='list', elements='str'), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + subnet=dict(type="str"), + subnet4=dict(type="str"), + subnet6=dict(type="str"), + mask_length=dict(type="int"), + mask_length4=dict(type="int"), + mask_length6=dict(type="int"), + subnet_mask=dict(type="str"), + nat_settings=dict( + type="dict", + options=dict( + auto_rule=dict(type="bool"), + ip_address=dict(type="str"), + ipv4_address=dict(type="str"), + ipv6_address=dict(type="str"), + hide_behind=dict( + type="str", choices=["gateway", "ip-address"] + ), + install_on=dict(type="str"), + method=dict(type="str", choices=["hide", "static"]), + ), + ), + tags=dict(type="list", elements="str"), + broadcast=dict(type="str", choices=["disallow", "allow"]), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + groups=dict(type="list", elements="str"), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'network' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "network" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_network_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_network_facts.py index 9cb2382ca..cbb8f24da 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_network_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_network_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -102,31 +104,42 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - show_membership=dict(type='bool') + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + show_membership=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "network" api_call_object_plural_version = "networks" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_network_feed.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_network_feed.py index f00e21773..345df3dd1 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_network_feed.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_network_feed.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -196,48 +198,94 @@ cp_mgmt_network_feed: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - feed_url=dict(type='str'), - certificate_id=dict(type='str'), - feed_format=dict(type='str', choices=['Flat List', 'JSON']), - feed_type=dict(type='str', choices=['Domain', 'IP Address', 'IP Address/Domain']), - password=dict(type='str', no_log=True), - tags=dict(type='list', elements='str'), - username=dict(type='str'), - custom_header=dict(type='list', elements='dict', options=dict( - header_name=dict(type='str'), - header_value=dict(type='str') - )), - update_interval=dict(type='int'), - data_column=dict(type='int'), - fields_delimiter=dict(type='str'), - ignore_lines_that_start_with=dict(type='str'), - json_query=dict(type='str'), - use_gateway_proxy=dict(type='bool'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - domains_to_process=dict(type='list', elements='str'), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + feed_url=dict(type="str"), + certificate_id=dict(type="str"), + feed_format=dict(type="str", choices=["Flat List", "JSON"]), + feed_type=dict( + type="str", choices=["Domain", "IP Address", "IP Address/Domain"] + ), + password=dict(type="str", no_log=True), + tags=dict(type="list", elements="str"), + username=dict(type="str"), + custom_header=dict( + type="list", + elements="dict", + options=dict( + header_name=dict(type="str"), header_value=dict(type="str") + ), + ), + update_interval=dict(type="int"), + data_column=dict(type="int"), + fields_delimiter=dict(type="str"), + ignore_lines_that_start_with=dict(type="str"), + json_query=dict(type="str"), + use_gateway_proxy=dict(type="bool"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + domains_to_process=dict(type="list", elements="str"), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'network-feed' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "network-feed" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_network_feed_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_network_feed_facts.py index e2aa53fbe..471c5dd43 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_network_feed_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_network_feed_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -111,33 +113,44 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - filter=dict(type='str'), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - show_membership=dict(type='bool'), - domains_to_process=dict(type='list', elements='str') + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + filter=dict(type="str"), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + show_membership=dict(type="bool"), + domains_to_process=dict(type="list", elements="str"), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "network-feed" api_call_object_plural_version = "network-feeds" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_objects_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_objects_facts.py index 50f059051..e16c8d532 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_objects_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_objects_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -145,37 +147,48 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - uid=dict(type='str'), - uids=dict(type='list', elements='str'), - filter=dict(type='str'), - ip_only=dict(type='bool'), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - type=dict(type='str'), - dereference_group_members=dict(type='bool'), - show_membership=dict(type='bool'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - domains_to_process=dict(type='list', elements='str') + uid=dict(type="str"), + uids=dict(type="list", elements="str"), + filter=dict(type="str"), + ip_only=dict(type="bool"), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + type=dict(type="str"), + dereference_group_members=dict(type="bool"), + show_membership=dict(type="bool"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + domains_to_process=dict(type="list", elements="str"), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "object" api_call_object_plural_version = "objects" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_package.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_package.py index e8a403f96..0e21be64f 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_package.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_package.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -198,54 +200,107 @@ cp_mgmt_package: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - access=dict(type='bool'), - desktop_security=dict(type='bool'), - installation_targets=dict(type='list', elements='str'), - qos=dict(type='bool'), - qos_policy_type=dict(type='str', choices=['recommended', 'express']), - tags=dict(type='list', elements='str'), - threat_prevention=dict(type='bool'), - vpn_traditional_mode=dict(type='bool'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool'), - access_layers=dict(type='dict', options=dict( - add=dict(type='list', elements='dict', options=dict( - name=dict(type='str'), - position=dict(type='int') - )), - remove=dict(type='list', elements='str'), - value=dict(type='list', elements='str') - )), - threat_layers=dict(type='dict', options=dict( - add=dict(type='list', elements='dict', options=dict( - name=dict(type='str'), - position=dict(type='int') - )), - remove=dict(type='list', elements='str'), - value=dict(type='list', elements='str') - )) + name=dict(type="str", required=True), + access=dict(type="bool"), + desktop_security=dict(type="bool"), + installation_targets=dict(type="list", elements="str"), + qos=dict(type="bool"), + qos_policy_type=dict(type="str", choices=["recommended", "express"]), + tags=dict(type="list", elements="str"), + threat_prevention=dict(type="bool"), + vpn_traditional_mode=dict(type="bool"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), + access_layers=dict( + type="dict", + options=dict( + add=dict( + type="list", + elements="dict", + options=dict( + name=dict(type="str"), position=dict(type="int") + ), + ), + remove=dict(type="list", elements="str"), + value=dict(type="list", elements="str"), + ), + ), + threat_layers=dict( + type="dict", + options=dict( + add=dict( + type="list", + elements="dict", + options=dict( + name=dict(type="str"), position=dict(type="int") + ), + ), + remove=dict(type="list", elements="str"), + value=dict(type="list", elements="str"), + ), + ), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'package' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "package" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_package_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_package_facts.py index 54c80e754..c8ee9dc6d 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_package_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_package_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -98,30 +100,41 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )) + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "package" api_call_object_plural_version = "packages" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_provisioning_profile_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_provisioning_profile_facts.py index b77a9b141..a6e721a3c 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_provisioning_profile_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_provisioning_profile_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -114,33 +116,44 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - filter=dict(type='str'), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - show_membership=dict(type='bool'), - domains_to_process=dict(type='list', elements='str') + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + filter=dict(type="str"), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + show_membership=dict(type="bool"), + domains_to_process=dict(type="list", elements="str"), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "provisioning-profile" api_call_object_plural_version = "provisioning-profiles" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_publish.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_publish.py index c7dedd20a..b488fd184 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_publish.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_publish.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -51,12 +53,14 @@ cp_mgmt_publish: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): - argument_spec = dict( - ) + argument_spec = dict() argument_spec.update(checkpoint_argument_spec_for_commands) module = AnsibleModule(argument_spec=argument_spec) @@ -67,5 +71,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_put_file.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_put_file.py index 8f7eaec4c..9d0f8aa2f 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_put_file.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_put_file.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -77,16 +79,19 @@ cp_mgmt_put_file: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): argument_spec = dict( - targets=dict(type='list', elements='str'), - file_content=dict(type='str'), - file_name=dict(type='str'), - file_path=dict(type='str'), - comments=dict(type='str') + targets=dict(type="list", elements="str"), + file_content=dict(type="str"), + file_name=dict(type="str"), + file_path=dict(type="str"), + comments=dict(type="str"), ) argument_spec.update(checkpoint_argument_spec_for_commands) @@ -98,5 +103,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_radius_group.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_radius_group.py new file mode 100644 index 000000000..57b3ebd7f --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_radius_group.py @@ -0,0 +1,150 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_radius_group +short_description: Manages radius-group objects on Checkpoint over Web Services API +description: + - Manages radius-group objects on Checkpoint devices including creating, updating and removing objects. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Shiran Golzar (@chkp-shirango)" +options: + name: + description: + - Object name. + type: str + required: True + members: + description: + - Collection of radius servers identified by the name or UID. + type: list + elements: str + tags: + description: + - Collection of tag identifiers. + type: list + elements: str + color: + description: + - Color of the object. Should be one of existing colors. + type: str + choices: ['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green', + 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', + 'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', 'yellow'] + comments: + description: + - Comments string. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + groups: + description: + - Collection of group identifiers. + type: list + elements: str + ignore_warnings: + description: + - Apply changes ignoring warnings. + type: bool + ignore_errors: + description: + - Apply changes ignoring errors. You won't be able to publish such a changes. If ignore-warnings flag was omitted - warnings will also be ignored. + type: bool +extends_documentation_fragment: check_point.mgmt.checkpoint_objects +""" + +EXAMPLES = """ +- name: add-radius-group + cp_mgmt_radius_group: + members: + - t4 + - radgroup + name: radgroup + state: present + +- name: set-radius-group + cp_mgmt_radius_group: + members: + - t4 + name: radgroup + state: present + +- name: delete-radius-group + cp_mgmt_radius_group: + ignore_warnings: 'true' + name: testgroup + state: absent +""" + +RETURN = """ +cp_mgmt_radius_group: + description: The checkpoint object created or updated. + returned: always, except when deleting the object. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, \ + api_call + + +def main(): + argument_spec = dict( + name=dict(type='str', required=True), + members=dict(type='list', elements='str'), + tags=dict(type='list', elements="str"), + color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', + 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', + 'dark blue', 'firebrick', 'brown', + 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', + 'lemon chiffon', 'coral', 'sea green', + 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', + 'olive', 'orange', 'red', 'sienna', + 'yellow']), + comments=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + groups=dict(type='list', elements='str'), + ignore_warnings=dict(type='bool'), + ignore_errors=dict(type='bool') + ) + argument_spec.update(checkpoint_argument_spec_for_objects) + + module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + api_call_object = 'radius-group' + + result = api_call(module, api_call_object) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_radius_group_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_radius_group_facts.py new file mode 100644 index 000000000..af0ab8889 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_radius_group_facts.py @@ -0,0 +1,157 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_radius_group_facts +short_description: Get radius-group objects facts on Checkpoint over Web Services API +description: + - Get radius-group objects facts on Checkpoint devices. + - All operations are performed over Web Services API. + - This module handles both operations, get a specific object and get several objects, + For getting a specific object use the parameter 'name'. +version_added: "5.0.0" +author: "Shiran Golzar (@chkp-shirango)" +options: + name: + description: + - Object name. + This parameter is relevant only for getting a specific object. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + filter: + description: + - Search expression to filter objects by. The provided text should be exactly the same as it would be given in SmartConsole Object Explorer. The + logical operators in the expression ('AND', 'OR') should be provided in capital letters. The search involves both a IP search and a textual search in + name, comment, tags etc. + type: str + limit: + description: + - The maximal number of returned results. + This parameter is relevant only for getting few objects. + type: int + offset: + description: + - Number of the results to initially skip. + This parameter is relevant only for getting few objects. + type: int + order: + description: + - Sorts the results by search criteria. Automatically sorts the results by Name, in the ascending order. + This parameter is relevant only for getting few objects. + type: list + elements: dict + suboptions: + ASC: + description: + - Sorts results by the given field in ascending order. + type: str + choices: ['name'] + DESC: + description: + - Sorts results by the given field in descending order. + type: str + choices: ['name'] + dereference_group_members: + description: + - Indicates whether to dereference "members" field by details level for every object in reply. + type: bool + show_membership: + description: + - Indicates whether to calculate and show "groups" field for every object in reply. + type: bool + async_response: + description: + - Run command in asynchronous mode and return task UID. Use show-task command to check the progress of the task. + type: bool + domains_to_process: + description: + - Indicates which domains to process the commands on. It cannot be used with the details-level full, must be run from the System Domain only and + with ignore-warnings true. Valid values are, CURRENT_DOMAIN, ALL_DOMAINS_ON_THIS_SERVER. + type: list + elements: str +extends_documentation_fragment: check_point.mgmt.checkpoint_facts +""" + +EXAMPLES = """ +- name: show-radius-group + cp_mgmt_radius_group_facts: + name: radgroup + +- name: show-radius-groups + cp_mgmt_radius_group_facts: + details_level: standard + limit: 4 + offset: 0 +""" + +RETURN = """ +ansible_facts: + description: The checkpoint object facts. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, \ + api_call_facts + + +def main(): + argument_spec = dict( + name=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + filter=dict(type='str'), + limit=dict(type='int'), + offset=dict(type='int'), + order=dict(type='list', elements='dict', options=dict( + ASC=dict(type='str', choices=['name']), + DESC=dict(type='str', choices=['name']) + )), + dereference_group_members=dict(type='bool'), + show_membership=dict(type='bool'), + async_response=dict(type='bool'), + domains_to_process=dict(type='list', elements='str') + ) + argument_spec.update(checkpoint_argument_spec_for_facts) + + module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + + api_call_object = "radius-group" + api_call_object_plural_version = "radius-groups" + + result = api_call_facts(module, api_call_object, api_call_object_plural_version) + module.exit_json(ansible_facts=result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_radius_server.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_radius_server.py new file mode 100644 index 000000000..f1b0cfe5d --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_radius_server.py @@ -0,0 +1,192 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_radius_server +short_description: Manages radius-server objects on Checkpoint over Web Services API +description: + - Manages radius-server objects on Checkpoint devices including creating, updating and removing objects. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Shiran Golzar (@chkp-shirango)" +options: + name: + description: + - Object name. + type: str + required: True + server: + description: + - The UID or Name of the host that is the RADIUS Server. + type: str + shared_secret: + description: + - The secret between the RADIUS server and the Security Gateway. + type: str + service: + description: + - The UID or Name of the Service to which the RADIUS server listens. + type: str + server_version: + description: + - The version can be either RADIUS Version 1.0, which is RFC 2138 compliant, and RADIUS Version 2.0 which is RFC 2865 compliant. + type: str + choices: ['RADIUS Ver. 1.0', 'RADIUS Ver. 2.0'] + protocol: + description: + - The type of authentication protocol that will be used when authenticating the user to the RADIUS server. + type: str + choices: ['PAP', 'MS_CHAP2'] + priority: + description: + - The priority of the RADIUS Server in case it is a member of a RADIUS Group. + type: int + accounting: + description: + - Accounting settings. + type: dict + suboptions: + enable_ip_pool_management: + description: + - IP pool management, enables Accounting service. + type: bool + accounting_service: + description: + - The UID or Name of the the accounting interface to notify the server when users login and logout which will then lock and release the + IP addresses that the server allocated to those users. + type: str + tags: + description: + - Collection of tag identifiers. + type: list + elements: str + color: + description: + - Color of the object. Should be one of existing colors. + type: str + choices: ['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green', + 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', + 'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', 'yellow'] + comments: + description: + - Comments string. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + groups: + description: + - Collection of group identifiers. + type: list + elements: str + ignore_warnings: + description: + - Apply changes ignoring warnings. + type: bool + ignore_errors: + description: + - Apply changes ignoring errors. You won't be able to publish such a changes. If ignore-warnings flag was omitted - warnings will also be ignored. + type: bool +extends_documentation_fragment: check_point.mgmt.checkpoint_objects +""" + +EXAMPLES = """ +- name: add-radius-server + cp_mgmt_radius_server: + name: radServer + server: hostRad + shared_secret: '123' + state: present + +- name: set-radius-server + cp_mgmt_radius_server: + name: t4 + server: hostRadius + state: present + +- name: delete-radius-server + cp_mgmt_radius_server: + ignore_warnings: 'true' + name: radiusServer + state: absent +""" + +RETURN = """ +cp_mgmt_radius_server: + description: The checkpoint object created or updated. + returned: always, except when deleting the object. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, \ + api_call + + +def main(): + argument_spec = dict( + name=dict(type='str', required=True), + server=dict(type='str'), + shared_secret=dict(type='str', no_log=True), + service=dict(type='str'), + server_version=dict(type='str', choices=['RADIUS Ver. 1.0', 'RADIUS Ver. 2.0']), + protocol=dict(type='str', choices=['PAP', 'MS_CHAP2']), + priority=dict(type='int'), + accounting=dict(type='dict', options=dict( + enable_ip_pool_management=dict(type='bool'), + accounting_service=dict(type='str') + )), + tags=dict(type='list', elements='str'), + color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', + 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', + 'dark blue', 'firebrick', 'brown', + 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', + 'lemon chiffon', 'coral', 'sea green', + 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', + 'olive', 'orange', 'red', 'sienna', + 'yellow']), + comments=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + groups=dict(type='list', elements='str'), + ignore_warnings=dict(type='bool'), + ignore_errors=dict(type='bool') + ) + argument_spec.update(checkpoint_argument_spec_for_objects) + + module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + api_call_object = 'radius-server' + + result = api_call(module, api_call_object) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_radius_server_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_radius_server_facts.py new file mode 100644 index 000000000..988cd8858 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_radius_server_facts.py @@ -0,0 +1,147 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_radius_server_facts +short_description: Get radius-server objects facts on Checkpoint over Web Services API +description: + - Get radius-server objects facts on Checkpoint devices. + - All operations are performed over Web Services API. + - This module handles both operations, get a specific object and get several objects, + For getting a specific object use the parameter 'name'. +version_added: "5.0.0" +author: "Shiran Golzar (@chkp-shirango)" +options: + name: + description: + - Object name. + This parameter is relevant only for getting a specific object. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + filter: + description: + - Search expression to filter objects by. The provided text should be exactly the same as it would be given in SmartConsole Object Explorer. The + logical operators in the expression ('AND', 'OR') should be provided in capital letters. The search involves both a IP search and a textual search in + name, comment, tags etc. + type: str + limit: + description: + - The maximal number of returned results. + This parameter is relevant only for getting few objects. + type: int + offset: + description: + - Number of the results to initially skip. + This parameter is relevant only for getting few objects. + type: int + order: + description: + - Sorts the results by search criteria. Automatically sorts the results by Name, in the ascending order. + This parameter is relevant only for getting few objects. + type: list + elements: dict + suboptions: + ASC: + description: + - Sorts results by the given field in ascending order. + type: str + choices: ['name'] + DESC: + description: + - Sorts results by the given field in descending order. + type: str + choices: ['name'] + show_membership: + description: + - Indicates whether to calculate and show "groups" field for every object in reply. + type: bool + domains_to_process: + description: + - Indicates which domains to process the commands on. It cannot be used with the details-level full, must be run from the System Domain only and + with ignore-warnings true. Valid values are, CURRENT_DOMAIN, ALL_DOMAINS_ON_THIS_SERVER. + type: list + elements: str +extends_documentation_fragment: check_point.mgmt.checkpoint_facts +""" + +EXAMPLES = """ +- name: show-radius-server + cp_mgmt_radius_server_facts: + name: t4 + +- name: show-radius-servers + cp_mgmt_radius_server_facts: + details_level: standard + limit: 4 + offset: 0 +""" + +RETURN = """ +ansible_facts: + description: The checkpoint object facts. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, \ + api_call_facts + + +def main(): + argument_spec = dict( + name=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + filter=dict(type='str'), + limit=dict(type='int'), + offset=dict(type='int'), + order=dict(type='list', elements='dict', options=dict( + ASC=dict(type='str', choices=['name']), + DESC=dict(type='str', choices=['name']) + )), + show_membership=dict(type='bool'), + domains_to_process=dict(type='list', elements='str') + ) + argument_spec.update(checkpoint_argument_spec_for_facts) + + module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + + api_call_object = "radius-server" + api_call_object_plural_version = "radius-servers" + + result = api_call_facts(module, api_call_object, api_call_object_plural_version) + module.exit_json(ansible_facts=result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_reject_session.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_reject_session.py index ab76c1389..967c83d43 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_reject_session.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_reject_session.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -61,14 +63,14 @@ cp_mgmt_reject_session: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): - argument_spec = dict( - uid=dict(type='str'), - comments=dict(type='str') - ) + argument_spec = dict(uid=dict(type="str"), comments=dict(type="str")) argument_spec.update(checkpoint_argument_spec_for_commands) module = AnsibleModule(argument_spec=argument_spec) @@ -79,5 +81,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_repository_package_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_repository_package_facts.py new file mode 100644 index 000000000..a7c50e982 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_repository_package_facts.py @@ -0,0 +1,135 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_repository_package_facts +short_description: Get repository-package objects facts on Checkpoint over Web Services API +description: + - Get repository-package objects facts on Checkpoint devices. + - All operations are performed over Web Services API. + - This module handles both operations, get a specific object and get several objects, + For getting a specific object use the parameter 'name'. +version_added: "5.0.0" +author: "Shiran Golzar (@chkp-shirango)" +options: + name: + description: + - Object name. + This parameter is relevant only for getting a specific object. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + limit: + description: + - The maximal number of returned results. + This parameter is relevant only for getting few objects. + type: int + offset: + description: + - Number of the results to initially skip. + This parameter is relevant only for getting few objects. + type: int + order: + description: + - Sorts the results by search criteria. Automatically sorts the results by Name, in the ascending order. + This parameter is relevant only for getting few objects. + type: list + elements: dict + suboptions: + ASC: + description: + - Sorts results by the given field in ascending order. + type: str + choices: ['name'] + DESC: + description: + - Sorts results by the given field in descending order. + type: str + choices: ['name'] + domains_to_process: + description: + - Indicates which domains to process the commands on. It cannot be used with the details-level full, must be run from the System Domain only and + with ignore-warnings true. Valid values are, CURRENT_DOMAIN, ALL_DOMAINS_ON_THIS_SERVER. + type: list + elements: str +extends_documentation_fragment: check_point.mgmt.checkpoint_facts +""" + +EXAMPLES = """ +- name: show-repository-package + cp_mgmt_repository_package_facts: + name: Check_Point_R80_20_JUMBO_HF_Bundle_T118_sk137592_Security_Gateway_and_Standalone_2_6_18_FULL.tgz + +- name: show-repository-packages + cp_mgmt_repository_package_facts: + details_level: standard + limit: 4 + offset: 0 +""" + +RETURN = """ +ansible_facts: + description: The checkpoint object facts. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, \ + api_call_facts + + +def main(): + argument_spec = dict( + name=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + limit=dict(type='int'), + offset=dict(type='int'), + order=dict(type='list', elements='dict', options=dict( + ASC=dict(type='str', choices=['name']), + DESC=dict(type='str', choices=['name']) + )), + domains_to_process=dict(type='list', elements='str') + ) + argument_spec.update(checkpoint_argument_spec_for_facts) + + module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + + api_call_object = "repository-package" + api_call_object_plural_version = "repository-packages" + + result = api_call_facts(module, api_call_object, api_call_object_plural_version) + module.exit_json(ansible_facts=result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_repository_script.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_repository_script.py index 62d48cc56..113ffbe14 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_repository_script.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_repository_script.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -109,33 +111,74 @@ cp_mgmt_repository_script: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - script_body=dict(type='str'), - script_body_base64=dict(type='str'), - tags=dict(type='list', elements='str'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']) + name=dict(type="str", required=True), + script_body=dict(type="str"), + script_body_base64=dict(type="str"), + tags=dict(type="list", elements="str"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'repository-script' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "repository-script" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_repository_script_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_repository_script_facts.py index 67edad307..15378c927 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_repository_script_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_repository_script_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -98,30 +100,41 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )) + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "repository-script" api_call_object_plural_version = "repository-scripts" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_reset_sic.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_reset_sic.py index cb5b8d00f..28f8e3567 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_reset_sic.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_reset_sic.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -62,13 +64,15 @@ cp_mgmt_reset_sic: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): argument_spec = dict( - name=dict(type='str'), - auto_publish_session=dict(type='bool') + name=dict(type="str"), auto_publish_session=dict(type="bool") ) argument_spec.update(checkpoint_argument_spec_for_commands) @@ -80,5 +84,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_run_ips_update.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_run_ips_update.py index 2c9f99347..aee311dbc 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_run_ips_update.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_run_ips_update.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -55,13 +57,14 @@ cp_mgmt_run_ips_update: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): - argument_spec = dict( - package_path=dict(type='str') - ) + argument_spec = dict(package_path=dict(type="str")) argument_spec.update(checkpoint_argument_spec_for_commands) module = AnsibleModule(argument_spec=argument_spec) @@ -72,5 +75,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_run_script.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_run_script.py index f4dabd98b..93259daeb 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_run_script.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_run_script.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -76,16 +78,19 @@ cp_mgmt_run_script: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): argument_spec = dict( - script_name=dict(type='str'), - script=dict(type='str'), - targets=dict(type='list', elements='str'), - args=dict(type='str'), - comments=dict(type='str') + script_name=dict(type="str"), + script=dict(type="str"), + targets=dict(type="list", elements="str"), + args=dict(type="str"), + comments=dict(type="str"), ) argument_spec.update(checkpoint_argument_spec_for_commands) @@ -97,5 +102,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_security_zone.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_security_zone.py index 6c9cab11b..d1d77b1ae 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_security_zone.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_security_zone.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -100,31 +102,72 @@ cp_mgmt_security_zone: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - tags=dict(type='list', elements='str'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + tags=dict(type="list", elements="str"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'security-zone' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "security-zone" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_security_zone_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_security_zone_facts.py index 90be77462..cf3dc2114 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_security_zone_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_security_zone_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -99,31 +101,42 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - show_membership=dict(type='bool') + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + show_membership=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "security-zone" api_call_object_plural_version = "security-zones" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_citrix_tcp.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_citrix_tcp.py new file mode 100644 index 000000000..8dcdfd796 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_citrix_tcp.py @@ -0,0 +1,135 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_service_citrix_tcp +short_description: Manages service-citrix-tcp objects on Checkpoint over Web Services API +description: + - Manages service-citrix-tcp objects on Checkpoint devices including creating, updating and removing objects. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + name: + description: + - Object name. + type: str + required: True + application: + description: + - Citrix application name. + type: str + tags: + description: + - Collection of tag identifiers. + type: list + elements: str + color: + description: + - Color of the object. Should be one of existing colors. + type: str + choices: ['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green', + 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', + 'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', 'yellow'] + comments: + description: + - Comments string. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + ignore_warnings: + description: + - Apply changes ignoring warnings. + type: bool + ignore_errors: + description: + - Apply changes ignoring errors. You won't be able to publish such a changes. If ignore-warnings flag was omitted - warnings will also be ignored. + type: bool +extends_documentation_fragment: check_point.mgmt.checkpoint_objects +""" + +EXAMPLES = """ +- name: add-service-citrix-tcp + cp_mgmt_service_citrix_tcp: + application: My Citrix Application + name: mycitrixtcp + state: present + +- name: set-service-citrix-tcp + cp_mgmt_service_citrix_tcp: + application: My Citrix Application 2 + name: mycitrixtcp + state: present + +- name: delete-service-citrix-tcp + cp_mgmt_service_citrix_tcp: + name: mycitrixtcp + state: absent +""" + +RETURN = """ +cp_mgmt_service_citrix_tcp: + description: The checkpoint object created or updated. + returned: always, except when deleting the object. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call + + +def main(): + argument_spec = dict( + name=dict(type='str', required=True), + application=dict(type='str'), + tags=dict(type='list', elements='str'), + color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', + 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', + 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', + 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', + 'yellow']), + comments=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + ignore_warnings=dict(type='bool'), + ignore_errors=dict(type='bool') + ) + argument_spec.update(checkpoint_argument_spec_for_objects) + + module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + api_call_object = 'service-citrix-tcp' + + result = api_call(module, api_call_object) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_citrix_tcp_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_citrix_tcp_facts.py new file mode 100644 index 000000000..fd618014b --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_citrix_tcp_facts.py @@ -0,0 +1,144 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_service_citrix_tcp_facts +short_description: Get service-citrix-tcp objects facts on Checkpoint over Web Services API +description: + - Get service-citrix-tcp objects facts on Checkpoint devices. + - All operations are performed over Web Services API. + - This module handles both operations, get a specific object and get several objects, + For getting a specific object use the parameter 'name'. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + name: + description: + - Object name. + This parameter is relevant only for getting a specific object. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + filter: + description: + - Search expression to filter objects by. The provided text should be exactly the same as it would be given in SmartConsole Object Explorer. The + logical operators in the expression ('AND', 'OR') should be provided in capital letters. The search involves both a IP search and a textual search in + name, comment, tags etc. + type: str + limit: + description: + - The maximal number of returned results. + This parameter is relevant only for getting few objects. + type: int + offset: + description: + - Number of the results to initially skip. + This parameter is relevant only for getting few objects. + type: int + order: + description: + - Sorts the results by search criteria. Automatically sorts the results by Name, in the ascending order. + This parameter is relevant only for getting few objects. + type: list + elements: dict + suboptions: + ASC: + description: + - Sorts results by the given field in ascending order. + type: str + choices: ['name'] + DESC: + description: + - Sorts results by the given field in descending order. + type: str + choices: ['name'] + show_membership: + description: + - Indicates whether to calculate and show "groups" field for every object in reply. + type: bool + domains_to_process: + description: + - Indicates which domains to process the commands on. It cannot be used with the details-level full, must be run from the System Domain only and + with ignore-warnings true. Valid values are, CURRENT_DOMAIN, ALL_DOMAINS_ON_THIS_SERVER. + type: list + elements: str +extends_documentation_fragment: check_point.mgmt.checkpoint_facts +""" + +EXAMPLES = """ +- name: show-service-citrix-tcp + cp_mgmt_service_citrix_tcp_facts: + name: mycitrixtcp + +- name: show-services-citrix-tcp + cp_mgmt_service_citrix_tcp_facts: + limit: 10 +""" + +RETURN = """ +ansible_facts: + description: The checkpoint object facts. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts + + +def main(): + argument_spec = dict( + name=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + filter=dict(type='str'), + limit=dict(type='int'), + offset=dict(type='int'), + order=dict(type='list', elements='dict', options=dict( + ASC=dict(type='str', choices=['name']), + DESC=dict(type='str', choices=['name']) + )), + show_membership=dict(type='bool'), + domains_to_process=dict(type='list', elements='str') + ) + argument_spec.update(checkpoint_argument_spec_for_facts) + + module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + + api_call_object = "service-citrix-tcp" + api_call_object_plural_version = "services-citrix-tcp" + + result = api_call_facts(module, api_call_object, api_call_object_plural_version) + module.exit_json(ansible_facts=result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_compound_tcp.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_compound_tcp.py new file mode 100644 index 000000000..2d2a1831b --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_compound_tcp.py @@ -0,0 +1,150 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_service_compound_tcp +short_description: Manages service-compound-tcp objects on Checkpoint over Web Services API +description: + - Manages service-compound-tcp objects on Checkpoint devices including creating, updating and removing objects. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + name: + description: + - Object name. + type: str + required: True + compound_service: + description: + - Compound service type. + type: str + choices: ['pointcast', 'netcaster', 'backweb', 'cdf'] + keep_connections_open_after_policy_installation: + description: + - Keep connections open after policy has been installed even if they are not allowed under the new policy. This overrides the settings in the + Connection Persistence page. If you change this property, the change will not affect open connections, but only future connections. + type: bool + tags: + description: + - Collection of tag identifiers. + type: list + elements: str + color: + description: + - Color of the object. Should be one of existing colors. + type: str + choices: ['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green', + 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', + 'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', 'yellow'] + comments: + description: + - Comments string. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + groups: + description: + - Collection of group identifiers. + type: list + elements: str + ignore_warnings: + description: + - Apply changes ignoring warnings. + type: bool + ignore_errors: + description: + - Apply changes ignoring errors. You won't be able to publish such a changes. If ignore-warnings flag was omitted - warnings will also be ignored. + type: bool +extends_documentation_fragment: check_point.mgmt.checkpoint_objects +""" + +EXAMPLES = """ +- name: add-service-compound-tcp + cp_mgmt_service_compound_tcp: + compound_service: pointcast + keep_connections_open_after_policy_installation: 'True' + name: mycompoundtcp + state: present + +- name: set-service-compound-tcp + cp_mgmt_service_compound_tcp: + compound_service: backweb + keep_connections_open_after_policy_installation: 'False' + name: mycompoundtcp + state: present + +- name: delete-service-compound-tcp + cp_mgmt_service_compound_tcp: + name: mycompoundtcp + state: absent +""" + +RETURN = """ +cp_mgmt_service_compound_tcp: + description: The checkpoint object created or updated. + returned: always, except when deleting the object. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call + + +def main(): + argument_spec = dict( + name=dict(type='str', required=True), + compound_service=dict(type='str', choices=['pointcast', 'netcaster', 'backweb', 'cdf']), + keep_connections_open_after_policy_installation=dict(type='bool'), + tags=dict(type='list', elements='str'), + color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', + 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', + 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', + 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', + 'yellow']), + comments=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + groups=dict(type='list', elements='str'), + ignore_warnings=dict(type='bool'), + ignore_errors=dict(type='bool') + ) + argument_spec.update(checkpoint_argument_spec_for_objects) + + module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + api_call_object = 'service-compound-tcp' + + result = api_call(module, api_call_object) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_compound_tcp_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_compound_tcp_facts.py new file mode 100644 index 000000000..d2b72a3b3 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_compound_tcp_facts.py @@ -0,0 +1,144 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_service_compound_tcp_facts +short_description: Get service-compound-tcp objects facts on Checkpoint over Web Services API +description: + - Get service-compound-tcp objects facts on Checkpoint devices. + - All operations are performed over Web Services API. + - This module handles both operations, get a specific object and get several objects, + For getting a specific object use the parameter 'name'. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + name: + description: + - Object name. + This parameter is relevant only for getting a specific object. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + filter: + description: + - Search expression to filter objects by. The provided text should be exactly the same as it would be given in SmartConsole Object Explorer. The + logical operators in the expression ('AND', 'OR') should be provided in capital letters. The search involves both a IP search and a textual search in + name, comment, tags etc. + type: str + limit: + description: + - The maximal number of returned results. + This parameter is relevant only for getting few objects. + type: int + offset: + description: + - Number of the results to initially skip. + This parameter is relevant only for getting few objects. + type: int + order: + description: + - Sorts the results by search criteria. Automatically sorts the results by Name, in the ascending order. + This parameter is relevant only for getting few objects. + type: list + elements: dict + suboptions: + ASC: + description: + - Sorts results by the given field in ascending order. + type: str + choices: ['name'] + DESC: + description: + - Sorts results by the given field in descending order. + type: str + choices: ['name'] + show_membership: + description: + - Indicates whether to calculate and show "groups" field for every object in reply. + type: bool + domains_to_process: + description: + - Indicates which domains to process the commands on. It cannot be used with the details-level full, must be run from the System Domain only and + with ignore-warnings true. Valid values are, CURRENT_DOMAIN, ALL_DOMAINS_ON_THIS_SERVER. + type: list + elements: str +extends_documentation_fragment: check_point.mgmt.checkpoint_facts +""" + +EXAMPLES = """ +- name: show-service-compound-tcp + cp_mgmt_service_compound_tcp_facts: + name: mycompoundtcp + +- name: show-services-compound-tcp + cp_mgmt_service_compound_tcp_facts: + limit: 10 +""" + +RETURN = """ +ansible_facts: + description: The checkpoint object facts. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts + + +def main(): + argument_spec = dict( + name=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + filter=dict(type='str'), + limit=dict(type='int'), + offset=dict(type='int'), + order=dict(type='list', elements='dict', options=dict( + ASC=dict(type='str', choices=['name']), + DESC=dict(type='str', choices=['name']) + )), + show_membership=dict(type='bool'), + domains_to_process=dict(type='list', elements='str') + ) + argument_spec.update(checkpoint_argument_spec_for_facts) + + module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + + api_call_object = "service-compound-tcp" + api_call_object_plural_version = "services-compound-tcp" + + result = api_call_facts(module, api_call_object, api_call_object_plural_version) + module.exit_json(ansible_facts=result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_dce_rpc.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_dce_rpc.py index 63941587a..ec5ee67b0 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_dce_rpc.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_dce_rpc.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -116,34 +118,75 @@ cp_mgmt_service_dce_rpc: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - interface_uuid=dict(type='str'), - keep_connections_open_after_policy_installation=dict(type='bool'), - tags=dict(type='list', elements='str'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - groups=dict(type='list', elements='str'), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + interface_uuid=dict(type="str"), + keep_connections_open_after_policy_installation=dict(type="bool"), + tags=dict(type="list", elements="str"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + groups=dict(type="list", elements="str"), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'service-dce-rpc' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "service-dce-rpc" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_dce_rpc_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_dce_rpc_facts.py index b9419a93a..59a0517ec 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_dce_rpc_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_dce_rpc_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -102,31 +104,42 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - show_membership=dict(type='bool') + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + show_membership=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "service-dce-rpc" api_call_object_plural_version = "services-dce-rpc" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_group.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_group.py index 1f78ac539..be7a969f5 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_group.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_group.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -117,33 +119,74 @@ cp_mgmt_service_group: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - members=dict(type='list', elements='str'), - tags=dict(type='list', elements='str'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - groups=dict(type='list', elements='str'), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + members=dict(type="list", elements="str"), + tags=dict(type="list", elements="str"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + groups=dict(type="list", elements="str"), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'service-group' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "service-group" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_group_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_group_facts.py index f04e0b961..589849fe0 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_group_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_group_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -112,33 +114,44 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - show_as_ranges=dict(type='bool'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - dereference_group_members=dict(type='bool'), - show_membership=dict(type='bool') + name=dict(type="str"), + show_as_ranges=dict(type="bool"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + dereference_group_members=dict(type="bool"), + show_membership=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "service-group" api_call_object_plural_version = "service-groups" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_icmp.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_icmp.py index 0cd0d4ca8..a5627f4a9 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_icmp.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_icmp.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -120,35 +122,76 @@ cp_mgmt_service_icmp: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - icmp_code=dict(type='int'), - icmp_type=dict(type='int'), - keep_connections_open_after_policy_installation=dict(type='bool'), - tags=dict(type='list', elements='str'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - groups=dict(type='list', elements='str'), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + icmp_code=dict(type="int"), + icmp_type=dict(type="int"), + keep_connections_open_after_policy_installation=dict(type="bool"), + tags=dict(type="list", elements="str"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + groups=dict(type="list", elements="str"), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'service-icmp' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "service-icmp" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_icmp6.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_icmp6.py index fe845e609..4a5bec46a 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_icmp6.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_icmp6.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -120,35 +122,76 @@ cp_mgmt_service_icmp6: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - icmp_code=dict(type='int'), - icmp_type=dict(type='int'), - keep_connections_open_after_policy_installation=dict(type='bool'), - tags=dict(type='list', elements='str'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - groups=dict(type='list', elements='str'), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + icmp_code=dict(type="int"), + icmp_type=dict(type="int"), + keep_connections_open_after_policy_installation=dict(type="bool"), + tags=dict(type="list", elements="str"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + groups=dict(type="list", elements="str"), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'service-icmp6' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "service-icmp6" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_icmp6_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_icmp6_facts.py index d94525f23..539569f3a 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_icmp6_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_icmp6_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -101,31 +103,42 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - show_membership=dict(type='bool') + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + show_membership=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "service-icmp6" api_call_object_plural_version = "services-icmp6" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_icmp_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_icmp_facts.py index 8d044c37f..e8a8f834d 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_icmp_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_icmp_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -101,31 +103,42 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - show_membership=dict(type='bool') + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + show_membership=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "service-icmp" api_call_object_plural_version = "services-icmp" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_other.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_other.py index 8e1766a58..455190ff4 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_other.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_other.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -180,48 +182,92 @@ cp_mgmt_service_other: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - accept_replies=dict(type='bool'), - action=dict(type='str'), - aggressive_aging=dict(type='dict', options=dict( - default_timeout=dict(type='int'), - enable=dict(type='bool'), - timeout=dict(type='int'), - use_default_timeout=dict(type='bool') - )), - ip_protocol=dict(type='int'), - keep_connections_open_after_policy_installation=dict(type='bool'), - match=dict(type='str'), - match_for_any=dict(type='bool'), - override_default_settings=dict(type='bool'), - session_timeout=dict(type='int'), - sync_connections_on_cluster=dict(type='bool'), - tags=dict(type='list', elements='str'), - use_default_session_timeout=dict(type='bool'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - groups=dict(type='list', elements='str'), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + accept_replies=dict(type="bool"), + action=dict(type="str"), + aggressive_aging=dict( + type="dict", + options=dict( + default_timeout=dict(type="int"), + enable=dict(type="bool"), + timeout=dict(type="int"), + use_default_timeout=dict(type="bool"), + ), + ), + ip_protocol=dict(type="int"), + keep_connections_open_after_policy_installation=dict(type="bool"), + match=dict(type="str"), + match_for_any=dict(type="bool"), + override_default_settings=dict(type="bool"), + session_timeout=dict(type="int"), + sync_connections_on_cluster=dict(type="bool"), + tags=dict(type="list", elements="str"), + use_default_session_timeout=dict(type="bool"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + groups=dict(type="list", elements="str"), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'service-other' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "service-other" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_other_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_other_facts.py index e7ad3da11..0cca6ed9f 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_other_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_other_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -102,31 +104,42 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - show_membership=dict(type='bool') + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + show_membership=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "service-other" api_call_object_plural_version = "services-other" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_rpc.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_rpc.py index e9f917ca1..21c0739f2 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_rpc.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_rpc.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -116,34 +118,75 @@ cp_mgmt_service_rpc: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - keep_connections_open_after_policy_installation=dict(type='bool'), - program_number=dict(type='int'), - tags=dict(type='list', elements='str'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - groups=dict(type='list', elements='str'), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + keep_connections_open_after_policy_installation=dict(type="bool"), + program_number=dict(type="int"), + tags=dict(type="list", elements="str"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + groups=dict(type="list", elements="str"), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'service-rpc' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "service-rpc" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_rpc_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_rpc_facts.py index 3ff1f3c0b..7df6d695c 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_rpc_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_rpc_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -102,31 +104,42 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - show_membership=dict(type='bool') + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + show_membership=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "service-rpc" api_call_object_plural_version = "services-rpc" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_sctp.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_sctp.py index 624a81939..e6d7ae333 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_sctp.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_sctp.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -167,45 +169,89 @@ cp_mgmt_service_sctp: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - port=dict(type='str'), - aggressive_aging=dict(type='dict', options=dict( - default_timeout=dict(type='int'), - enable=dict(type='bool'), - timeout=dict(type='int'), - use_default_timeout=dict(type='bool') - )), - keep_connections_open_after_policy_installation=dict(type='bool'), - match_for_any=dict(type='bool'), - session_timeout=dict(type='int'), - source_port=dict(type='str'), - sync_connections_on_cluster=dict(type='bool'), - tags=dict(type='list', elements='str'), - use_default_session_timeout=dict(type='bool'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - groups=dict(type='list', elements='str'), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + port=dict(type="str"), + aggressive_aging=dict( + type="dict", + options=dict( + default_timeout=dict(type="int"), + enable=dict(type="bool"), + timeout=dict(type="int"), + use_default_timeout=dict(type="bool"), + ), + ), + keep_connections_open_after_policy_installation=dict(type="bool"), + match_for_any=dict(type="bool"), + session_timeout=dict(type="int"), + source_port=dict(type="str"), + sync_connections_on_cluster=dict(type="bool"), + tags=dict(type="list", elements="str"), + use_default_session_timeout=dict(type="bool"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + groups=dict(type="list", elements="str"), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'service-sctp' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "service-sctp" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_sctp_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_sctp_facts.py index 852aacff5..5e5a9c102 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_sctp_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_sctp_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -102,31 +104,42 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - show_membership=dict(type='bool') + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + show_membership=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "service-sctp" api_call_object_plural_version = "services-sctp" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_tcp.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_tcp.py index 91b032b05..de251efd2 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_tcp.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_tcp.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -184,48 +186,92 @@ cp_mgmt_service_tcp: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - aggressive_aging=dict(type='dict', options=dict( - default_timeout=dict(type='int'), - enable=dict(type='bool'), - timeout=dict(type='int'), - use_default_timeout=dict(type='bool') - )), - keep_connections_open_after_policy_installation=dict(type='bool'), - match_by_protocol_signature=dict(type='bool'), - match_for_any=dict(type='bool'), - override_default_settings=dict(type='bool'), - port=dict(type='str'), - protocol=dict(type='str'), - session_timeout=dict(type='int'), - source_port=dict(type='str'), - sync_connections_on_cluster=dict(type='bool'), - tags=dict(type='list', elements='str'), - use_default_session_timeout=dict(type='bool'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - groups=dict(type='list', elements='str'), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + aggressive_aging=dict( + type="dict", + options=dict( + default_timeout=dict(type="int"), + enable=dict(type="bool"), + timeout=dict(type="int"), + use_default_timeout=dict(type="bool"), + ), + ), + keep_connections_open_after_policy_installation=dict(type="bool"), + match_by_protocol_signature=dict(type="bool"), + match_for_any=dict(type="bool"), + override_default_settings=dict(type="bool"), + port=dict(type="str"), + protocol=dict(type="str"), + session_timeout=dict(type="int"), + source_port=dict(type="str"), + sync_connections_on_cluster=dict(type="bool"), + tags=dict(type="list", elements="str"), + use_default_session_timeout=dict(type="bool"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + groups=dict(type="list", elements="str"), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'service-tcp' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "service-tcp" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_tcp_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_tcp_facts.py index 55e0c16d9..a9dc3e4ec 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_tcp_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_tcp_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -102,31 +104,42 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - show_membership=dict(type='bool') + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + show_membership=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "service-tcp" api_call_object_plural_version = "services-tcp" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_udp.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_udp.py index 31558754b..cb90ec034 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_udp.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_udp.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -190,49 +192,93 @@ cp_mgmt_service_udp: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - accept_replies=dict(type='bool'), - aggressive_aging=dict(type='dict', options=dict( - default_timeout=dict(type='int'), - enable=dict(type='bool'), - timeout=dict(type='int'), - use_default_timeout=dict(type='bool') - )), - keep_connections_open_after_policy_installation=dict(type='bool'), - match_by_protocol_signature=dict(type='bool'), - match_for_any=dict(type='bool'), - override_default_settings=dict(type='bool'), - port=dict(type='str'), - protocol=dict(type='str'), - session_timeout=dict(type='int'), - source_port=dict(type='str'), - sync_connections_on_cluster=dict(type='bool'), - tags=dict(type='list', elements='str'), - use_default_session_timeout=dict(type='bool'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - groups=dict(type='list', elements='str'), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + accept_replies=dict(type="bool"), + aggressive_aging=dict( + type="dict", + options=dict( + default_timeout=dict(type="int"), + enable=dict(type="bool"), + timeout=dict(type="int"), + use_default_timeout=dict(type="bool"), + ), + ), + keep_connections_open_after_policy_installation=dict(type="bool"), + match_by_protocol_signature=dict(type="bool"), + match_for_any=dict(type="bool"), + override_default_settings=dict(type="bool"), + port=dict(type="str"), + protocol=dict(type="str"), + session_timeout=dict(type="int"), + source_port=dict(type="str"), + sync_connections_on_cluster=dict(type="bool"), + tags=dict(type="list", elements="str"), + use_default_session_timeout=dict(type="bool"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + groups=dict(type="list", elements="str"), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'service-udp' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "service-udp" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_udp_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_udp_facts.py index 1668739ab..14e0ea178 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_udp_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_udp_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -102,31 +104,42 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - show_membership=dict(type='bool') + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + show_membership=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "service-udp" api_call_object_plural_version = "services-udp" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_session_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_session_facts.py index 9b64722da..67ea673f2 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_session_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_session_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -96,30 +98,41 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - view_published_sessions=dict(type='bool'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']) + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + view_published_sessions=dict(type="bool"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "session" api_call_object_plural_version = "sessions" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_api_settings.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_api_settings.py new file mode 100644 index 000000000..127eedb57 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_api_settings.py @@ -0,0 +1,78 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_set_api_settings +short_description: Edit API settings, the changes will be applied after publish followed by running 'api restart' command. +description: + - Edit API settings, the changes will be applied after publish followed by running 'api restart' command. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + accepted_api_calls_from: + description: + - Clients allowed to connect to the API Server. + type: str + choices: ['management server only', 'all ip addresses that can be used for gui clients', 'all ip addresses'] +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: set-api-settings + cp_mgmt_set_api_settings: + accepted_api_calls_from: 'all ip addresses' +""" + +RETURN = """ +cp_mgmt_set_api_settings: + description: The checkpoint set-api-settings output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + accepted_api_calls_from=dict(type='str', choices=['management server only', 'all ip addresses that can be used for gui clients', 'all ip addresses']) + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "set-api-settings" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_cloud_services.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_cloud_services.py new file mode 100644 index 000000000..f182e4cf5 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_cloud_services.py @@ -0,0 +1,114 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_set_cloud_services +short_description: Set the connection settings between the Management Server and Check Point's Infinity Portal. +description: + - Set the connection settings between the Management Server and Check Point's Infinity Portal. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + gateways_onboarding_settings: + description: + - Gateways on-boarding to Infinity Portal settings. + type: dict + suboptions: + connection_method: + description: + - Indicate whether Gateways will be connected to Infinity Portal automatically or only after policy installation. + type: str + choices: ['automatically', 'after install policy'] + participant_gateways: + description: + - Which Gateways will be connected to Infinity Portal. + type: str + choices: ['all', 'specific'] + specific_gateways: + description: + - Selection of targets identified by the name or UID which will be on-boarded to the cloud. Configuration will be applied only when + "participant-gateways" field is set to "specific". + type: list + elements: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + status: + description: + - Connection status. + type: str + choices: ['connected', 'disabled'] +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: set-cloud-services + cp_mgmt_set_cloud_services: + gateways_onboarding_settings: + connection_method: after install policy + participant_gateways: specific + specific_gateways: gw1 +""" + +RETURN = """ +cp_mgmt_set_cloud_services: + description: The checkpoint set-cloud-services output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + gateways_onboarding_settings=dict(type='dict', options=dict( + connection_method=dict(type='str', choices=['automatically', 'after install policy']), + participant_gateways=dict(type='str', choices=['all', 'specific']), + specific_gateways=dict(type='list', elements='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']) + )), + status=dict(type='str', choices=['connected', 'disabled']) + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "set-cloud-services" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_domain.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_domain.py index 186bc4b2d..e9205b647 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_domain.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_domain.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -139,43 +141,92 @@ cp_mgmt_domain: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - servers=dict(type='dict', options=dict( - add=dict(type='list', elements='dict', options=dict( - name=dict(type='str'), - ip_address=dict(type='str'), - ipv4_address=dict(type='str'), - ipv6_address=dict(type='str'), - multi_domain_server=dict(type='str'), - skip_start_domain_server=dict(type='bool'), - type=dict(type='str', choices=['management server', 'log server', 'smc']) - )), - remove=dict(type='list', elements='str') - )), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool'), - tags=dict(type='list', elements='str') + name=dict(type="str", required=True), + servers=dict( + type="dict", + options=dict( + add=dict( + type="list", + elements="dict", + options=dict( + name=dict(type="str"), + ip_address=dict(type="str"), + ipv4_address=dict(type="str"), + ipv6_address=dict(type="str"), + multi_domain_server=dict(type="str"), + skip_start_domain_server=dict(type="bool"), + type=dict( + type="str", + choices=["management server", "log server", "smc"], + ), + ), + ), + remove=dict(type="list", elements="str"), + ), + ), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), + tags=dict(type="list", elements="str"), ) argument_spec.update(checkpoint_argument_spec_for_commands) module = AnsibleModule(argument_spec=argument_spec) - command = 'set-domain' + command = "set-domain" result = api_command(module, command) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_global_domain.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_global_domain.py new file mode 100644 index 000000000..95a787d26 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_global_domain.py @@ -0,0 +1,143 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_set_global_domain +short_description: Edit Global domain object using domain name or UID. +description: + - Edit Global domain object using domain name or UID. When the list of Multi Domain Server is edited, the command is handled asynchronously. A list of + task identifiers is returned to a user. In this case, the changes to the Global domain object are done in a public session and so should not be published. + If the domain is changed in other parameters than the Multi Domain Servers, i.e. comments, color or tags, such changes are done in the user's private + session and therefore should be published. In this case, the returned command output is similar to the one of 'show-global-domain'. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + name: + description: + - Object name. + type: str + servers: + description: + - Multi Domain Servers. When the field is provided, 'set-global-domain' command is executed asynchronously. + type: dict + suboptions: + add: + description: + - Adds to collection of values + type: list + elements: str + remove: + description: + - Removes from collection of values + type: list + elements: str + tags: + description: + - Collection of tag identifiers. Note, The list of tags can not be modified in a single command together with the domain servers. To modify + tags, please use the separate 'set-global-domain' command, without providing the list of domain servers. + type: list + elements: str + color: + description: + - Color of the object. Should be one of existing colors. + type: str + choices: ['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green', + 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', + 'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', 'yellow'] + comments: + description: + - Comments string. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + ignore_warnings: + description: + - Apply changes ignoring warnings. + type: bool + ignore_errors: + description: + - Apply changes ignoring errors. You won't be able to publish such a changes. If ignore-warnings flag was omitted - warnings will also be ignored. + type: bool +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: set-global-domain + cp_mgmt_set_global_domain: + name: Global + tags: + - tag1 + comments: "This is a Global domain" +""" + +RETURN = """ +cp_mgmt_set_global_domain: + description: The checkpoint set-global-domain output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + name=dict(type='str'), + servers=dict(type='dict', options=dict( + add=dict(type='list', elements='str'), + remove=dict(type='list', elements='str') + )), + tags=dict(type='list', elements='str'), + color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', + 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', + 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', + 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', + 'yellow']), + comments=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + ignore_warnings=dict(type='bool'), + ignore_errors=dict(type='bool') + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "set-global-domain" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_global_properties.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_global_properties.py index 12549bb8c..41740c9fd 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_global_properties.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_global_properties.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -1624,7 +1626,6 @@ EXAMPLES = """ logical_name: unique logical name port: 8080 reauthentication: post request - state: present """ RETURN = """ @@ -1635,400 +1636,987 @@ cp_mgmt_set_global_properties: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): argument_spec = dict( - firewall=dict(type='dict', options=dict( - accept_control_connections=dict(type='bool'), - accept_ips1_management_connections=dict(type='bool'), - accept_remote_access_control_connections=dict(type='bool'), - accept_smart_update_connections=dict(type='bool'), - accept_outgoing_packets_originating_from_gw=dict(type='bool'), - accept_outgoing_packets_originating_from_gw_position=dict(type='str', choices=['first', 'last', 'before last']), - accept_outgoing_packets_originating_from_connectra_gw=dict(type='bool'), - accept_outgoing_packets_to_cp_online_services=dict(type='bool'), - accept_outgoing_packets_to_cp_online_services_position=dict(type='str', choices=['first', 'last', 'before last']), - accept_domain_name_over_tcp=dict(type='bool'), - accept_domain_name_over_tcp_position=dict(type='str', choices=['first', 'last', 'before last']), - accept_domain_name_over_udp=dict(type='bool'), - accept_domain_name_over_udp_position=dict(type='str', choices=['first', 'last', 'before last']), - accept_dynamic_addr_modules_outgoing_internet_connections=dict(type='bool'), - accept_icmp_requests=dict(type='bool'), - accept_icmp_requests_position=dict(type='str', choices=['first', 'last', 'before last']), - accept_identity_awareness_control_connections=dict(type='bool'), - accept_identity_awareness_control_connections_position=dict(type='str', choices=['first', 'last', 'before last']), - accept_incoming_traffic_to_dhcp_and_dns_services_of_gws=dict(type='bool'), - accept_rip=dict(type='bool'), - accept_rip_position=dict(type='str', choices=['first', 'last', 'before last']), - accept_vrrp_packets_originating_from_cluster_members=dict(type='bool'), - accept_web_and_ssh_connections_for_gw_administration=dict(type='bool'), - log_implied_rules=dict(type='bool'), - security_server=dict(type='dict', options=dict( - client_auth_welcome_file=dict(type='str'), - ftp_welcome_msg_file=dict(type='str'), - rlogin_welcome_msg_file=dict(type='str'), - telnet_welcome_msg_file=dict(type='str'), - mdq_welcome_msg=dict(type='str'), - smtp_welcome_msg=dict(type='str'), - http_next_proxy_host=dict(type='str'), - http_next_proxy_port=dict(type='int'), - http_servers=dict(type='list', elements='dict', options=dict( - logical_name=dict(type='str'), - host=dict(type='str'), - port=dict(type='int'), - reauthentication=dict(type='str', choices=['standard', 'post request', 'every request']) - )), - server_for_null_requests=dict(type='str') - )) - )), - nat=dict(type='dict', options=dict( - allow_bi_directional_nat=dict(type='bool'), - auto_arp_conf=dict(type='bool'), - merge_manual_proxy_arp_conf=dict(type='bool'), - auto_translate_dest_on_client_side=dict(type='bool'), - manually_translate_dest_on_client_side=dict(type='bool'), - enable_ip_pool_nat=dict(type='bool'), - addr_alloc_and_release_track=dict(type='str', choices=['ip allocation log', 'none']), - addr_exhaustion_track=dict(type='str', choices=['ip exhaustion alert', 'none', 'ip exhaustion log']) - )), - authentication=dict(type='dict', options=dict( - auth_internal_users_with_specific_suffix=dict(type='bool'), - allowed_suffix_for_internal_users=dict(type='str'), - max_days_before_expiration_of_non_pulled_user_certificates=dict(type='int'), - max_client_auth_attempts_before_connection_termination=dict(type='int'), - max_rlogin_attempts_before_connection_termination=dict(type='int'), - max_session_auth_attempts_before_connection_termination=dict(type='int'), - max_telnet_attempts_before_connection_termination=dict(type='int'), - enable_delayed_auth=dict(type='bool'), - delay_each_auth_attempt_by=dict(type='int') - )), - vpn=dict(type='dict', options=dict( - vpn_conf_method=dict(type='str', choices=['simplified', 'traditional', 'per policy']), - domain_name_for_dns_resolving=dict(type='str'), - enable_backup_gw=dict(type='bool'), - enable_decrypt_on_accept_for_gw_to_gw_traffic=dict(type='bool'), - enable_load_distribution_for_mep_conf=dict(type='bool'), - enable_vpn_directional_match_in_vpn_column=dict(type='bool'), - grace_period_after_the_crl_is_not_valid=dict(type='int'), - grace_period_before_the_crl_is_valid=dict(type='int'), - grace_period_extension_for_secure_remote_secure_client=dict(type='int'), - support_ike_dos_protection_from_identified_src=dict(type='str', choices=['puzzles', 'stateless', 'none']), - support_ike_dos_protection_from_unidentified_src=dict(type='str', choices=['puzzles', 'stateless', 'none']) - )), - remote_access=dict(type='dict', options=dict( - enable_back_connections=dict(type='bool'), - keep_alive_packet_to_gw_interval=dict(type='int'), - encrypt_dns_traffic=dict(type='bool'), - simultaneous_login_mode=dict(type='str', choices=['allowonlysinglelogintouser', 'allowseverallogintouser']), - vpn_authentication_and_encryption=dict(type='dict', options=dict( - encryption_algorithms=dict(type='dict', options=dict( - ike=dict(type='dict', options=dict( - support_encryption_algorithms=dict(type='dict', options=dict( - tdes=dict(type='bool'), - aes_128=dict(type='bool'), - aes_256=dict(type='bool'), - des=dict(type='bool') - )), - use_encryption_algorithm=dict(type='str', choices=['AES-256', 'DES', 'AES-128', 'TDES']), - support_data_integrity=dict(type='dict', options=dict( - aes_xcbc=dict(type='bool'), - md5=dict(type='bool'), - sha1=dict(type='bool'), - sha256=dict(type='bool') - )), - use_data_integrity=dict(type='str', choices=['aes-xcbc', 'sha256', 'sha1', 'md5']), - support_diffie_hellman_groups=dict(type='dict', options=dict( - group1=dict(type='bool'), - group14=dict(type='bool'), - group2=dict(type='bool'), - group5=dict(type='bool') - )), - use_diffie_hellman_group=dict(type='str', choices=['group 1', 'group 2', 'group 5', 'group 14']) - )), - ipsec=dict(type='dict', options=dict( - support_encryption_algorithms=dict(type='dict', options=dict( - tdes=dict(type='bool'), - aes_128=dict(type='bool'), - aes_256=dict(type='bool'), - des=dict(type='bool') - )), - use_encryption_algorithm=dict(type='str', choices=['AES-256', 'DES', 'AES-128', 'TDES']), - support_data_integrity=dict(type='dict', options=dict( - aes_xcbc=dict(type='bool'), - md5=dict(type='bool'), - sha1=dict(type='bool'), - sha256=dict(type='bool') - )), - use_data_integrity=dict(type='str', choices=['aes-xcbc', 'sha1', 'sha256', 'sha384', 'sha512', 'md5']), - enforce_encryption_alg_and_data_integrity_on_all_users=dict(type='bool') - )) - )), - encryption_method=dict(type='str', choices=['prefer_ikev2_support_ikev1', 'ike_v2_only', 'ike_v1_only']), - pre_shared_secret=dict(type='bool'), - support_legacy_auth_for_sc_l2tp_nokia_clients=dict(type='bool'), - support_legacy_eap=dict(type='bool'), - support_l2tp_with_pre_shared_key=dict(type='bool'), - l2tp_pre_shared_key=dict(type='str', no_log=True) - )), - vpn_advanced=dict(type='dict', options=dict( - allow_clear_traffic_to_encryption_domain_when_disconnected=dict(type='bool'), - enable_load_distribution_for_mep_conf=dict(type='bool'), - use_first_allocated_om_ip_addr_for_all_conn_to_the_gws_of_the_site=dict(type='bool') - )), - scv=dict(type='dict', options=dict( - apply_scv_on_simplified_mode_fw_policies=dict(type='bool'), - exceptions=dict(type='list', elements='dict', options=dict( - hosts=dict(type='list', elements='str'), - services=dict(type='list', elements='str') - )), - no_scv_for_unsupported_cp_clients=dict(type='bool'), - upon_verification_accept_and_log_client_connection=dict(type='bool'), - only_tcp_ip_protocols_are_used=dict(type='bool'), - policy_installed_on_all_interfaces=dict(type='bool'), - generate_log=dict(type='bool'), - notify_user=dict(type='bool') - )), - ssl_network_extender=dict(type='dict', options=dict( - user_auth_method=dict(type='str', choices=['certificate_with_enrollment', 'certificate', 'mixed', 'legacy']), - supported_encryption_methods=dict(type='str', choices=['3des_or_rc4', '3des_only']), - client_upgrade_upon_connection=dict(type='str', choices=['force_upgrade', 'ask_user', 'no_upgrade']), - client_uninstall_upon_disconnection=dict(type='str', choices=['force_uninstall', 'ask_user', 'dont_uninstall']), - re_auth_user_interval=dict(type='int'), - scan_ep_machine_for_compliance_with_ep_compliance_policy=dict(type='bool'), - client_outgoing_keep_alive_packets_frequency=dict(type='int') - )), - secure_client_mobile=dict(type='dict', options=dict( - user_auth_method=dict(type='str', choices=['certificate_with_enrollment', 'certificate', 'mixed', 'legacy']), - enable_password_caching=dict(type='str', choices=['client_decide', 'true', 'false']), - cache_password_timeout=dict(type='int'), - re_auth_user_interval=dict(type='int'), - connect_mode=dict(type='str', choices=['manual', 'always connected', 'on application request', 'configured on endpoint client']), - automatically_initiate_dialup=dict(type='str', choices=['client_decide', 'true', 'false']), - disconnect_when_device_is_idle=dict(type='str', choices=['client_decide', 'true', 'false']), - supported_encryption_methods=dict(type='str', choices=['3des_or_rc4', '3des_only']), - route_all_traffic_to_gw=dict(type='str', choices=['client_decide', 'true', 'false']) - )), - endpoint_connect=dict(type='dict', options=dict( - enable_password_caching=dict(type='str', choices=['client_decide', 'true', 'false']), - cache_password_timeout=dict(type='int'), - re_auth_user_interval=dict(type='int'), - connect_mode=dict(type='str', choices=['Manual', 'Always Connected', 'Configured On Endpoint Client']), - network_location_awareness=dict(type='str', choices=['client_decide', 'true', 'false']), - network_location_awareness_conf=dict(type='dict', options=dict( - vpn_clients_are_considered_inside_the_internal_network_when_the_client=dict( - type='str', - choices=['connects to gw through internal interface', - 'connects from network or group', - 'runs on computer with access to active directory domain']), - network_or_group_of_conn_vpn_client=dict(type='str'), - consider_wireless_networks_as_external=dict(type='bool'), - excluded_internal_wireless_networks=dict(type='list', elements='str'), - consider_undefined_dns_suffixes_as_external=dict(type='bool'), - dns_suffixes=dict(type='list', elements='str'), - remember_previously_detected_external_networks=dict(type='bool') - )), - disconnect_when_conn_to_network_is_lost=dict(type='str', choices=['client_decide', 'true', 'false']), - disconnect_when_device_is_idle=dict(type='str', choices=['client_decide', 'true', 'false']), - route_all_traffic_to_gw=dict(type='str', choices=['client_decide', 'true', 'false']), - client_upgrade_mode=dict(type='str', choices=['force_upgrade', 'ask_user', 'no_upgrade']) - )), - hot_spot_and_hotel_registration=dict(type='dict', options=dict( - enable_registration=dict(type='bool'), - local_subnets_access_only=dict(type='bool'), - registration_timeout=dict(type='int'), - track_log=dict(type='bool'), - max_ip_access_during_registration=dict(type='int'), - ports=dict(type='list', elements='str') - )) - )), - user_directory=dict(type='dict', options=dict( - enable_password_change_when_user_active_directory_expires=dict(type='bool'), - cache_size=dict(type='int'), - enable_password_expiration_configuration=dict(type='bool'), - password_expires_after=dict(type='int', no_log=False), - timeout_on_cached_users=dict(type='int'), - display_user_dn_at_login=dict(type='str', choices=['no display', 'display upon request', 'display']), - enforce_rules_for_user_mgmt_admins=dict(type='bool'), - min_password_length=dict(type='int', no_log=False), - password_must_include_a_digit=dict(type='bool'), - password_must_include_a_symbol=dict(type='bool'), - password_must_include_lowercase_char=dict(type='bool'), - password_must_include_uppercase_char=dict(type='bool') - )), - qos=dict(type='dict', options=dict( - default_weight_of_rule=dict(type='int'), - max_weight_of_rule=dict(type='int'), - unit_of_measure=dict(type='str', choices=['bits-per-sec', 'bytes-per-sec', 'kbits-per-sec', 'kbytes-per-sec', 'mbits-per-sec', 'mbytes-per-sec']), - authenticated_ip_expiration=dict(type='int'), - non_authenticated_ip_expiration=dict(type='int'), - unanswered_queried_ip_expiration=dict(type='int') - )), - carrier_security=dict(type='dict', options=dict( - block_gtp_in_gtp=dict(type='bool'), - enforce_gtp_anti_spoofing=dict(type='bool'), - produce_extended_logs_on_unmatched_pdus=dict(type='bool'), - produce_extended_logs_on_unmatched_pdus_position=dict(type='str', choices=['before last', 'last']), - protocol_violation_track_option=dict(type='str', choices=['none', 'log', - 'popup alert', 'mail alert', 'snmp trap alert', 'user defined alert no.1', - 'user defined alert no.2', 'user defined alert no.3']), - enable_g_pdu_seq_number_check_with_max_deviation=dict(type='bool'), - g_pdu_seq_number_check_max_deviation=dict(type='int'), - verify_flow_labels=dict(type='bool'), - allow_ggsn_replies_from_multiple_interfaces=dict(type='bool'), - enable_reverse_connections=dict(type='bool'), - gtp_signaling_rate_limit_sampling_interval=dict(type='int'), - one_gtp_echo_on_each_path_frequency=dict(type='int'), - aggressive_aging=dict(type='bool'), - aggressive_timeout=dict(type='int'), - memory_activation_threshold=dict(type='int'), - memory_deactivation_threshold=dict(type='int'), - tunnel_activation_threshold=dict(type='int'), - tunnel_deactivation_threshold=dict(type='int') - )), - user_accounts=dict(type='dict', options=dict( - expiration_date_method=dict(type='str', choices=['expire after', 'expire at']), - expiration_date=dict(type='str'), - days_until_expiration=dict(type='int'), - show_accounts_expiration_indication_days_in_advance=dict(type='bool') - )), - user_authority=dict(type='dict', options=dict( - display_web_access_view=dict(type='bool'), - windows_domains_to_trust=dict(type='str', choices=['selectively', 'all']), - trust_only_following_windows_domains=dict(type='list', elements='str') - )), - connect_control=dict(type='dict', options=dict( - load_agents_port=dict(type='int'), - load_measurement_interval=dict(type='int'), - persistence_server_timeout=dict(type='int'), - server_availability_check_interval=dict(type='int'), - server_check_retries=dict(type='int') - )), - stateful_inspection=dict(type='dict', options=dict( - tcp_start_timeout=dict(type='int'), - tcp_session_timeout=dict(type='int'), - tcp_end_timeout=dict(type='int'), - tcp_end_timeout_r8020_gw_and_above=dict(type='int'), - udp_virtual_session_timeout=dict(type='int'), - icmp_virtual_session_timeout=dict(type='int'), - other_ip_protocols_virtual_session_timeout=dict(type='int'), - sctp_start_timeout=dict(type='int'), - sctp_session_timeout=dict(type='int'), - sctp_end_timeout=dict(type='int'), - accept_stateful_udp_replies_for_unknown_services=dict(type='bool'), - accept_stateful_icmp_errors=dict(type='bool'), - accept_stateful_icmp_replies=dict(type='bool'), - accept_stateful_other_ip_protocols_replies_for_unknown_services=dict(type='bool'), - drop_out_of_state_tcp_packets=dict(type='bool'), - log_on_drop_out_of_state_tcp_packets=dict(type='bool'), - tcp_out_of_state_drop_exceptions=dict(type='list', elements='str'), - drop_out_of_state_icmp_packets=dict(type='bool'), - log_on_drop_out_of_state_icmp_packets=dict(type='bool'), - drop_out_of_state_sctp_packets=dict(type='bool'), - log_on_drop_out_of_state_sctp_packets=dict(type='bool') - )), - log_and_alert=dict(type='dict', options=dict( - administrative_notifications=dict(type='str', choices=['none', 'log', - 'popup alert', 'mail alert', 'snmp trap alert', 'user defined alert no.1', - 'user defined alert no.2', 'user defined alert no.3']), - connection_matched_by_sam=dict(type='str', choices=['Popup Alert', 'Mail Alert', - 'SNMP Trap Alert', 'User Defined Alert no.1', 'User Defined Alert no.2', - 'User Defined Alert no.3']), - dynamic_object_resolution_failure=dict(type='str', choices=['none', 'log', - 'popup alert', 'mail alert', 'snmp trap alert', 'user defined alert no.1', - 'user defined alert no.2', 'user defined alert no.3']), - ip_options_drop=dict(type='str', choices=['none', 'log', 'popup alert', 'mail alert', - 'snmp trap alert', 'user defined alert no.1', 'user defined alert no.2', 'user defined alert no.3']), - packet_is_incorrectly_tagged=dict(type='str', choices=['none', 'log', - 'popup alert', 'mail alert', 'snmp trap alert', 'user defined alert no.1', - 'user defined alert no.2', 'user defined alert no.3']), - packet_tagging_brute_force_attack=dict(type='str', choices=['none', 'log', - 'popup alert', 'mail alert', 'snmp trap alert', 'user defined alert no.1', - 'user defined alert no.2', 'user defined alert no.3']), - sla_violation=dict(type='str', choices=['none', 'log', 'popup alert', 'mail alert', - 'snmp trap alert', 'user defined alert no.1', 'user defined alert no.2', 'user defined alert no.3']), - vpn_conf_and_key_exchange_errors=dict(type='str', choices=['none', 'log', - 'popup alert', 'mail alert', 'snmp trap alert', 'user defined alert no.1', - 'user defined alert no.2', 'user defined alert no.3']), - vpn_packet_handling_error=dict(type='str', choices=['none', 'log', 'popup alert', - 'mail alert', 'snmp trap alert', 'user defined alert no.1', 'user defined alert no.2', - 'user defined alert no.3']), - vpn_successful_key_exchange=dict(type='str', choices=['none', 'log', - 'popup alert', 'mail alert', 'snmp trap alert', 'user defined alert no.1', - 'user defined alert no.2', 'user defined alert no.3']), - log_every_authenticated_http_connection=dict(type='bool'), - log_traffic=dict(type='str', choices=['none', 'log']), - alerts=dict(type='dict', options=dict( - send_popup_alert_to_smartview_monitor=dict(type='bool'), - popup_alert_script=dict(type='str'), - send_mail_alert_to_smartview_monitor=dict(type='bool'), - mail_alert_script=dict(type='str'), - send_snmp_trap_alert_to_smartview_monitor=dict(type='bool'), - snmp_trap_alert_script=dict(type='str'), - send_user_defined_alert_num1_to_smartview_monitor=dict(type='bool'), - user_defined_script_num1=dict(type='str'), - send_user_defined_alert_num2_to_smartview_monitor=dict(type='bool'), - user_defined_script_num2=dict(type='str'), - send_user_defined_alert_num3_to_smartview_monitor=dict(type='bool'), - user_defined_script_num3=dict(type='str'), - default_track_option_for_system_alerts=dict(type='str', choices=['Popup Alert', 'Mail Alert', 'SNMP Trap Alert', - 'User Defined Alert no.1', 'User Defined Alert no.2', - 'User Defined Alert no.3']) - )), - time_settings=dict(type='dict', options=dict( - excessive_log_grace_period=dict(type='int'), - logs_resolving_timeout=dict(type='int'), - status_fetching_interval=dict(type='int'), - virtual_link_statistics_logging_interval=dict(type='int') - )) - )), - data_access_control=dict(type='dict', options=dict( - auto_download_important_data=dict(type='bool'), - auto_download_sw_updates_and_new_features=dict(type='bool'), - send_anonymous_info=dict(type='bool'), - share_sensitive_info=dict(type='bool') - )), - non_unique_ip_address_ranges=dict(type='list', elements='dict', options=dict( - address_type=dict(type='str', choices=['IPv4', 'IPv6']), - first_ipv4_address=dict(type='str'), - first_ipv6_address=dict(type='str'), - last_ipv4_address=dict(type='str'), - last_ipv6_address=dict(type='str') - )), - proxy=dict(type='dict', options=dict( - use_proxy_server=dict(type='bool'), - proxy_address=dict(type='str'), - proxy_port=dict(type='int') - )), - user_check=dict(type='dict', options=dict( - preferred_language=dict(type='str', choices=['Afrikaans', 'Albanian', 'Amharic', 'Arabic', - 'Armenian', 'Basque', 'Belarusian', 'Bosnian', 'Bulgarian', 'Catalan', 'Chinese', 'Croatian', 'Czech', - 'Danish', 'Dutch', 'English', 'Estonian', 'Finnish', 'French', 'Gaelic', 'Georgian', 'German', - 'Greek', 'Hebrew', 'Hindi', 'Hungarian', 'Icelandic', 'Indonesian', 'Irish', 'Italian', 'Japanese', - 'Korean', 'Latvian', 'Lithuanian', 'Macedonia', 'Maltese', 'Nepali', 'Norwegian', 'Polish', - 'Portuguese', 'Romanian', 'Russian', 'Serbian', 'Slovak', 'Slovenian', 'Sorbian', 'Spanish', - 'Swahili', 'Swedish', 'Thai', 'Turkish', 'Ukrainian', 'Vietnamese', 'Welsh']), - send_emails_using_mail_server=dict(type='str') - )), - hit_count=dict(type='dict', options=dict( - enable_hit_count=dict(type='bool'), - keep_hit_count_data_up_to=dict(type='str', choices=['3 months', '6 months', '1 year', '2 years']) - )), - advanced_conf=dict(type='dict', options=dict( - certs_and_pki=dict(type='dict', options=dict( - cert_validation_enforce_key_size=dict(type='str', choices=['off', 'alert', 'fail']), - host_certs_ecdsa_key_size=dict(type='str', choices=['p-256', 'p-384', 'p-521']), - host_certs_key_size=dict(type='str', choices=['4096', '1024', '2048']) - )) - )), - allow_remote_registration_of_opsec_products=dict(type='bool'), - num_spoofing_errs_that_trigger_brute_force=dict(type='int'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - domains_to_process=dict(type='list', elements='str'), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool'), - auto_publish_session=dict(type='bool') + firewall=dict( + type="dict", + options=dict( + accept_control_connections=dict(type="bool"), + accept_ips1_management_connections=dict(type="bool"), + accept_remote_access_control_connections=dict(type="bool"), + accept_smart_update_connections=dict(type="bool"), + accept_outgoing_packets_originating_from_gw=dict(type="bool"), + accept_outgoing_packets_originating_from_gw_position=dict( + type="str", choices=["first", "last", "before last"] + ), + accept_outgoing_packets_originating_from_connectra_gw=dict( + type="bool" + ), + accept_outgoing_packets_to_cp_online_services=dict( + type="bool" + ), + accept_outgoing_packets_to_cp_online_services_position=dict( + type="str", choices=["first", "last", "before last"] + ), + accept_domain_name_over_tcp=dict(type="bool"), + accept_domain_name_over_tcp_position=dict( + type="str", choices=["first", "last", "before last"] + ), + accept_domain_name_over_udp=dict(type="bool"), + accept_domain_name_over_udp_position=dict( + type="str", choices=["first", "last", "before last"] + ), + accept_dynamic_addr_modules_outgoing_internet_connections=dict( + type="bool" + ), + accept_icmp_requests=dict(type="bool"), + accept_icmp_requests_position=dict( + type="str", choices=["first", "last", "before last"] + ), + accept_identity_awareness_control_connections=dict( + type="bool" + ), + accept_identity_awareness_control_connections_position=dict( + type="str", choices=["first", "last", "before last"] + ), + accept_incoming_traffic_to_dhcp_and_dns_services_of_gws=dict( + type="bool" + ), + accept_rip=dict(type="bool"), + accept_rip_position=dict( + type="str", choices=["first", "last", "before last"] + ), + accept_vrrp_packets_originating_from_cluster_members=dict( + type="bool" + ), + accept_web_and_ssh_connections_for_gw_administration=dict( + type="bool" + ), + log_implied_rules=dict(type="bool"), + security_server=dict( + type="dict", + options=dict( + client_auth_welcome_file=dict(type="str"), + ftp_welcome_msg_file=dict(type="str"), + rlogin_welcome_msg_file=dict(type="str"), + telnet_welcome_msg_file=dict(type="str"), + mdq_welcome_msg=dict(type="str"), + smtp_welcome_msg=dict(type="str"), + http_next_proxy_host=dict(type="str"), + http_next_proxy_port=dict(type="int"), + http_servers=dict( + type="list", + elements="dict", + options=dict( + logical_name=dict(type="str"), + host=dict(type="str"), + port=dict(type="int"), + reauthentication=dict( + type="str", + choices=[ + "standard", + "post request", + "every request", + ], + ), + ), + ), + server_for_null_requests=dict(type="str"), + ), + ), + ), + ), + nat=dict( + type="dict", + options=dict( + allow_bi_directional_nat=dict(type="bool"), + auto_arp_conf=dict(type="bool"), + merge_manual_proxy_arp_conf=dict(type="bool"), + auto_translate_dest_on_client_side=dict(type="bool"), + manually_translate_dest_on_client_side=dict(type="bool"), + enable_ip_pool_nat=dict(type="bool"), + addr_alloc_and_release_track=dict( + type="str", choices=["ip allocation log", "none"] + ), + addr_exhaustion_track=dict( + type="str", + choices=[ + "ip exhaustion alert", + "none", + "ip exhaustion log", + ], + ), + ), + ), + authentication=dict( + type="dict", + options=dict( + auth_internal_users_with_specific_suffix=dict(type="bool"), + allowed_suffix_for_internal_users=dict(type="str"), + max_days_before_expiration_of_non_pulled_user_certificates=dict( + type="int" + ), + max_client_auth_attempts_before_connection_termination=dict( + type="int" + ), + max_rlogin_attempts_before_connection_termination=dict( + type="int" + ), + max_session_auth_attempts_before_connection_termination=dict( + type="int" + ), + max_telnet_attempts_before_connection_termination=dict( + type="int" + ), + enable_delayed_auth=dict(type="bool"), + delay_each_auth_attempt_by=dict(type="int"), + ), + ), + vpn=dict( + type="dict", + options=dict( + vpn_conf_method=dict( + type="str", + choices=["simplified", "traditional", "per policy"], + ), + domain_name_for_dns_resolving=dict(type="str"), + enable_backup_gw=dict(type="bool"), + enable_decrypt_on_accept_for_gw_to_gw_traffic=dict( + type="bool" + ), + enable_load_distribution_for_mep_conf=dict(type="bool"), + enable_vpn_directional_match_in_vpn_column=dict(type="bool"), + grace_period_after_the_crl_is_not_valid=dict(type="int"), + grace_period_before_the_crl_is_valid=dict(type="int"), + grace_period_extension_for_secure_remote_secure_client=dict( + type="int" + ), + support_ike_dos_protection_from_identified_src=dict( + type="str", choices=["puzzles", "stateless", "none"] + ), + support_ike_dos_protection_from_unidentified_src=dict( + type="str", choices=["puzzles", "stateless", "none"] + ), + ), + ), + remote_access=dict( + type="dict", + options=dict( + enable_back_connections=dict(type="bool"), + keep_alive_packet_to_gw_interval=dict(type="int"), + encrypt_dns_traffic=dict(type="bool"), + simultaneous_login_mode=dict( + type="str", + choices=[ + "allowonlysinglelogintouser", + "allowseverallogintouser", + ], + ), + vpn_authentication_and_encryption=dict( + type="dict", + options=dict( + encryption_algorithms=dict( + type="dict", + options=dict( + ike=dict( + type="dict", + options=dict( + support_encryption_algorithms=dict( + type="dict", + options=dict( + tdes=dict(type="bool"), + aes_128=dict(type="bool"), + aes_256=dict(type="bool"), + des=dict(type="bool"), + ), + ), + use_encryption_algorithm=dict( + type="str", + choices=[ + "AES-256", + "DES", + "AES-128", + "TDES", + ], + ), + support_data_integrity=dict( + type="dict", + options=dict( + aes_xcbc=dict(type="bool"), + md5=dict(type="bool"), + sha1=dict(type="bool"), + sha256=dict(type="bool"), + ), + ), + use_data_integrity=dict( + type="str", + choices=[ + "aes-xcbc", + "sha256", + "sha1", + "md5", + ], + ), + support_diffie_hellman_groups=dict( + type="dict", + options=dict( + group1=dict(type="bool"), + group14=dict(type="bool"), + group2=dict(type="bool"), + group5=dict(type="bool"), + ), + ), + use_diffie_hellman_group=dict( + type="str", + choices=[ + "group 1", + "group 2", + "group 5", + "group 14", + ], + ), + ), + ), + ipsec=dict( + type="dict", + options=dict( + support_encryption_algorithms=dict( + type="dict", + options=dict( + tdes=dict(type="bool"), + aes_128=dict(type="bool"), + aes_256=dict(type="bool"), + des=dict(type="bool"), + ), + ), + use_encryption_algorithm=dict( + type="str", + choices=[ + "AES-256", + "DES", + "AES-128", + "TDES", + ], + ), + support_data_integrity=dict( + type="dict", + options=dict( + aes_xcbc=dict(type="bool"), + md5=dict(type="bool"), + sha1=dict(type="bool"), + sha256=dict(type="bool"), + ), + ), + use_data_integrity=dict( + type="str", + choices=[ + "aes-xcbc", + "sha1", + "sha256", + "sha384", + "sha512", + "md5", + ], + ), + enforce_encryption_alg_and_data_integrity_on_all_users=dict( + type="bool" + ), + ), + ), + ), + ), + encryption_method=dict( + type="str", + choices=[ + "prefer_ikev2_support_ikev1", + "ike_v2_only", + "ike_v1_only", + ], + ), + pre_shared_secret=dict(type="bool"), + support_legacy_auth_for_sc_l2tp_nokia_clients=dict( + type="bool" + ), + support_legacy_eap=dict(type="bool"), + support_l2tp_with_pre_shared_key=dict(type="bool"), + l2tp_pre_shared_key=dict(type="str", no_log=True), + ), + ), + vpn_advanced=dict( + type="dict", + options=dict( + allow_clear_traffic_to_encryption_domain_when_disconnected=dict( + type="bool" + ), + enable_load_distribution_for_mep_conf=dict( + type="bool" + ), + use_first_allocated_om_ip_addr_for_all_conn_to_the_gws_of_the_site=dict( + type="bool" + ), + ), + ), + scv=dict( + type="dict", + options=dict( + apply_scv_on_simplified_mode_fw_policies=dict( + type="bool" + ), + exceptions=dict( + type="list", + elements="dict", + options=dict( + hosts=dict(type="list", elements="str"), + services=dict(type="list", elements="str"), + ), + ), + no_scv_for_unsupported_cp_clients=dict(type="bool"), + upon_verification_accept_and_log_client_connection=dict( + type="bool" + ), + only_tcp_ip_protocols_are_used=dict(type="bool"), + policy_installed_on_all_interfaces=dict(type="bool"), + generate_log=dict(type="bool"), + notify_user=dict(type="bool"), + ), + ), + ssl_network_extender=dict( + type="dict", + options=dict( + user_auth_method=dict( + type="str", + choices=[ + "certificate_with_enrollment", + "certificate", + "mixed", + "legacy", + ], + ), + supported_encryption_methods=dict( + type="str", choices=["3des_or_rc4", "3des_only"] + ), + client_upgrade_upon_connection=dict( + type="str", + choices=[ + "force_upgrade", + "ask_user", + "no_upgrade", + ], + ), + client_uninstall_upon_disconnection=dict( + type="str", + choices=[ + "force_uninstall", + "ask_user", + "dont_uninstall", + ], + ), + re_auth_user_interval=dict(type="int"), + scan_ep_machine_for_compliance_with_ep_compliance_policy=dict( + type="bool" + ), + client_outgoing_keep_alive_packets_frequency=dict( + type="int" + ), + ), + ), + secure_client_mobile=dict( + type="dict", + options=dict( + user_auth_method=dict( + type="str", + choices=[ + "certificate_with_enrollment", + "certificate", + "mixed", + "legacy", + ], + ), + enable_password_caching=dict( + type="str", + choices=["client_decide", "true", "false"], + ), + cache_password_timeout=dict(type="int"), + re_auth_user_interval=dict(type="int"), + connect_mode=dict( + type="str", + choices=[ + "manual", + "always connected", + "on application request", + "configured on endpoint client", + ], + ), + automatically_initiate_dialup=dict( + type="str", + choices=["client_decide", "true", "false"], + ), + disconnect_when_device_is_idle=dict( + type="str", + choices=["client_decide", "true", "false"], + ), + supported_encryption_methods=dict( + type="str", choices=["3des_or_rc4", "3des_only"] + ), + route_all_traffic_to_gw=dict( + type="str", + choices=["client_decide", "true", "false"], + ), + ), + ), + endpoint_connect=dict( + type="dict", + options=dict( + enable_password_caching=dict( + type="str", + choices=["client_decide", "true", "false"], + ), + cache_password_timeout=dict(type="int"), + re_auth_user_interval=dict(type="int"), + connect_mode=dict( + type="str", + choices=[ + "Manual", + "Always Connected", + "Configured On Endpoint Client", + ], + ), + network_location_awareness=dict( + type="str", + choices=["client_decide", "true", "false"], + ), + network_location_awareness_conf=dict( + type="dict", + options=dict( + vpn_clients_are_considered_inside_the_internal_network_when_the_client=dict( + type="str", + choices=[ + "connects to gw through internal interface", + "connects from network or group", + "runs on computer with access to active directory domain", + ], + ), + network_or_group_of_conn_vpn_client=dict( + type="str" + ), + consider_wireless_networks_as_external=dict( + type="bool" + ), + excluded_internal_wireless_networks=dict( + type="list", elements="str" + ), + consider_undefined_dns_suffixes_as_external=dict( + type="bool" + ), + dns_suffixes=dict(type="list", elements="str"), + remember_previously_detected_external_networks=dict( + type="bool" + ), + ), + ), + disconnect_when_conn_to_network_is_lost=dict( + type="str", + choices=["client_decide", "true", "false"], + ), + disconnect_when_device_is_idle=dict( + type="str", + choices=["client_decide", "true", "false"], + ), + route_all_traffic_to_gw=dict( + type="str", + choices=["client_decide", "true", "false"], + ), + client_upgrade_mode=dict( + type="str", + choices=[ + "force_upgrade", + "ask_user", + "no_upgrade", + ], + ), + ), + ), + hot_spot_and_hotel_registration=dict( + type="dict", + options=dict( + enable_registration=dict(type="bool"), + local_subnets_access_only=dict(type="bool"), + registration_timeout=dict(type="int"), + track_log=dict(type="bool"), + max_ip_access_during_registration=dict(type="int"), + ports=dict(type="list", elements="str"), + ), + ), + ), + ), + user_directory=dict( + type="dict", + options=dict( + enable_password_change_when_user_active_directory_expires=dict( + type="bool" + ), + cache_size=dict(type="int"), + enable_password_expiration_configuration=dict(type="bool"), + password_expires_after=dict(type="int", no_log=False), + timeout_on_cached_users=dict(type="int"), + display_user_dn_at_login=dict( + type="str", + choices=["no display", "display upon request", "display"], + ), + enforce_rules_for_user_mgmt_admins=dict(type="bool"), + min_password_length=dict(type="int", no_log=False), + password_must_include_a_digit=dict(type="bool"), + password_must_include_a_symbol=dict(type="bool"), + password_must_include_lowercase_char=dict(type="bool"), + password_must_include_uppercase_char=dict(type="bool"), + ), + ), + qos=dict( + type="dict", + options=dict( + default_weight_of_rule=dict(type="int"), + max_weight_of_rule=dict(type="int"), + unit_of_measure=dict( + type="str", + choices=[ + "bits-per-sec", + "bytes-per-sec", + "kbits-per-sec", + "kbytes-per-sec", + "mbits-per-sec", + "mbytes-per-sec", + ], + ), + authenticated_ip_expiration=dict(type="int"), + non_authenticated_ip_expiration=dict(type="int"), + unanswered_queried_ip_expiration=dict(type="int"), + ), + ), + carrier_security=dict( + type="dict", + options=dict( + block_gtp_in_gtp=dict(type="bool"), + enforce_gtp_anti_spoofing=dict(type="bool"), + produce_extended_logs_on_unmatched_pdus=dict(type="bool"), + produce_extended_logs_on_unmatched_pdus_position=dict( + type="str", choices=["before last", "last"] + ), + protocol_violation_track_option=dict( + type="str", + choices=[ + "none", + "log", + "popup alert", + "mail alert", + "snmp trap alert", + "user defined alert no.1", + "user defined alert no.2", + "user defined alert no.3", + ], + ), + enable_g_pdu_seq_number_check_with_max_deviation=dict( + type="bool" + ), + g_pdu_seq_number_check_max_deviation=dict(type="int"), + verify_flow_labels=dict(type="bool"), + allow_ggsn_replies_from_multiple_interfaces=dict(type="bool"), + enable_reverse_connections=dict(type="bool"), + gtp_signaling_rate_limit_sampling_interval=dict(type="int"), + one_gtp_echo_on_each_path_frequency=dict(type="int"), + aggressive_aging=dict(type="bool"), + aggressive_timeout=dict(type="int"), + memory_activation_threshold=dict(type="int"), + memory_deactivation_threshold=dict(type="int"), + tunnel_activation_threshold=dict(type="int"), + tunnel_deactivation_threshold=dict(type="int"), + ), + ), + user_accounts=dict( + type="dict", + options=dict( + expiration_date_method=dict( + type="str", choices=["expire after", "expire at"] + ), + expiration_date=dict(type="str"), + days_until_expiration=dict(type="int"), + show_accounts_expiration_indication_days_in_advance=dict( + type="bool" + ), + ), + ), + user_authority=dict( + type="dict", + options=dict( + display_web_access_view=dict(type="bool"), + windows_domains_to_trust=dict( + type="str", choices=["selectively", "all"] + ), + trust_only_following_windows_domains=dict( + type="list", elements="str" + ), + ), + ), + connect_control=dict( + type="dict", + options=dict( + load_agents_port=dict(type="int"), + load_measurement_interval=dict(type="int"), + persistence_server_timeout=dict(type="int"), + server_availability_check_interval=dict(type="int"), + server_check_retries=dict(type="int"), + ), + ), + stateful_inspection=dict( + type="dict", + options=dict( + tcp_start_timeout=dict(type="int"), + tcp_session_timeout=dict(type="int"), + tcp_end_timeout=dict(type="int"), + tcp_end_timeout_r8020_gw_and_above=dict(type="int"), + udp_virtual_session_timeout=dict(type="int"), + icmp_virtual_session_timeout=dict(type="int"), + other_ip_protocols_virtual_session_timeout=dict(type="int"), + sctp_start_timeout=dict(type="int"), + sctp_session_timeout=dict(type="int"), + sctp_end_timeout=dict(type="int"), + accept_stateful_udp_replies_for_unknown_services=dict( + type="bool" + ), + accept_stateful_icmp_errors=dict(type="bool"), + accept_stateful_icmp_replies=dict(type="bool"), + accept_stateful_other_ip_protocols_replies_for_unknown_services=dict( + type="bool" + ), + drop_out_of_state_tcp_packets=dict(type="bool"), + log_on_drop_out_of_state_tcp_packets=dict(type="bool"), + tcp_out_of_state_drop_exceptions=dict( + type="list", elements="str" + ), + drop_out_of_state_icmp_packets=dict(type="bool"), + log_on_drop_out_of_state_icmp_packets=dict(type="bool"), + drop_out_of_state_sctp_packets=dict(type="bool"), + log_on_drop_out_of_state_sctp_packets=dict(type="bool"), + ), + ), + log_and_alert=dict( + type="dict", + options=dict( + administrative_notifications=dict( + type="str", + choices=[ + "none", + "log", + "popup alert", + "mail alert", + "snmp trap alert", + "user defined alert no.1", + "user defined alert no.2", + "user defined alert no.3", + ], + ), + connection_matched_by_sam=dict( + type="str", + choices=[ + "Popup Alert", + "Mail Alert", + "SNMP Trap Alert", + "User Defined Alert no.1", + "User Defined Alert no.2", + "User Defined Alert no.3", + ], + ), + dynamic_object_resolution_failure=dict( + type="str", + choices=[ + "none", + "log", + "popup alert", + "mail alert", + "snmp trap alert", + "user defined alert no.1", + "user defined alert no.2", + "user defined alert no.3", + ], + ), + ip_options_drop=dict( + type="str", + choices=[ + "none", + "log", + "popup alert", + "mail alert", + "snmp trap alert", + "user defined alert no.1", + "user defined alert no.2", + "user defined alert no.3", + ], + ), + packet_is_incorrectly_tagged=dict( + type="str", + choices=[ + "none", + "log", + "popup alert", + "mail alert", + "snmp trap alert", + "user defined alert no.1", + "user defined alert no.2", + "user defined alert no.3", + ], + ), + packet_tagging_brute_force_attack=dict( + type="str", + choices=[ + "none", + "log", + "popup alert", + "mail alert", + "snmp trap alert", + "user defined alert no.1", + "user defined alert no.2", + "user defined alert no.3", + ], + ), + sla_violation=dict( + type="str", + choices=[ + "none", + "log", + "popup alert", + "mail alert", + "snmp trap alert", + "user defined alert no.1", + "user defined alert no.2", + "user defined alert no.3", + ], + ), + vpn_conf_and_key_exchange_errors=dict( + type="str", + choices=[ + "none", + "log", + "popup alert", + "mail alert", + "snmp trap alert", + "user defined alert no.1", + "user defined alert no.2", + "user defined alert no.3", + ], + ), + vpn_packet_handling_error=dict( + type="str", + choices=[ + "none", + "log", + "popup alert", + "mail alert", + "snmp trap alert", + "user defined alert no.1", + "user defined alert no.2", + "user defined alert no.3", + ], + ), + vpn_successful_key_exchange=dict( + type="str", + choices=[ + "none", + "log", + "popup alert", + "mail alert", + "snmp trap alert", + "user defined alert no.1", + "user defined alert no.2", + "user defined alert no.3", + ], + ), + log_every_authenticated_http_connection=dict(type="bool"), + log_traffic=dict(type="str", choices=["none", "log"]), + alerts=dict( + type="dict", + options=dict( + send_popup_alert_to_smartview_monitor=dict( + type="bool" + ), + popup_alert_script=dict(type="str"), + send_mail_alert_to_smartview_monitor=dict(type="bool"), + mail_alert_script=dict(type="str"), + send_snmp_trap_alert_to_smartview_monitor=dict( + type="bool" + ), + snmp_trap_alert_script=dict(type="str"), + send_user_defined_alert_num1_to_smartview_monitor=dict( + type="bool" + ), + user_defined_script_num1=dict(type="str"), + send_user_defined_alert_num2_to_smartview_monitor=dict( + type="bool" + ), + user_defined_script_num2=dict(type="str"), + send_user_defined_alert_num3_to_smartview_monitor=dict( + type="bool" + ), + user_defined_script_num3=dict(type="str"), + default_track_option_for_system_alerts=dict( + type="str", + choices=[ + "Popup Alert", + "Mail Alert", + "SNMP Trap Alert", + "User Defined Alert no.1", + "User Defined Alert no.2", + "User Defined Alert no.3", + ], + ), + ), + ), + time_settings=dict( + type="dict", + options=dict( + excessive_log_grace_period=dict(type="int"), + logs_resolving_timeout=dict(type="int"), + status_fetching_interval=dict(type="int"), + virtual_link_statistics_logging_interval=dict( + type="int" + ), + ), + ), + ), + ), + data_access_control=dict( + type="dict", + options=dict( + auto_download_important_data=dict(type="bool"), + auto_download_sw_updates_and_new_features=dict(type="bool"), + send_anonymous_info=dict(type="bool"), + share_sensitive_info=dict(type="bool"), + ), + ), + non_unique_ip_address_ranges=dict( + type="list", + elements="dict", + options=dict( + address_type=dict(type="str", choices=["IPv4", "IPv6"]), + first_ipv4_address=dict(type="str"), + first_ipv6_address=dict(type="str"), + last_ipv4_address=dict(type="str"), + last_ipv6_address=dict(type="str"), + ), + ), + proxy=dict( + type="dict", + options=dict( + use_proxy_server=dict(type="bool"), + proxy_address=dict(type="str"), + proxy_port=dict(type="int"), + ), + ), + user_check=dict( + type="dict", + options=dict( + preferred_language=dict( + type="str", + choices=[ + "Afrikaans", + "Albanian", + "Amharic", + "Arabic", + "Armenian", + "Basque", + "Belarusian", + "Bosnian", + "Bulgarian", + "Catalan", + "Chinese", + "Croatian", + "Czech", + "Danish", + "Dutch", + "English", + "Estonian", + "Finnish", + "French", + "Gaelic", + "Georgian", + "German", + "Greek", + "Hebrew", + "Hindi", + "Hungarian", + "Icelandic", + "Indonesian", + "Irish", + "Italian", + "Japanese", + "Korean", + "Latvian", + "Lithuanian", + "Macedonia", + "Maltese", + "Nepali", + "Norwegian", + "Polish", + "Portuguese", + "Romanian", + "Russian", + "Serbian", + "Slovak", + "Slovenian", + "Sorbian", + "Spanish", + "Swahili", + "Swedish", + "Thai", + "Turkish", + "Ukrainian", + "Vietnamese", + "Welsh", + ], + ), + send_emails_using_mail_server=dict(type="str"), + ), + ), + hit_count=dict( + type="dict", + options=dict( + enable_hit_count=dict(type="bool"), + keep_hit_count_data_up_to=dict( + type="str", + choices=["3 months", "6 months", "1 year", "2 years"], + ), + ), + ), + advanced_conf=dict( + type="dict", + options=dict( + certs_and_pki=dict( + type="dict", + options=dict( + cert_validation_enforce_key_size=dict( + type="str", choices=["off", "alert", "fail"] + ), + host_certs_ecdsa_key_size=dict( + type="str", choices=["p-256", "p-384", "p-521"] + ), + host_certs_key_size=dict( + type="str", choices=["4096", "1024", "2048"] + ), + ), + ) + ), + ), + allow_remote_registration_of_opsec_products=dict(type="bool"), + num_spoofing_errs_that_trigger_brute_force=dict(type="int"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + domains_to_process=dict(type="list", elements="str"), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), + auto_publish_session=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_commands) @@ -2040,5 +2628,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_ha_state.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_ha_state.py new file mode 100644 index 000000000..a0889076f --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_ha_state.py @@ -0,0 +1,84 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_set_ha_state +short_description: Switch domain server high availability state. +description: + - Switch domain server high availability state. </br>After switching domain server to standby state, the session expires and you need to login again. + <br/>You can run this command from a user or global domain on Multi Domain Server and from the user domain on Security Management Server. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + new_state: + description: + - Domain server new state. + type: str + choices: ['active', 'standby'] + ignore_errors: + description: + - Apply changes ignoring errors. + type: bool +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: set-ha-state + cp_mgmt_set_ha_state: + new_state: active +""" + +RETURN = """ +cp_mgmt_set_ha_state: + description: The checkpoint set-ha-state output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + new_state=dict(type='str', choices=['active', 'standby']), + ignore_errors=dict(type='bool') + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "set-ha-state" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_idp_default_assignment.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_idp_default_assignment.py index c8b74f7f7..00aed9d8b 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_idp_default_assignment.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_idp_default_assignment.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -75,16 +77,19 @@ cp_mgmt_set_idp_default_assignment: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): argument_spec = dict( - identity_provider=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool'), - auto_publish_session=dict(type='bool') + identity_provider=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), + auto_publish_session=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_commands) @@ -96,5 +101,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_idp_to_domain_assignment.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_idp_to_domain_assignment.py index b14aca799..0de52a2cc 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_idp_to_domain_assignment.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_idp_to_domain_assignment.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -85,18 +87,21 @@ cp_mgmt_set_idp_to_domain_assignment: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): argument_spec = dict( - assigned_domain=dict(type='str'), - identity_provider=dict(type='str'), - using_default=dict(type='bool'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool'), - auto_publish_session=dict(type='bool') + assigned_domain=dict(type="str"), + identity_provider=dict(type="str"), + using_default=dict(type="bool"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), + auto_publish_session=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_commands) @@ -108,5 +113,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_ips_update_schedule.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_ips_update_schedule.py new file mode 100644 index 000000000..298d5f657 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_ips_update_schedule.py @@ -0,0 +1,114 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_set_ips_update_schedule +short_description: Edit IPS Update Schedule. +description: + - Edit IPS Update Schedule. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + enabled: + description: + - Enable/Disable IPS Update Schedule. + type: bool + time: + description: + - Time in format HH,mm. + type: str + recurrence: + description: + - Days recurrence. + type: dict + suboptions: + days: + description: + - Valid on specific days. Multiple options, support range of days in months. Example,["1","3","9-20"]. + type: list + elements: str + minutes: + description: + - Valid on interval. The length of time in minutes between updates. + type: int + pattern: + description: + - Valid on "Interval", "Daily", "Weekly", "Monthly" base. + type: str + weekdays: + description: + - Valid on weekdays. Example, "Sun", "Mon"..."Sat". + type: list + elements: str +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: set-ips-update-schedule + cp_mgmt_set_ips_update_schedule: + enabled: true + recurrence: + minutes: 121 + pattern: interval +""" + +RETURN = """ +cp_mgmt_set_ips_update_schedule: + description: The checkpoint set-ips-update-schedule output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + enabled=dict(type='bool'), + time=dict(type='str'), + recurrence=dict(type='dict', options=dict( + days=dict(type='list', elements='str'), + minutes=dict(type='int'), + pattern=dict(type='str'), + weekdays=dict(type='list', elements='str') + )) + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "set-ips-update-schedule" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_login_message.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_login_message.py new file mode 100644 index 000000000..8be27eeb3 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_login_message.py @@ -0,0 +1,102 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_set_login_message +short_description: Edit Login message. +description: + - Edit Login message. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + header: + description: + - Login message header. + type: str + login_message: + description: + - Login message body. + type: str + show_message: + description: + - Whether to show login message. + type: bool + warning: + description: + - Add warning sign. + type: bool + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: set-login-message + cp_mgmt_set_login_message: + header: Warning + login_message: Unauthorized access of this server is prohibited and punished by law + show_message: 'true' + warning: 'true' +""" + +RETURN = """ +cp_mgmt_set_login_message: + description: The checkpoint set-login-message output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + header=dict(type='str'), + login_message=dict(type='str'), + show_message=dict(type='bool'), + warning=dict(type='bool'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']) + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "set-login-message" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_nat_rule.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_nat_rule.py index 01832640e..60204a8a9 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_nat_rule.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_nat_rule.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["deprecated"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -34,6 +36,10 @@ description: - All operations are performed over Web Services API. version_added: "2.0.0" author: "Or Soffer (@chkp-orso)" +deprecated: + alternative: cp_mgmt_nat_rule + why: Newer and updated module released with more functionality. + removed_at_date: '2024-11-01' options: rule_number: description: @@ -114,7 +120,6 @@ EXAMPLES = """ original_service: ssh_version_2 original_source: Any package: standard - state: present """ RETURN = """ @@ -125,27 +130,30 @@ cp_mgmt_set_nat_rule: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): argument_spec = dict( - rule_number=dict(type='str'), - package=dict(type='str'), - enabled=dict(type='bool'), - install_on=dict(type='list', elements='str'), - method=dict(type='str', choices=['static', 'hide', 'nat64', 'nat46']), - new_position=dict(type='str'), - original_destination=dict(type='str'), - original_service=dict(type='str'), - original_source=dict(type='str'), - translated_destination=dict(type='str'), - translated_service=dict(type='str'), - translated_source=dict(type='str'), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + rule_number=dict(type="str"), + package=dict(type="str"), + enabled=dict(type="bool"), + install_on=dict(type="list", elements="str"), + method=dict(type="str", choices=["static", "hide", "nat64", "nat46"]), + new_position=dict(type="str"), + original_destination=dict(type="str"), + original_service=dict(type="str"), + original_source=dict(type="str"), + translated_destination=dict(type="str"), + translated_service=dict(type="str"), + translated_source=dict(type="str"), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_commands) @@ -157,5 +165,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_policy_settings.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_policy_settings.py new file mode 100644 index 000000000..ee7ca8e03 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_policy_settings.py @@ -0,0 +1,111 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_set_policy_settings +short_description: Edit Policy settings, the changes will be applied after publish. +description: + - Edit Policy settings, the changes will be applied after publish. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + last_in_cell: + description: + - Added object after removing the last object in cell. + type: str + choices: ['none', 'restore to default'] + none_object_behavior: + description: + - a 'None' object behavior. Rules with object 'None' will never be matched. + type: str + choices: ['warning', 'error', 'none'] + security_access_defaults: + description: + - Access Policy default values. + type: dict + suboptions: + destination: + description: + - Destination default value for new rule creation. Any or None. + type: str + service: + description: + - Service and Applications default value for new rule creation. Any or None. + type: str + source: + description: + - Source default value for new rule creation. Any or None. + type: str +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: set-policy-settings + cp_mgmt_set_policy_settings: + last_in_cell: any + none_object_behavior: none + security_access_defaults: + destination: any + service: any + source: any +""" + +RETURN = """ +cp_mgmt_set_policy_settings: + description: The checkpoint set-policy-settings output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + last_in_cell=dict(type='str', choices=['none', 'restore to default']), + none_object_behavior=dict(type='str', choices=['warning', 'error', 'none']), + security_access_defaults=dict(type='dict', options=dict( + destination=dict(type='str'), + service=dict(type='str'), + source=dict(type='str') + )) + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "set-policy-settings" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_session.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_session.py index 9979860b2..b47f4c280 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_session.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_session.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -80,7 +82,6 @@ EXAMPLES = """ - name: set-session cp_mgmt_set_session: description: Session to work on ticket number CR00323665 - state: present """ RETURN = """ @@ -91,23 +92,62 @@ cp_mgmt_set_session: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): argument_spec = dict( - description=dict(type='str'), - new_name=dict(type='str'), - tags=dict(type='list', elements='str'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + description=dict(type="str"), + new_name=dict(type="str"), + tags=dict(type="list", elements="str"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_commands) @@ -119,5 +159,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_threat_advanced_settings.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_threat_advanced_settings.py index 15258f900..b1e3702fb 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_threat_advanced_settings.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_threat_advanced_settings.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -111,7 +113,6 @@ EXAMPLES = """ log_unification_timeout: 600 resource_classification.mode: hold resource_classification.web_service_fail_mode: block connections - state: present """ RETURN = """ @@ -122,27 +123,49 @@ cp_mgmt_set_threat_advanced_settings: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): argument_spec = dict( - feed_retrieving_interval=dict(type='str'), - httpi_non_standard_ports=dict(type='bool'), - internal_error_fail_mode=dict(type='str', choices=['allow connections', 'block connections']), - log_unification_timeout=dict(type='int'), - resource_classification=dict(type='dict', options=dict( - custom_settings=dict(type='dict', options=dict( - anti_bot=dict(type='str', choices=['background', 'hold']), - anti_virus=dict(type='str', choices=['background', 'hold']), - zero_phishing=dict(type='str', choices=['background', 'hold']) - )), - mode=dict(type='str', choices=['background', 'hold', 'custom']), - web_service_fail_mode=dict(type='str', choices=['allow connections', 'block connections']) - )), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool'), - auto_publish_session=dict(type='bool') + feed_retrieving_interval=dict(type="str"), + httpi_non_standard_ports=dict(type="bool"), + internal_error_fail_mode=dict( + type="str", choices=["allow connections", "block connections"] + ), + log_unification_timeout=dict(type="int"), + resource_classification=dict( + type="dict", + options=dict( + custom_settings=dict( + type="dict", + options=dict( + anti_bot=dict( + type="str", choices=["background", "hold"] + ), + anti_virus=dict( + type="str", choices=["background", "hold"] + ), + zero_phishing=dict( + type="str", choices=["background", "hold"] + ), + ), + ), + mode=dict( + type="str", choices=["background", "hold", "custom"] + ), + web_service_fail_mode=dict( + type="str", + choices=["allow connections", "block connections"], + ), + ), + ), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), + auto_publish_session=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_commands) @@ -154,5 +177,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_vpn_community_remote_access.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_vpn_community_remote_access.py new file mode 100644 index 000000000..e7406f4b6 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_vpn_community_remote_access.py @@ -0,0 +1,133 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_set_vpn_community_remote_access +short_description: Edit existing Remote Access object. Using object name or uid is optional. +description: + - Edit existing Remote Access object. Using object name or uid is optional. + - Add and Delete API commands for this object are unavailable since there is single object per domain. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + name: + description: + - Object name. + type: str + gateways: + description: + - Collection of Gateway objects identified by the name or UID. + type: list + elements: str + user_groups: + description: + - Collection of User group objects identified by the name or UID. + type: list + elements: str + tags: + description: + - Collection of tag identifiers. + type: list + elements: str + color: + description: + - Color of the object. Should be one of existing colors. + type: str + choices: ['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green', + 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', + 'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', 'yellow'] + comments: + description: + - Comments string. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + ignore_warnings: + description: + - Apply changes ignoring warnings. + type: bool + ignore_errors: + description: + - Apply changes ignoring errors. You won't be able to publish such a changes. If ignore-warnings flag was omitted - warnings will also be ignored. + type: bool +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: set-vpn-community-remote-access + cp_mgmt_set_vpn_community_remote_access: + gateways: + - mygateway + user_groups: + - myusergroup +""" + +RETURN = """ +cp_mgmt_set_vpn_community_remote_access: + description: The checkpoint set-vpn-community-remote-access output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + name=dict(type='str'), + gateways=dict(type='list', elements='str'), + user_groups=dict(type='list', elements='str'), + tags=dict(type='list', elements='str'), + color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', + 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', + 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', + 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', + 'yellow']), + comments=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + ignore_warnings=dict(type='bool'), + ignore_errors=dict(type='bool') + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "set-vpn-community-remote-access" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_access_section.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_access_section.py index dfa684fda..fbb1336d4 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_access_section.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_access_section.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -67,14 +69,17 @@ cp_mgmt_show_access_section: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): argument_spec = dict( - name=dict(type='str'), - layer=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']) + name=dict(type="str"), + layer=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), ) argument_spec.update(checkpoint_argument_spec_for_commands) @@ -86,5 +91,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_api_settings.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_api_settings.py new file mode 100644 index 000000000..eda38db60 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_api_settings.py @@ -0,0 +1,71 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_show_api_settings +short_description: Retrieve API Settings. +description: + - Retrieve API Settings. This command is available only after logging in to the System Data domain. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: {} +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: show-api-settings + cp_mgmt_show_api_settings: +""" + +RETURN = """ +cp_mgmt_show_api_settings: + description: The checkpoint show-api-settings output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "show-api-settings" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_api_versions.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_api_versions.py new file mode 100644 index 000000000..24a535a78 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_api_versions.py @@ -0,0 +1,71 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_show_api_versions +short_description: Shows all supported API versions and current API version (the latest one). +description: + - Shows all supported API versions and current API version (the latest one). + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: {} +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: show-api-versions + cp_mgmt_show_api_versions: +""" + +RETURN = """ +cp_mgmt_show_api_versions: + description: The checkpoint show-api-versions output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "show-api-versions" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_azure_ad_content.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_azure_ad_content.py new file mode 100644 index 000000000..a60a786ec --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_azure_ad_content.py @@ -0,0 +1,152 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_show_azure_ad_content +short_description: Retrieve AzureAD Objects from Azure AD Server. +description: + - Retrieve AzureAD Objects from Azure AD Server. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + azure_ad_name: + description: + - Name of the Azure AD Server where to search for objects. + type: str + azure_ad_uid: + description: + - Unique identifier of the Azure AD Server where to search for objects. + type: str + limit: + description: + - The maximal number of returned results. + type: int + offset: + description: + - Number of the results to initially skip. + type: int + order: + description: + - Sorts the results by search criteria. Automatically sorts the results by Name, in the ascending order. + type: list + elements: dict + suboptions: + ASC: + description: + - Sorts results by the given field in ascending order. + type: str + choices: ['name'] + DESC: + description: + - Sorts results by the given field in descending order. + type: str + choices: ['name'] + uid_in_azure_ad: + description: + - Return result matching the unique identifier of the object on the Azure AD Server. + type: str + filter: + description: + - Return results matching the specified filter. + type: dict + suboptions: + text: + description: + - Return results containing the specified text value. + type: str + uri: + description: + - Return results under the specified Data Center Object (identified by URI). + type: str + parent_uid_in_data_center: + description: + - Return results under the specified Data Center Object (identified by UID). + type: str + details_level: + description: + - Standard and Full description are the same. + type: str + choices: ['uid', 'standard', 'full'] + domains_to_process: + description: + - Indicates which domains to process the commands on. It cannot be used with the details-level full, must be run from the System Domain only and + with ignore-warnings true. Valid values are, CURRENT_DOMAIN, ALL_DOMAINS_ON_THIS_SERVER. + type: list + elements: str +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: show-azure-ad-content + cp_mgmt_show_azure_ad_content: + name: my_azureAD +""" + +RETURN = """ +cp_mgmt_show_azure_ad_content: + description: The checkpoint show-azure-ad-content output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + azure_ad_name=dict(type='str'), + azure_ad_uid=dict(type='str'), + limit=dict(type='int'), + offset=dict(type='int'), + order=dict(type='list', elements='dict', options=dict( + ASC=dict(type='str', choices=['name']), + DESC=dict(type='str', choices=['name']) + )), + uid_in_azure_ad=dict(type='str'), + filter=dict(type='dict', options=dict( + text=dict(type='str'), + uri=dict(type='str'), + parent_uid_in_data_center=dict(type='str') + )), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + domains_to_process=dict(type='list', elements='str') + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "show-azure-ad-content" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_changes.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_changes.py new file mode 100644 index 000000000..214e816c5 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_changes.py @@ -0,0 +1,125 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_show_changes +short_description: Show changes between two sessions. +description: + - Show changes between two sessions. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + from_date: + description: + - The date from which tracking changes is to be performed. ISO 8601. If timezone isn't specified in the input, the Management server's timezone is used. + type: str + from_session: + description: + - The session UID from which tracking changes is to be performed. + type: str + limit: + description: + - Maximum number of sessions to analyze. + type: int + offset: + description: + - Number of sessions to skip (beginning with from-session). + type: int + to_date: + description: + - The date until which tracking changes is to be performed. ISO 8601. If timezone isn't specified in the input, the Management server's timezone is used. + type: str + to_session: + description: + - The session UID until which tracking changes is to be performed. + type: str + dereference_group_members: + description: + - Indicates whether to dereference "members" field by details level for every object in reply. + type: bool + show_membership: + description: + - Indicates whether to calculate and show "groups" field for every object in reply. + type: bool + dereference_max_depth: + description: + - When details level is full you can choose the number of levels in the API reply. + type: int + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: show-changes + cp_mgmt_show_changes: + from_date: '2017-02-01T08:20:50' + to_date: '2017-02-21' +""" + +RETURN = """ +cp_mgmt_show_changes: + description: The checkpoint show-changes output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + from_date=dict(type='str'), + from_session=dict(type='str'), + limit=dict(type='int'), + offset=dict(type='int'), + to_date=dict(type='str'), + to_session=dict(type='str'), + dereference_group_members=dict(type='bool'), + show_membership=dict(type='bool'), + dereference_max_depth=dict(type='int'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']) + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "show-changes" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_cloud_licenses_usage.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_cloud_licenses_usage.py new file mode 100644 index 000000000..10faf1ba7 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_cloud_licenses_usage.py @@ -0,0 +1,71 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_show_cloud_licenses_usage +short_description: Show attached licenses usage. +description: + - Show attached licenses usage. + - All operations are performed over Web Services API. +version_added: "5.2.0" +author: "Eden Brillant (@chkp-edenbr)" +options: {} +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: show-cloud-licenses-usage + cp_mgmt_show_cloud_licenses_usage: +""" + +RETURN = """ +cp_mgmt_show_cloud_licenses_usage: + description: The checkpoint show-cloud-licenses-usage output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "show-cloud-licenses-usage" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_cloud_services.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_cloud_services.py index 91725ff53..bff5b92b9 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_cloud_services.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_cloud_services.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -51,12 +53,14 @@ cp_mgmt_show_cloud_services: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): - argument_spec = dict( - ) + argument_spec = dict() argument_spec.update(checkpoint_argument_spec_for_commands) module = AnsibleModule(argument_spec=argument_spec) @@ -67,5 +71,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_commands.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_commands.py new file mode 100644 index 000000000..aae501fd3 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_commands.py @@ -0,0 +1,76 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_show_commands +short_description: Retrieve all of the supported Management API commands with their description. +description: + - Retrieve all of the supported Management API commands with their description. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + prefix: + description: + - The prefix of the desired commands to show. + type: str +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: show-commands + cp_mgmt_show_commands: +""" + +RETURN = """ +cp_mgmt_show_commands: + description: The checkpoint show-commands output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + prefix=dict(type='str') + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "show-commands" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_gateways_and_servers.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_gateways_and_servers.py new file mode 100644 index 000000000..5f4a23201 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_gateways_and_servers.py @@ -0,0 +1,119 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_show_gateways_and_servers +short_description: Shows list of Gateways & Servers sorted by name. +description: + - Shows list of Gateways & Servers sorted by name. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + limit: + description: + - The maximal number of returned results. + This parameter is relevant only for getting few objects. + type: int + offset: + description: + - Number of the results to initially skip. + This parameter is relevant only for getting few objects. + type: int + order: + description: + - Sorts the results by search criteria. Automatically sorts the results by Name, in the ascending order. + This parameter is relevant only for getting few objects. + type: list + elements: dict + suboptions: + ASC: + description: + - Sorts results by the given field in ascending order. + type: str + choices: ['name'] + DESC: + description: + - Sorts results by the given field in descending order. + type: str + choices: ['name'] + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + domains_to_process: + description: + - Indicates which domains to process the commands on. It cannot be used with the details-level full, must be run from the System Domain only and + with ignore-warnings true. Valid values are, CURRENT_DOMAIN, ALL_DOMAINS_ON_THIS_SERVER. + type: list + elements: str +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: show-gateways-and-servers + cp_mgmt_show_gateways_and_servers: + details_level: full +""" + +RETURN = """ +cp_mgmt_show_gateways_and_servers: + description: The checkpoint show-gateways-and-servers output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + limit=dict(type='int'), + offset=dict(type='int'), + order=dict(type='list', elements='dict', options=dict( + ASC=dict(type='str', choices=['name']), + DESC=dict(type='str', choices=['name']) + )), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + domains_to_process=dict(type='list', elements='str') + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "show-gateways-and-servers" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_global_domain.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_global_domain.py new file mode 100644 index 000000000..95d367eed --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_global_domain.py @@ -0,0 +1,85 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_show_global_domain +short_description: Retrieve existing object using object name or uid. +description: + - Retrieve existing object using object name or uid. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + name: + description: + - Object name. + This parameter is relevant only for getting a specific object. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: show-global-domain + cp_mgmt_show_global_domain: + name: Global +""" + +RETURN = """ +cp_mgmt_show_global_domain: + description: The checkpoint show-global-domain output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + name=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']) + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "show-global-domain" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_global_properties.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_global_properties.py index 24f40149b..5234d39d4 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_global_properties.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_global_properties.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -51,12 +53,14 @@ cp_mgmt_show_global_properties: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): - argument_spec = dict( - ) + argument_spec = dict() argument_spec.update(checkpoint_argument_spec_for_commands) module = AnsibleModule(argument_spec=argument_spec) @@ -67,5 +71,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_ha_state.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_ha_state.py new file mode 100644 index 000000000..6692efa83 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_ha_state.py @@ -0,0 +1,71 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_show_ha_state +short_description: Retrieve domain high availability state. +description: + - Retrieve domain high availability state. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: {} +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: show-ha-state + cp_mgmt_show_ha_state: +""" + +RETURN = """ +cp_mgmt_show_ha_state: + description: The checkpoint show-ha-state output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "show-ha-state" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_ha_status.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_ha_status.py new file mode 100644 index 000000000..8ed957e98 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_ha_status.py @@ -0,0 +1,71 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_show_ha_status +short_description: Retrieve domain high availability status. +description: + - Retrieve domain high availability status. + - All operations are performed over Web Services API. +version_added: "5.2.0" +author: "Eden Brillant (@chkp-edenbr)" +options: {} +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: show-ha-status + cp_mgmt_show_ha_status: +""" + +RETURN = """ +cp_mgmt_show_ha_status: + description: The checkpoint show-ha-status output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "show-ha-status" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_https_section.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_https_section.py index e05e8b4b3..14a8bba52 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_https_section.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_https_section.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -67,14 +69,17 @@ cp_mgmt_show_https_section: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): argument_spec = dict( - name=dict(type='str'), - layer=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']) + name=dict(type="str"), + layer=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), ) argument_spec.update(checkpoint_argument_spec_for_commands) @@ -86,5 +91,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_idp_default_assignment.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_idp_default_assignment.py index e6962ce94..d0f18772f 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_idp_default_assignment.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_idp_default_assignment.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -57,12 +59,15 @@ cp_mgmt_show_idp_default_assignment: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): argument_spec = dict( - details_level=dict(type='str', choices=['uid', 'standard', 'full']) + details_level=dict(type="str", choices=["uid", "standard", "full"]) ) argument_spec.update(checkpoint_argument_spec_for_commands) @@ -74,5 +79,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_ips_status.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_ips_status.py new file mode 100644 index 000000000..608bd47b0 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_ips_status.py @@ -0,0 +1,71 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_show_ips_status +short_description: show ips status on Checkpoint over Web Services API +description: + - show ips status on Checkpoint over Web Services API + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: {} +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: show-ips-status + cp_mgmt_show_ips_status: +""" + +RETURN = """ +cp_mgmt_show_ips_status: + description: The checkpoint show-ips-status output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "show-ips-status" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_ips_update_schedule.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_ips_update_schedule.py new file mode 100644 index 000000000..31303974b --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_ips_update_schedule.py @@ -0,0 +1,71 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_show_ips_update_schedule +short_description: Retrieve IPS Update Schedule. +description: + - Retrieve IPS Update Schedule. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: {} +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: show-ips-update-schedule + cp_mgmt_show_ips_update_schedule: +""" + +RETURN = """ +cp_mgmt_show_ips_update_schedule: + description: The checkpoint show-ips-update-schedule output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "show-ips-update-schedule" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_layer_structure.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_layer_structure.py new file mode 100644 index 000000000..d3156cf7b --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_layer_structure.py @@ -0,0 +1,104 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_show_layer_structure +short_description: Shows the entire layer structure. +description: + - Shows the entire layer structure. The layer structure is divided into sections and each section has its own entities. + - Supported layer types include Access Control, NAT, Custom Threat Prevention, Threat Exception and HTTPS Inspection. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + name: + description: + - Object name. Must be unique in the domain. + type: str + required: True + package: + description: + - Name of the package. Must be set when want to receive the resolved rule instead of the place holder in global domain layer. + type: str + limit: + description: + - The maximal number of returned results. + type: int + offset: + description: + - Number of the results to initially skip. + type: int + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard'] +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: show-layer-structure + cp_mgmt_show_layer_structure: + details_level: standard + limit: 20 + name: Network + offset: 0 +""" + +RETURN = """ +cp_mgmt_show_layer_structure: + description: The checkpoint show-layer-structure output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + name=dict(type='str', required=True), + package=dict(type='str'), + limit=dict(type='int'), + offset=dict(type='int'), + details_level=dict(type='str', choices=['uid', 'standard']) + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "show-layer-structure" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_login_message.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_login_message.py new file mode 100644 index 000000000..51b5f673d --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_login_message.py @@ -0,0 +1,79 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_show_login_message +short_description: Retrieve Login message. +description: + - Retrieve Login message. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: show-login-message + cp_mgmt_show_login_message: + details_level: full +""" + +RETURN = """ +cp_mgmt_show_login_message: + description: The checkpoint show-login-message output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + details_level=dict(type='str', choices=['uid', 'standard', 'full']) + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "show-login-message" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_logs.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_logs.py index 59ecccd35..4508bba55 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_logs.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_logs.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -113,27 +115,61 @@ cp_mgmt_show_logs: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): argument_spec = dict( - new_query=dict(type='dict', options=dict( - filter=dict(type='str'), - time_frame=dict(type='str', choices=['last-7-days', 'last-hour', 'today', 'last-24-hours', 'yesterday', - 'this-week', 'this-month', 'last-30-days', 'all-time', 'custom']), - custom_start=dict(type='str'), - custom_end=dict(type='str'), - max_logs_per_request=dict(type='int'), - top=dict(type='dict', options=dict( - field=dict(type='str', choices=['sources', 'destinations', 'services', 'actions', 'blades', 'origins', 'users', 'applications']), - count=dict(type='int') - )), - type=dict(type='str', choices=['logs', 'audit']), - log_servers=dict(type='list', elements='str') - )), - query_id=dict(type='str'), - ignore_warnings=dict(type='bool') + new_query=dict( + type="dict", + options=dict( + filter=dict(type="str"), + time_frame=dict( + type="str", + choices=[ + "last-7-days", + "last-hour", + "today", + "last-24-hours", + "yesterday", + "this-week", + "this-month", + "last-30-days", + "all-time", + "custom", + ], + ), + custom_start=dict(type="str"), + custom_end=dict(type="str"), + max_logs_per_request=dict(type="int"), + top=dict( + type="dict", + options=dict( + field=dict( + type="str", + choices=[ + "sources", + "destinations", + "services", + "actions", + "blades", + "origins", + "users", + "applications", + ], + ), + count=dict(type="int"), + ), + ), + type=dict(type="str", choices=["logs", "audit"]), + log_servers=dict(type="list", elements="str"), + ), + ), + query_id=dict(type="str"), + ignore_warnings=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_commands) @@ -145,5 +181,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_nat_section.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_nat_section.py index 92809266c..086e4b53b 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_nat_section.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_nat_section.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -67,14 +69,17 @@ cp_mgmt_show_nat_section: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): argument_spec = dict( - name=dict(type='str'), - package=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']) + name=dict(type="str"), + package=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), ) argument_spec.update(checkpoint_argument_spec_for_commands) @@ -86,5 +91,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_place_holder.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_place_holder.py new file mode 100644 index 000000000..f1395f108 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_place_holder.py @@ -0,0 +1,84 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_show_place_holder +short_description: Retrieve existing object using object uid. +description: + - Retrieve existing object using object uid. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + uid: + description: + - Object unique identifier. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: show-place-holder + cp_mgmt_show_place_holder: + uid: 5df27676-83a6-4d38-beaa-0413838a7f85 +""" + +RETURN = """ +cp_mgmt_show_place_holder: + description: The checkpoint show-place-holder output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + uid=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']) + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "show-place-holder" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_policy_settings.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_policy_settings.py new file mode 100644 index 000000000..2b03c8272 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_policy_settings.py @@ -0,0 +1,71 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_show_policy_settings +short_description: Show Policy settings. +description: + - Show Policy settings. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: {} +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: show-policy-settings + cp_mgmt_show_policy_settings: +""" + +RETURN = """ +cp_mgmt_show_policy_settings: + description: The checkpoint show-policy-settings output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "show-policy-settings" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_servers_and_processes.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_servers_and_processes.py index 6014b40a3..03a9b2e5a 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_servers_and_processes.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_servers_and_processes.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -53,12 +55,14 @@ cp_mgmt_show_servers_and_processes: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): - argument_spec = dict( - ) + argument_spec = dict() argument_spec.update(checkpoint_argument_spec_for_commands) module = AnsibleModule(argument_spec=argument_spec) @@ -69,5 +73,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_software_package_details.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_software_package_details.py index 0b6ef90b7..d4ea50161 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_software_package_details.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_software_package_details.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -56,13 +58,14 @@ cp_mgmt_show_software_package_details: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): - argument_spec = dict( - name=dict(type='str') - ) + argument_spec = dict(name=dict(type="str")) argument_spec.update(checkpoint_argument_spec_for_commands) module = AnsibleModule(argument_spec=argument_spec) @@ -73,5 +76,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_software_packages_per_targets.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_software_packages_per_targets.py new file mode 100644 index 000000000..c03850eac --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_software_packages_per_targets.py @@ -0,0 +1,109 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_show_software_packages_per_targets +short_description: Shows software packages on targets. +description: + - Shows software packages on targets. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Shiran Golzar (@chkp-shirango)" +options: + display: + description: + - Filter the displayed results. + type: dict + suboptions: + category: + description: + - The package categories to include in the results. + type: list + elements: str + installed: + description: + - Show installed packages, available packages, or both. + type: str + choices: ['yes', 'no', 'any'] + recommended: + description: + - Show only recommended packages, other packages, or both. + type: str + choices: ['yes', 'no', 'any'] + targets: + description: + - On what targets to execute this command. Targets may be identified by their object name, or object unique identifier. + type: list + elements: str +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: show-software-packages-per-targets + cp_mgmt_show_software_packages_per_targets: + display: + category: major + installed: 'no' + recommended: any + targets: + - corporate-gateway +""" + +RETURN = """ +cp_mgmt_show_software_packages_per_targets: + description: The checkpoint show-software-packages-per-targets output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, \ + api_command + + +def main(): + argument_spec = dict( + display=dict(type='dict', options=dict( + category=dict(type='list', elements='str'), + installed=dict(type='str', choices=['yes', 'no', 'any']), + recommended=dict(type='str', choices=['yes', 'no', 'any']) + )), + targets=dict(type='list', elements='str') + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "show-software-packages-per-targets" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_task.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_task.py index d90bc7bbf..bf6cab246 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_task.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_task.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["deprecated"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -34,6 +36,10 @@ description: - All operations are performed over Web Services API. version_added: "2.0.0" author: "Or Soffer (@chkp-orso)" +deprecated: + alternative: cp_mgmt_task_facts + why: Newer single facts module released. + removed_at_date: '2024-11-01' options: task_id: description: @@ -63,13 +69,16 @@ cp_mgmt_show_task: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): argument_spec = dict( - task_id=dict(type='list', elements='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']) + task_id=dict(type="list", elements="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), ) argument_spec.update(checkpoint_argument_spec_for_commands) @@ -81,5 +90,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_tasks.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_tasks.py index a9fcdd872..77a7a9171 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_tasks.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_tasks.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["deprecated"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -34,6 +36,10 @@ description: - All operations are performed over Web Services API. version_added: "2.0.0" author: "Or Soffer (@chkp-orso)" +deprecated: + alternative: cp_mgmt_task_facts + why: Newer single facts module released. + removed_at_date: '2024-11-01' options: initiator: description: @@ -103,22 +109,31 @@ cp_mgmt_show_tasks: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): argument_spec = dict( - initiator=dict(type='str'), - status=dict(type='str', choices=['successful', 'failed', 'in-progress', 'all']), - from_date=dict(type='str'), - to_date=dict(type='str'), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - details_level=dict(type='str', choices=['uid', 'standard', 'full']) + initiator=dict(type="str"), + status=dict( + type="str", choices=["successful", "failed", "in-progress", "all"] + ), + from_date=dict(type="str"), + to_date=dict(type="str"), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + details_level=dict(type="str", choices=["uid", "standard", "full"]), ) argument_spec.update(checkpoint_argument_spec_for_commands) @@ -130,5 +145,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_threat_advanced_settings.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_threat_advanced_settings.py index 5af7329a7..72d1a549c 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_threat_advanced_settings.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_threat_advanced_settings.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -51,12 +53,14 @@ cp_mgmt_show_threat_advanced_settings: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): - argument_spec = dict( - ) + argument_spec = dict() argument_spec.update(checkpoint_argument_spec_for_commands) module = AnsibleModule(argument_spec=argument_spec) @@ -67,5 +71,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_unused_objects.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_unused_objects.py new file mode 100644 index 000000000..53118916e --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_unused_objects.py @@ -0,0 +1,138 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_show_unused_objects +short_description: Retrieve all unused objects. +description: + - Retrieve all unused objects. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + filter: + description: + - Search expression to filter objects by. The provided text should be exactly the same as it would be given in SmartConsole Object Explorer. The + logical operators in the expression ('AND', 'OR') should be provided in capital letters. The search involves both a IP search and a textual search in + name, comment, tags etc. + type: str + limit: + description: + - The maximal number of returned results. + This parameter is relevant only for getting few objects. + type: int + offset: + description: + - Number of the results to initially skip. + This parameter is relevant only for getting few objects. + type: int + order: + description: + - Sorts the results by search criteria. Automatically sorts the results by Name, in the ascending order. + This parameter is relevant only for getting few objects. + type: list + elements: dict + suboptions: + ASC: + description: + - Sorts results by the given field in ascending order. + type: str + choices: ['name'] + DESC: + description: + - Sorts results by the given field in descending order. + type: str + choices: ['name'] + dereference_group_members: + description: + - Indicates whether to dereference "members" field by details level for every object in reply. + type: bool + show_membership: + description: + - Indicates whether to calculate and show "groups" field for every object in reply. + type: bool + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + domains_to_process: + description: + - Indicates which domains to process the commands on. It cannot be used with the details-level full, must be run from the System Domain only and + with ignore-warnings true. Valid values are, CURRENT_DOMAIN, ALL_DOMAINS_ON_THIS_SERVER. + type: list + elements: str +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: show-unused-objects + cp_mgmt_show_unused_objects: + details_level: standard + limit: 50 + offset: 0 +""" + +RETURN = """ +cp_mgmt_show_unused_objects: + description: The checkpoint show-unused-objects output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + filter=dict(type='str'), + limit=dict(type='int'), + offset=dict(type='int'), + order=dict(type='list', elements='dict', options=dict( + ASC=dict(type='str', choices=['name']), + DESC=dict(type='str', choices=['name']) + )), + dereference_group_members=dict(type='bool'), + show_membership=dict(type='bool'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + domains_to_process=dict(type='list', elements='str') + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "show-unused-objects" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_updatable_objects_repository_content.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_updatable_objects_repository_content.py new file mode 100644 index 000000000..59320df7a --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_updatable_objects_repository_content.py @@ -0,0 +1,143 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_show_updatable_objects_repository_content +short_description: Shows the content of the available updatable objects from the Check Point User Center. +description: + - Shows the content of the available updatable objects from the Check Point User Center. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + uid_in_updatable_objects_repository: + description: + - The object's unique identifier in the Updatable Objects repository. + type: str + filter: + description: + - Return results matching the specified filter. + type: dict + suboptions: + text: + description: + - Return results containing the specified text value. + type: str + uri: + description: + - Return results under the specified uri value. + type: str + parent_uid_in_updatable_objects_repository: + description: + - Return results under the specified Updatable Object. + type: str + limit: + description: + - The maximal number of returned results. + type: int + offset: + description: + - Number of the results to initially skip. + type: int + order: + description: + - Sorts the results by search criteria. Automatically sorts the results by Name, in the ascending order. + type: list + elements: dict + suboptions: + ASC: + description: + - Sorts results by the given field in ascending order. + type: str + choices: ['name'] + DESC: + description: + - Sorts results by the given field in descending order. + type: str + choices: ['name'] + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + domains_to_process: + description: + - Indicates which domains to process the commands on. It cannot be used with the details-level full, must be run from the System Domain only and + with ignore-warnings true. Valid values are, CURRENT_DOMAIN, ALL_DOMAINS_ON_THIS_SERVER. + type: list + elements: str +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: show-updatable-objects-repository-content + cp_mgmt_show_updatable_objects_repository_content: + limit: 1 +""" + +RETURN = """ +cp_mgmt_show_updatable_objects_repository_content: + description: The checkpoint show-updatable-objects-repository-content output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + uid_in_updatable_objects_repository=dict(type='str'), + filter=dict(type='dict', options=dict( + text=dict(type='str'), + uri=dict(type='str'), + parent_uid_in_updatable_objects_repository=dict(type='str') + )), + limit=dict(type='int'), + offset=dict(type='int'), + order=dict(type='list', elements='dict', options=dict( + ASC=dict(type='str', choices=['name']), + DESC=dict(type='str', choices=['name']) + )), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + domains_to_process=dict(type='list', elements='str') + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "show-updatable-objects-repository-content" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_validations.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_validations.py new file mode 100644 index 000000000..c90a6d18d --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_validations.py @@ -0,0 +1,71 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_show_validations +short_description: Show all validation incidents limited to 500. +description: + - Show all validation incidents limited to 500. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: {} +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: show-validations + cp_mgmt_show_validations: +""" + +RETURN = """ +cp_mgmt_show_validations: + description: The checkpoint show-validations output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "show-validations" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_simple_cluster.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_simple_cluster.py index 0742d2489..11a2e5caa 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_simple_cluster.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_simple_cluster.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -1023,265 +1025,608 @@ cp_mgmt_simple_cluster: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - ip_address=dict(type='str'), - ipv4_address=dict(type='str'), - ipv6_address=dict(type='str'), - anti_bot=dict(type='bool'), - anti_virus=dict(type='bool'), - application_control=dict(type='bool'), - cluster_mode=dict(type='str', choices=['cluster-xl-ha', 'cluster-ls-multicast', 'cluster-ls-unicast', 'opsec-ha', 'opsec-ls']), - content_awareness=dict(type='bool'), - firewall=dict(type='bool'), - firewall_settings=dict(type='dict', options=dict( - auto_calculate_connections_hash_table_size_and_memory_pool=dict(type='bool'), - auto_maximum_limit_for_concurrent_connections=dict(type='bool'), - connections_hash_size=dict(type='int'), - maximum_limit_for_concurrent_connections=dict(type='int'), - maximum_memory_pool_size=dict(type='int'), - memory_pool_size=dict(type='int') - )), - hardware=dict(type='str'), - interfaces=dict(type='list', elements='dict', options=dict( - name=dict(type='str'), - interface_type=dict(type='str', choices=['cluster', 'sync', 'cluster + sync', 'private']), - ip_address=dict(type='str'), - ipv4_address=dict(type='str'), - ipv6_address=dict(type='str'), - network_mask=dict(type='str'), - ipv4_network_mask=dict(type='str'), - ipv6_network_mask=dict(type='str'), - mask_length=dict(type='str'), - ipv4_mask_length=dict(type='str'), - ipv6_mask_length=dict(type='str'), - anti_spoofing=dict(type='bool'), - anti_spoofing_settings=dict(type='dict', options=dict( - action=dict(type='str', choices=['prevent', 'detect']), - exclude_packets=dict(type='bool'), - excluded_network_name=dict(type='str'), - excluded_network_uid=dict(type='str'), - spoof_tracking=dict(type='str', choices=['none', 'log', 'alert']) - )), - multicast_address=dict(type='str'), - multicast_address_type=dict(type='str', choices=['manual', 'default']), - security_zone=dict(type='bool'), - security_zone_settings=dict(type='dict', options=dict( - auto_calculated=dict(type='bool'), - specific_zone=dict(type='str') - )), - tags=dict(type='list', elements='str'), - topology=dict(type='str', choices=['automatic', 'external', 'internal']), - topology_settings=dict(type='dict', options=dict( - interface_leads_to_dmz=dict(type='bool'), - ip_address_behind_this_interface=dict(type='str', choices=['not defined', 'network defined by the interface ip and net mask', - 'network defined by routing', 'specific']), - specific_network=dict(type='str') - )), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', - 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', - 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', - 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', - 'sienna', 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') - )), - ips=dict(type='bool'), - members=dict(type='list', elements='dict', options=dict( - name=dict(type='str'), - interfaces=dict(type='list', elements='dict', options=dict( - name=dict(type='str'), - anti_spoofing=dict(type='bool'), - anti_spoofing_settings=dict(type='dict', options=dict( - action=dict(type='str', choices=['prevent', 'detect']), - exclude_packets=dict(type='bool'), - excluded_network_name=dict(type='str'), - excluded_network_uid=dict(type='str'), - spoof_tracking=dict(type='str', choices=['none', 'log', 'alert']) - )), - ip_address=dict(type='str'), - ipv4_address=dict(type='str'), - ipv6_address=dict(type='str'), - network_mask=dict(type='str'), - ipv4_network_mask=dict(type='str'), - ipv6_network_mask=dict(type='str'), - mask_length=dict(type='str'), - ipv4_mask_length=dict(type='str'), - ipv6_mask_length=dict(type='str'), - security_zone=dict(type='bool'), - security_zone_settings=dict(type='dict', options=dict( - auto_calculated=dict(type='bool'), - specific_zone=dict(type='str') - )), - tags=dict(type='list', elements='str'), - topology=dict(type='str', choices=['automatic', 'external', 'internal']), - topology_settings=dict(type='dict', options=dict( - interface_leads_to_dmz=dict(type='bool'), - ip_address_behind_this_interface=dict(type='str', choices=['not defined', 'network defined by the interface ip and net mask', - 'network defined by routing', 'specific']), - specific_network=dict(type='str') - )), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', - 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', - 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', - 'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', - 'orange', 'red', 'sienna', 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') - )), - ip_address=dict(type='str'), - ipv4_address=dict(type='str'), - ipv6_address=dict(type='str'), - one_time_password=dict(type='str', no_log=True), - tags=dict(type='list', elements='str'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', - 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', - 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', - 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', - 'sienna', 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') - )), - os_name=dict(type='str'), - platform_portal_settings=dict(type='dict', options=dict( - portal_web_settings=dict(type='dict', options=dict( - aliases=dict(type='list', elements='str'), - ip_address=dict(type='str'), - main_url=dict(type='str') - )), - certificate_settings=dict(type='dict', options=dict( - base64_certificate=dict(type='str'), - base64_password=dict(type='str', no_log=True) - )), - accessibility=dict(type='dict', options=dict( - allow_access_from=dict(type='str', choices=['rule_base', 'internal_interfaces', 'all_interfaces']), - internal_access_settings=dict(type='dict', options=dict( - undefined=dict(type='bool'), - dmz=dict(type='bool'), - vpn=dict(type='bool') - )) - )) - )), - send_alerts_to_server=dict(type='list', elements='str'), - send_logs_to_backup_server=dict(type='list', elements='str'), - send_logs_to_server=dict(type='list', elements='str'), - tags=dict(type='list', elements='str'), - threat_emulation=dict(type='bool'), - threat_extraction=dict(type='bool'), - threat_prevention_mode=dict(type='str', choices=['autonomous', 'custom']), - url_filtering=dict(type='bool'), - usercheck_portal_settings=dict(type='dict', options=dict( - enabled=dict(type='bool'), - portal_web_settings=dict(type='dict', options=dict( - aliases=dict(type='list', elements='str'), - ip_address=dict(type='str'), - main_url=dict(type='str') - )), - certificate_settings=dict(type='dict', options=dict( - base64_certificate=dict(type='str'), - base64_password=dict(type='str', no_log=True) - )), - accessibility=dict(type='dict', options=dict( - allow_access_from=dict(type='str', choices=['rule_base', 'internal_interfaces', 'all_interfaces']), - internal_access_settings=dict(type='dict', options=dict( - undefined=dict(type='bool'), - dmz=dict(type='bool'), - vpn=dict(type='bool') - )) - )) - )), - cluster_version=dict(type='str'), - vpn=dict(type='bool'), - vpn_settings=dict(type='dict', options=dict( - authentication=dict(type='dict', options=dict( - authentication_clients=dict(type='list', elements='str') - )), - link_selection=dict(type='dict', options=dict( - ip_selection=dict(type='str', choices=['use-main-address', - 'use-selected-address-from-topology', 'use-statically-nated-ip', 'calculated-ip-based-on-topology', - 'dns-resolving-from-hostname', 'dns-resolving-from-gateway-and-domain-name', - 'use-probing-with-high-availability', 'use-probing-with-load-sharing', 'use-one-time-probing']), - dns_resolving_hostname=dict(type='str'), - ip_address=dict(type='str') - )), - maximum_concurrent_ike_negotiations=dict(type='int'), - maximum_concurrent_tunnels=dict(type='int'), - office_mode=dict(type='dict', options=dict( - mode=dict(type='str', choices=['off', 'specific-group', 'all-users']), - group=dict(type='str'), - allocate_ip_address_from=dict(type='dict', options=dict( - radius_server=dict(type='bool'), - use_allocate_method=dict(type='bool'), - allocate_method=dict(type='str', choices=['manual', 'automatic']), - manual_network=dict(type='str'), - dhcp_server=dict(type='str'), - virtual_ip_address=dict(type='str'), - dhcp_mac_address=dict(type='str', choices=['per-machine', 'per-user']), - optional_parameters=dict(type='dict', options=dict( - use_primary_dns_server=dict(type='bool'), - primary_dns_server=dict(type='str'), - use_first_backup_dns_server=dict(type='bool'), - first_backup_dns_server=dict(type='str'), - use_second_backup_dns_server=dict(type='bool'), - second_backup_dns_server=dict(type='str'), - dns_suffixes=dict(type='str'), - use_primary_wins_server=dict(type='bool'), - primary_wins_server=dict(type='str'), - use_first_backup_wins_server=dict(type='bool'), - first_backup_wins_server=dict(type='str'), - use_second_backup_wins_server=dict(type='bool'), - second_backup_wins_server=dict(type='str'), - ip_lease_duration=dict(type='int') - )) - )), - support_multiple_interfaces=dict(type='bool'), - perform_anti_spoofing=dict(type='bool'), - anti_spoofing_additional_addresses=dict(type='str') - )), - remote_access=dict(type='dict', options=dict( - support_l2tp=dict(type='bool'), - l2tp_auth_method=dict(type='str', choices=['certificate', 'md5']), - l2tp_certificate=dict(type='str'), - allow_vpn_clients_to_route_traffic=dict(type='bool'), - support_nat_traversal_mechanism=dict(type='bool'), - nat_traversal_service=dict(type='str'), - support_visitor_mode=dict(type='bool'), - visitor_mode_service=dict(type='str'), - visitor_mode_interface=dict(type='str') - )), - vpn_domain=dict(type='str'), - vpn_domain_type=dict(type='str', choices=['manual', 'addresses_behind_gw']) - )), - show_portals_certificate=dict(type='bool'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - groups=dict(type='list', elements='str'), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + ip_address=dict(type="str"), + ipv4_address=dict(type="str"), + ipv6_address=dict(type="str"), + anti_bot=dict(type="bool"), + anti_virus=dict(type="bool"), + application_control=dict(type="bool"), + cluster_mode=dict( + type="str", + choices=[ + "cluster-xl-ha", + "cluster-ls-multicast", + "cluster-ls-unicast", + "opsec-ha", + "opsec-ls", + ], + ), + content_awareness=dict(type="bool"), + firewall=dict(type="bool"), + firewall_settings=dict( + type="dict", + options=dict( + auto_calculate_connections_hash_table_size_and_memory_pool=dict( + type="bool" + ), + auto_maximum_limit_for_concurrent_connections=dict( + type="bool" + ), + connections_hash_size=dict(type="int"), + maximum_limit_for_concurrent_connections=dict(type="int"), + maximum_memory_pool_size=dict(type="int"), + memory_pool_size=dict(type="int"), + ), + ), + hardware=dict(type="str"), + interfaces=dict( + type="list", + elements="dict", + options=dict( + name=dict(type="str"), + interface_type=dict( + type="str", + choices=["cluster", "sync", "cluster + sync", "private"], + ), + ip_address=dict(type="str"), + ipv4_address=dict(type="str"), + ipv6_address=dict(type="str"), + network_mask=dict(type="str"), + ipv4_network_mask=dict(type="str"), + ipv6_network_mask=dict(type="str"), + mask_length=dict(type="str"), + ipv4_mask_length=dict(type="str"), + ipv6_mask_length=dict(type="str"), + anti_spoofing=dict(type="bool"), + anti_spoofing_settings=dict( + type="dict", + options=dict( + action=dict(type="str", choices=["prevent", "detect"]), + exclude_packets=dict(type="bool"), + excluded_network_name=dict(type="str"), + excluded_network_uid=dict(type="str"), + spoof_tracking=dict( + type="str", choices=["none", "log", "alert"] + ), + ), + ), + multicast_address=dict(type="str"), + multicast_address_type=dict( + type="str", choices=["manual", "default"] + ), + security_zone=dict(type="bool"), + security_zone_settings=dict( + type="dict", + options=dict( + auto_calculated=dict(type="bool"), + specific_zone=dict(type="str"), + ), + ), + tags=dict(type="list", elements="str"), + topology=dict( + type="str", choices=["automatic", "external", "internal"] + ), + topology_settings=dict( + type="dict", + options=dict( + interface_leads_to_dmz=dict(type="bool"), + ip_address_behind_this_interface=dict( + type="str", + choices=[ + "not defined", + "network defined by the interface ip and net mask", + "network defined by routing", + "specific", + ], + ), + specific_network=dict(type="str"), + ), + ), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict( + type="str", choices=["uid", "standard", "full"] + ), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), + ), + ), + ips=dict(type="bool"), + members=dict( + type="list", + elements="dict", + options=dict( + name=dict(type="str"), + interfaces=dict( + type="list", + elements="dict", + options=dict( + name=dict(type="str"), + anti_spoofing=dict(type="bool"), + anti_spoofing_settings=dict( + type="dict", + options=dict( + action=dict( + type="str", choices=["prevent", "detect"] + ), + exclude_packets=dict(type="bool"), + excluded_network_name=dict(type="str"), + excluded_network_uid=dict(type="str"), + spoof_tracking=dict( + type="str", + choices=["none", "log", "alert"], + ), + ), + ), + ip_address=dict(type="str"), + ipv4_address=dict(type="str"), + ipv6_address=dict(type="str"), + network_mask=dict(type="str"), + ipv4_network_mask=dict(type="str"), + ipv6_network_mask=dict(type="str"), + mask_length=dict(type="str"), + ipv4_mask_length=dict(type="str"), + ipv6_mask_length=dict(type="str"), + security_zone=dict(type="bool"), + security_zone_settings=dict( + type="dict", + options=dict( + auto_calculated=dict(type="bool"), + specific_zone=dict(type="str"), + ), + ), + tags=dict(type="list", elements="str"), + topology=dict( + type="str", + choices=["automatic", "external", "internal"], + ), + topology_settings=dict( + type="dict", + options=dict( + interface_leads_to_dmz=dict(type="bool"), + ip_address_behind_this_interface=dict( + type="str", + choices=[ + "not defined", + "network defined by the interface ip and net mask", + "network defined by routing", + "specific", + ], + ), + specific_network=dict(type="str"), + ), + ), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict( + type="str", choices=["uid", "standard", "full"] + ), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), + ), + ), + ip_address=dict(type="str"), + ipv4_address=dict(type="str"), + ipv6_address=dict(type="str"), + one_time_password=dict(type="str", no_log=True), + tags=dict(type="list", elements="str"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict( + type="str", choices=["uid", "standard", "full"] + ), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), + ), + ), + os_name=dict(type="str"), + platform_portal_settings=dict( + type="dict", + options=dict( + portal_web_settings=dict( + type="dict", + options=dict( + aliases=dict(type="list", elements="str"), + ip_address=dict(type="str"), + main_url=dict(type="str"), + ), + ), + certificate_settings=dict( + type="dict", + options=dict( + base64_certificate=dict(type="str"), + base64_password=dict(type="str", no_log=True), + ), + ), + accessibility=dict( + type="dict", + options=dict( + allow_access_from=dict( + type="str", + choices=[ + "rule_base", + "internal_interfaces", + "all_interfaces", + ], + ), + internal_access_settings=dict( + type="dict", + options=dict( + undefined=dict(type="bool"), + dmz=dict(type="bool"), + vpn=dict(type="bool"), + ), + ), + ), + ), + ), + ), + send_alerts_to_server=dict(type="list", elements="str"), + send_logs_to_backup_server=dict(type="list", elements="str"), + send_logs_to_server=dict(type="list", elements="str"), + tags=dict(type="list", elements="str"), + threat_emulation=dict(type="bool"), + threat_extraction=dict(type="bool"), + threat_prevention_mode=dict( + type="str", choices=["autonomous", "custom"] + ), + url_filtering=dict(type="bool"), + usercheck_portal_settings=dict( + type="dict", + options=dict( + enabled=dict(type="bool"), + portal_web_settings=dict( + type="dict", + options=dict( + aliases=dict(type="list", elements="str"), + ip_address=dict(type="str"), + main_url=dict(type="str"), + ), + ), + certificate_settings=dict( + type="dict", + options=dict( + base64_certificate=dict(type="str"), + base64_password=dict(type="str", no_log=True), + ), + ), + accessibility=dict( + type="dict", + options=dict( + allow_access_from=dict( + type="str", + choices=[ + "rule_base", + "internal_interfaces", + "all_interfaces", + ], + ), + internal_access_settings=dict( + type="dict", + options=dict( + undefined=dict(type="bool"), + dmz=dict(type="bool"), + vpn=dict(type="bool"), + ), + ), + ), + ), + ), + ), + cluster_version=dict(type="str"), + vpn=dict(type="bool"), + vpn_settings=dict( + type="dict", + options=dict( + authentication=dict( + type="dict", + options=dict( + authentication_clients=dict( + type="list", elements="str" + ) + ), + ), + link_selection=dict( + type="dict", + options=dict( + ip_selection=dict( + type="str", + choices=[ + "use-main-address", + "use-selected-address-from-topology", + "use-statically-nated-ip", + "calculated-ip-based-on-topology", + "dns-resolving-from-hostname", + "dns-resolving-from-gateway-and-domain-name", + "use-probing-with-high-availability", + "use-probing-with-load-sharing", + "use-one-time-probing", + ], + ), + dns_resolving_hostname=dict(type="str"), + ip_address=dict(type="str"), + ), + ), + maximum_concurrent_ike_negotiations=dict(type="int"), + maximum_concurrent_tunnels=dict(type="int"), + office_mode=dict( + type="dict", + options=dict( + mode=dict( + type="str", + choices=["off", "specific-group", "all-users"], + ), + group=dict(type="str"), + allocate_ip_address_from=dict( + type="dict", + options=dict( + radius_server=dict(type="bool"), + use_allocate_method=dict(type="bool"), + allocate_method=dict( + type="str", choices=["manual", "automatic"] + ), + manual_network=dict(type="str"), + dhcp_server=dict(type="str"), + virtual_ip_address=dict(type="str"), + dhcp_mac_address=dict( + type="str", + choices=["per-machine", "per-user"], + ), + optional_parameters=dict( + type="dict", + options=dict( + use_primary_dns_server=dict( + type="bool" + ), + primary_dns_server=dict(type="str"), + use_first_backup_dns_server=dict( + type="bool" + ), + first_backup_dns_server=dict( + type="str" + ), + use_second_backup_dns_server=dict( + type="bool" + ), + second_backup_dns_server=dict( + type="str" + ), + dns_suffixes=dict(type="str"), + use_primary_wins_server=dict( + type="bool" + ), + primary_wins_server=dict(type="str"), + use_first_backup_wins_server=dict( + type="bool" + ), + first_backup_wins_server=dict( + type="str" + ), + use_second_backup_wins_server=dict( + type="bool" + ), + second_backup_wins_server=dict( + type="str" + ), + ip_lease_duration=dict(type="int"), + ), + ), + ), + ), + support_multiple_interfaces=dict(type="bool"), + perform_anti_spoofing=dict(type="bool"), + anti_spoofing_additional_addresses=dict(type="str"), + ), + ), + remote_access=dict( + type="dict", + options=dict( + support_l2tp=dict(type="bool"), + l2tp_auth_method=dict( + type="str", choices=["certificate", "md5"] + ), + l2tp_certificate=dict(type="str"), + allow_vpn_clients_to_route_traffic=dict(type="bool"), + support_nat_traversal_mechanism=dict(type="bool"), + nat_traversal_service=dict(type="str"), + support_visitor_mode=dict(type="bool"), + visitor_mode_service=dict(type="str"), + visitor_mode_interface=dict(type="str"), + ), + ), + vpn_domain=dict(type="str"), + vpn_domain_type=dict( + type="str", choices=["manual", "addresses_behind_gw"] + ), + ), + ), + show_portals_certificate=dict(type="bool"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + groups=dict(type="list", elements="str"), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'simple-cluster' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "simple-cluster" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_simple_cluster_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_simple_cluster_facts.py index c422eabf1..23cf270a4 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_simple_cluster_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_simple_cluster_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -122,35 +124,46 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - limit_interfaces=dict(type='int'), - show_portals_certificate=dict(type='bool'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - filter=dict(type='str'), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - show_membership=dict(type='bool'), - domains_to_process=dict(type='list', elements='str') + name=dict(type="str"), + limit_interfaces=dict(type="int"), + show_portals_certificate=dict(type="bool"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + filter=dict(type="str"), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + show_membership=dict(type="bool"), + domains_to_process=dict(type="list", elements="str"), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "simple-cluster" api_call_object_plural_version = "simple-clusters" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_simple_gateway.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_simple_gateway.py index ce530d3f3..bd276c179 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_simple_gateway.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_simple_gateway.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -497,141 +499,272 @@ cp_mgmt_simple_gateway: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - ip_address=dict(type='str'), - ipv4_address=dict(type='str'), - ipv6_address=dict(type='str'), - anti_bot=dict(type='bool'), - anti_virus=dict(type='bool'), - application_control=dict(type='bool'), - content_awareness=dict(type='bool'), - firewall=dict(type='bool'), - firewall_settings=dict(type='dict', options=dict( - auto_calculate_connections_hash_table_size_and_memory_pool=dict(type='bool'), - auto_maximum_limit_for_concurrent_connections=dict(type='bool'), - connections_hash_size=dict(type='int'), - maximum_limit_for_concurrent_connections=dict(type='int'), - maximum_memory_pool_size=dict(type='int'), - memory_pool_size=dict(type='int') - )), - interfaces=dict(type='list', elements='dict', options=dict( - name=dict(type='str'), - anti_spoofing=dict(type='bool'), - anti_spoofing_settings=dict(type='dict', options=dict( - action=dict(type='str', choices=['prevent', 'detect']) - )), - ip_address=dict(type='str'), - ipv4_address=dict(type='str'), - ipv6_address=dict(type='str'), - network_mask=dict(type='str'), - ipv4_network_mask=dict(type='str'), - ipv6_network_mask=dict(type='str'), - mask_length=dict(type='str'), - ipv4_mask_length=dict(type='str'), - ipv6_mask_length=dict(type='str'), - security_zone=dict(type='bool'), - security_zone_settings=dict(type='dict', options=dict( - auto_calculated=dict(type='bool'), - specific_zone=dict(type='str') - )), - tags=dict(type='list', elements='str'), - topology=dict(type='str', choices=['automatic', 'external', 'internal']), - topology_settings=dict(type='dict', options=dict( - interface_leads_to_dmz=dict(type='bool'), - ip_address_behind_this_interface=dict(type='str', choices=['not defined', 'network defined by the interface ip and net mask', - 'network defined by routing', 'specific']), - specific_network=dict(type='str') - )), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', - 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', - 'firebrick', - 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', - 'coral', - 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', - 'red', - 'sienna', 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') - )), - ips=dict(type='bool'), - logs_settings=dict(type='dict', options=dict( - alert_when_free_disk_space_below=dict(type='bool'), - alert_when_free_disk_space_below_threshold=dict(type='int'), - alert_when_free_disk_space_below_type=dict(type='str', choices=['none', - 'log', 'popup alert', 'mail alert', 'snmp trap alert', - 'user defined alert no.1', - 'user defined alert no.2', 'user defined alert no.3']), - before_delete_keep_logs_from_the_last_days=dict(type='bool'), - before_delete_keep_logs_from_the_last_days_threshold=dict(type='int'), - before_delete_run_script=dict(type='bool'), - before_delete_run_script_command=dict(type='str'), - delete_index_files_older_than_days=dict(type='bool'), - delete_index_files_older_than_days_threshold=dict(type='int'), - delete_index_files_when_index_size_above=dict(type='bool'), - delete_index_files_when_index_size_above_threshold=dict(type='int'), - delete_when_free_disk_space_below=dict(type='bool'), - delete_when_free_disk_space_below_threshold=dict(type='int'), - detect_new_citrix_ica_application_names=dict(type='bool'), - forward_logs_to_log_server=dict(type='bool'), - forward_logs_to_log_server_name=dict(type='str'), - forward_logs_to_log_server_schedule_name=dict(type='str'), - free_disk_space_metrics=dict(type='str', choices=['mbytes', 'percent']), - perform_log_rotate_before_log_forwarding=dict(type='bool'), - reject_connections_when_free_disk_space_below_threshold=dict(type='bool'), - reserve_for_packet_capture_metrics=dict(type='str', choices=['percent', 'mbytes']), - reserve_for_packet_capture_threshold=dict(type='int'), - rotate_log_by_file_size=dict(type='bool'), - rotate_log_file_size_threshold=dict(type='int'), - rotate_log_on_schedule=dict(type='bool'), - rotate_log_schedule_name=dict(type='str'), - stop_logging_when_free_disk_space_below=dict(type='bool'), - stop_logging_when_free_disk_space_below_threshold=dict(type='int'), - turn_on_qos_logging=dict(type='bool'), - update_account_log_every=dict(type='int') - )), - one_time_password=dict(type='str', no_log=True), - os_name=dict(type='str'), - save_logs_locally=dict(type='bool'), - send_alerts_to_server=dict(type='list', elements='str'), - send_logs_to_backup_server=dict(type='list', elements='str'), - send_logs_to_server=dict(type='list', elements='str'), - tags=dict(type='list', elements='str'), - threat_emulation=dict(type='bool'), - threat_extraction=dict(type='bool'), - url_filtering=dict(type='bool'), - gateway_version=dict(type='str'), - vpn=dict(type='bool'), - vpn_settings=dict(type='dict', options=dict( - maximum_concurrent_ike_negotiations=dict(type='int'), - maximum_concurrent_tunnels=dict(type='int') - )), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', - 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - groups=dict(type='list', elements='str'), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + ip_address=dict(type="str"), + ipv4_address=dict(type="str"), + ipv6_address=dict(type="str"), + anti_bot=dict(type="bool"), + anti_virus=dict(type="bool"), + application_control=dict(type="bool"), + content_awareness=dict(type="bool"), + firewall=dict(type="bool"), + firewall_settings=dict( + type="dict", + options=dict( + auto_calculate_connections_hash_table_size_and_memory_pool=dict( + type="bool" + ), + auto_maximum_limit_for_concurrent_connections=dict( + type="bool" + ), + connections_hash_size=dict(type="int"), + maximum_limit_for_concurrent_connections=dict(type="int"), + maximum_memory_pool_size=dict(type="int"), + memory_pool_size=dict(type="int"), + ), + ), + interfaces=dict( + type="list", + elements="dict", + options=dict( + name=dict(type="str"), + anti_spoofing=dict(type="bool"), + anti_spoofing_settings=dict( + type="dict", + options=dict( + action=dict(type="str", choices=["prevent", "detect"]) + ), + ), + ip_address=dict(type="str"), + ipv4_address=dict(type="str"), + ipv6_address=dict(type="str"), + network_mask=dict(type="str"), + ipv4_network_mask=dict(type="str"), + ipv6_network_mask=dict(type="str"), + mask_length=dict(type="str"), + ipv4_mask_length=dict(type="str"), + ipv6_mask_length=dict(type="str"), + security_zone=dict(type="bool"), + security_zone_settings=dict( + type="dict", + options=dict( + auto_calculated=dict(type="bool"), + specific_zone=dict(type="str"), + ), + ), + tags=dict(type="list", elements="str"), + topology=dict( + type="str", choices=["automatic", "external", "internal"] + ), + topology_settings=dict( + type="dict", + options=dict( + interface_leads_to_dmz=dict(type="bool"), + ip_address_behind_this_interface=dict( + type="str", + choices=[ + "not defined", + "network defined by the interface ip and net mask", + "network defined by routing", + "specific", + ], + ), + specific_network=dict(type="str"), + ), + ), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict( + type="str", choices=["uid", "standard", "full"] + ), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), + ), + ), + ips=dict(type="bool"), + logs_settings=dict( + type="dict", + options=dict( + alert_when_free_disk_space_below=dict(type="bool"), + alert_when_free_disk_space_below_threshold=dict(type="int"), + alert_when_free_disk_space_below_type=dict( + type="str", + choices=[ + "none", + "log", + "popup alert", + "mail alert", + "snmp trap alert", + "user defined alert no.1", + "user defined alert no.2", + "user defined alert no.3", + ], + ), + before_delete_keep_logs_from_the_last_days=dict(type="bool"), + before_delete_keep_logs_from_the_last_days_threshold=dict( + type="int" + ), + before_delete_run_script=dict(type="bool"), + before_delete_run_script_command=dict(type="str"), + delete_index_files_older_than_days=dict(type="bool"), + delete_index_files_older_than_days_threshold=dict(type="int"), + delete_index_files_when_index_size_above=dict(type="bool"), + delete_index_files_when_index_size_above_threshold=dict( + type="int" + ), + delete_when_free_disk_space_below=dict(type="bool"), + delete_when_free_disk_space_below_threshold=dict(type="int"), + detect_new_citrix_ica_application_names=dict(type="bool"), + forward_logs_to_log_server=dict(type="bool"), + forward_logs_to_log_server_name=dict(type="str"), + forward_logs_to_log_server_schedule_name=dict(type="str"), + free_disk_space_metrics=dict( + type="str", choices=["mbytes", "percent"] + ), + perform_log_rotate_before_log_forwarding=dict(type="bool"), + reject_connections_when_free_disk_space_below_threshold=dict( + type="bool" + ), + reserve_for_packet_capture_metrics=dict( + type="str", choices=["percent", "mbytes"] + ), + reserve_for_packet_capture_threshold=dict(type="int"), + rotate_log_by_file_size=dict(type="bool"), + rotate_log_file_size_threshold=dict(type="int"), + rotate_log_on_schedule=dict(type="bool"), + rotate_log_schedule_name=dict(type="str"), + stop_logging_when_free_disk_space_below=dict(type="bool"), + stop_logging_when_free_disk_space_below_threshold=dict( + type="int" + ), + turn_on_qos_logging=dict(type="bool"), + update_account_log_every=dict(type="int"), + ), + ), + one_time_password=dict(type="str", no_log=True), + os_name=dict(type="str"), + save_logs_locally=dict(type="bool"), + send_alerts_to_server=dict(type="list", elements="str"), + send_logs_to_backup_server=dict(type="list", elements="str"), + send_logs_to_server=dict(type="list", elements="str"), + tags=dict(type="list", elements="str"), + threat_emulation=dict(type="bool"), + threat_extraction=dict(type="bool"), + url_filtering=dict(type="bool"), + gateway_version=dict(type="str"), + vpn=dict(type="bool"), + vpn_settings=dict( + type="dict", + options=dict( + maximum_concurrent_ike_negotiations=dict(type="int"), + maximum_concurrent_tunnels=dict(type="int"), + ), + ), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + groups=dict(type="list", elements="str"), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'simple-gateway' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "simple-gateway" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_simple_gateway_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_simple_gateway_facts.py index cdccabb18..6df2d31c4 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_simple_gateway_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_simple_gateway_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -102,31 +104,42 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - show_membership=dict(type='bool') + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + show_membership=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "simple-gateway" api_call_object_plural_version = "simple-gateways" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_smart_task.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_smart_task.py new file mode 100644 index 000000000..c491bf72c --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_smart_task.py @@ -0,0 +1,295 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_smart_task +short_description: Manages smart-task objects on Checkpoint over Web Services API +description: + - Manages smart-task objects on Checkpoint devices including creating, updating and removing objects. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + name: + description: + - Object name. + type: str + required: True + action: + description: + - The action to be run when the trigger is fired. + type: dict + suboptions: + send_web_request: + description: + - When the trigger is fired, sends an HTTPS POST web request to the configured URL.<br>The trigger data will be passed along with the + SmartTask's custom data in the request's payload. + type: dict + suboptions: + url: + description: + - URL used for the web request. + type: str + fingerprint: + description: + - The SHA1 fingerprint of the URL's SSL certificate. Used to trust servers with self-signed SSL certificates. + type: str + override_proxy: + description: + - Option to send to the web request via a proxy other than the Management's Server proxy (if defined). + type: bool + proxy_url: + description: + - URL of the proxy used to send the request. + type: str + shared_secret: + description: + - Shared secret that can be used by the target server to identify the Management Server.<br>The value will be sent as part of + the request in the "X-chkp-shared-secret" header. + type: str + time_out: + description: + - Web Request time-out in seconds. + type: int + run_script: + description: + - When the trigger is fired, runs the configured Repository Script on the defined targets.<br>The trigger data is then passed to the + script as the first parameter. The parameter is JSON encoded in Base64 format. + type: dict + suboptions: + repository_script: + description: + - Repository script that is executed when the trigger is fired., identified by the name or UID. + type: str + targets: + description: + - Targets to execute the script on. + type: list + elements: str + time_out: + description: + - Script execution time-out in seconds. + type: int + send_mail: + description: + - When the trigger is fired, sends the configured email to the defined recipients. + type: dict + suboptions: + mail_settings: + description: + - The required settings to send the mail by. + type: dict + suboptions: + recipients: + description: + - A comma separated list of recipient mail addresses. + type: str + sender_email: + description: + - An email address to send the mail from. + type: str + subject: + description: + - The email subject. + type: str + body: + description: + - The email body. + type: str + attachment: + description: + - What file should be attached to the mail. + type: str + choices: ['no attachment', 'changes report', 'policy installation report'] + bcc_recipients: + description: + - A comma separated list of bcc recipient mail addresses. + type: str + cc_recipients: + description: + - A comma separated list of cc recipient mail addresses. + type: str + smtp_server: + description: + - The UID or the name a preconfigured SMTP server object. + type: str + trigger: + description: + - Trigger type associated with the SmartTask. + type: str + custom_data: + description: + - Per SmartTask custom data in JSON format.<br>When the trigger is fired, the trigger data is converted to JSON. The custom data is then + concatenated to the trigger data JSON. + type: str + description: + description: + - Description of the SmartTask's functionality and options. + type: str + enabled: + description: + - Whether the SmartTask is enabled and will run when triggered. + type: bool + fail_open: + description: + - If the action fails to execute, whether to treat the execution failure as an error, or continue. + type: bool + tags: + description: + - Collection of tag identifiers. + type: list + elements: str + color: + description: + - Color of the object. Should be one of existing colors. + type: str + choices: ['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green', + 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', + 'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', 'yellow'] + comments: + description: + - Comments string. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + ignore_warnings: + description: + - Apply changes ignoring warnings. + type: bool + ignore_errors: + description: + - Apply changes ignoring errors. You won't be able to publish such a changes. If ignore-warnings flag was omitted - warnings will also be ignored. + type: bool +extends_documentation_fragment: check_point.mgmt.checkpoint_objects +""" + +EXAMPLES = """ +- name: add-smart-task + cp_mgmt_smart_task: + action: + run_script: + repository_script: Session Name Validation Script + time_out: 30 + custom_data: '{"session-name-format": "CR"}' + description: Run a validation script that ensures that the a session name matches the expected name format as described in the Custom Data field. + enabled: true + name: Validate Session Name Before Publish + state: present + trigger: Before Publish + +- name: set-smart-task + cp_mgmt_smart_task: + action: + send_web_request: + fingerprint: 3FDD902286DBF130EF4CEC7939EF81060AB0FEB6 + url: https://demo.example.com/policy-installation-reports + custom_data: '{"mail-address": "example-admin@example-corp.com"}' + description: Send policy installation results to the mail address specified in the Custom Data field using the corporate's dedicated web server. + enabled: true + name: Send Policy Installation Reports + state: present + trigger: After Install Policy + +- name: delete-smart-task + cp_mgmt_smart_task: + name: Validate Session Name Before Publish + state: absent +""" + +RETURN = """ +cp_mgmt_smart_task: + description: The checkpoint object created or updated. + returned: always, except when deleting the object. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call + + +def main(): + argument_spec = dict( + name=dict(type='str', required=True), + action=dict(type='dict', options=dict( + send_web_request=dict(type='dict', options=dict( + url=dict(type='str'), + fingerprint=dict(type='str'), + override_proxy=dict(type='bool'), + proxy_url=dict(type='str'), + shared_secret=dict(type='str', no_log=True), + time_out=dict(type='int') + )), + run_script=dict(type='dict', options=dict( + repository_script=dict(type='str'), + targets=dict(type='list', elements='str'), + time_out=dict(type='int') + )), + send_mail=dict(type='dict', options=dict( + mail_settings=dict(type='dict', options=dict( + recipients=dict(type='str'), + sender_email=dict(type='str'), + subject=dict(type='str'), + body=dict(type='str'), + attachment=dict(type='str', choices=['no attachment', 'changes report', 'policy installation report']), + bcc_recipients=dict(type='str'), + cc_recipients=dict(type='str') + )), + smtp_server=dict(type='str') + )) + )), + trigger=dict(type='str'), + custom_data=dict(type='str'), + description=dict(type='str'), + enabled=dict(type='bool'), + fail_open=dict(type='bool'), + tags=dict(type='list', elements='str'), + color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', + 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', + 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', + 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', + 'yellow']), + comments=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + ignore_warnings=dict(type='bool'), + ignore_errors=dict(type='bool') + ) + argument_spec.update(checkpoint_argument_spec_for_objects) + + module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + api_call_object = 'smart-task' + + result = api_call(module, api_call_object) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_smart_task_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_smart_task_facts.py new file mode 100644 index 000000000..ee5abdead --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_smart_task_facts.py @@ -0,0 +1,141 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_smart_task_facts +short_description: Get smart-task objects facts on Checkpoint over Web Services API +description: + - Get smart-task objects facts on Checkpoint devices. + - All operations are performed over Web Services API. + - This module handles both operations, get a specific object and get several objects, + For getting a specific object use the parameter 'name'. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + name: + description: + - Object name. + This parameter is relevant only for getting a specific object. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + filter: + description: + - Search expression to filter objects by. The provided text should be exactly the same as it would be given in SmartConsole Object Explorer. The + logical operators in the expression ('AND', 'OR') should be provided in capital letters. The search involves both a IP search and a textual search in + name, comment, tags etc. + type: str + limit: + description: + - The maximal number of returned results. + This parameter is relevant only for getting few objects. + type: int + offset: + description: + - Number of the results to initially skip. + This parameter is relevant only for getting few objects. + type: int + order: + description: + - Sorts the results by search criteria. Automatically sorts the results by Name, in the ascending order. + This parameter is relevant only for getting few objects. + type: list + elements: dict + suboptions: + ASC: + description: + - Sorts results by the given field in ascending order. + type: str + choices: ['name'] + DESC: + description: + - Sorts results by the given field in descending order. + type: str + choices: ['name'] + domains_to_process: + description: + - Indicates which domains to process the commands on. It cannot be used with the details-level full, must be run from the System Domain only and + with ignore-warnings true. Valid values are, CURRENT_DOMAIN, ALL_DOMAINS_ON_THIS_SERVER. + type: list + elements: str +extends_documentation_fragment: check_point.mgmt.checkpoint_facts +""" + +EXAMPLES = """ +- name: show-smart-task + cp_mgmt_smart_task_facts: + name: Validate Session Name Before Publish + +- name: show-smart-tasks + cp_mgmt_smart_task_facts: + details_level: standard + limit: 50 + offset: 0 +""" + +RETURN = """ +ansible_facts: + description: The checkpoint object facts. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts + + +def main(): + argument_spec = dict( + name=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + filter=dict(type='str'), + limit=dict(type='int'), + offset=dict(type='int'), + order=dict(type='list', elements='dict', options=dict( + ASC=dict(type='str', choices=['name']), + DESC=dict(type='str', choices=['name']) + )), + domains_to_process=dict(type='list', elements='str') + ) + argument_spec.update(checkpoint_argument_spec_for_facts) + + module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + + api_call_object = "smart-task" + api_call_object_plural_version = "smart-tasks" + + result = api_call_facts(module, api_call_object, api_call_object_plural_version) + module.exit_json(ansible_facts=result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_smart_task_trigger_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_smart_task_trigger_facts.py new file mode 100644 index 000000000..cbdc3f747 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_smart_task_trigger_facts.py @@ -0,0 +1,141 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_smart_task_trigger_facts +short_description: Get smart-task-trigger objects facts on Checkpoint over Web Services API +description: + - Get smart-task-trigger objects facts on Checkpoint devices. + - All operations are performed over Web Services API. + - This module handles both operations, get a specific object and get several objects, + For getting a specific object use the parameter 'name'. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + name: + description: + - Object name. + This parameter is relevant only for getting a specific object. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + filter: + description: + - Search expression to filter objects by. The provided text should be exactly the same as it would be given in SmartConsole Object Explorer. The + logical operators in the expression ('AND', 'OR') should be provided in capital letters. The search involves both a IP search and a textual search in + name, comment, tags etc. + type: str + limit: + description: + - The maximal number of returned results. + This parameter is relevant only for getting few objects. + type: int + offset: + description: + - Number of the results to initially skip. + This parameter is relevant only for getting few objects. + type: int + order: + description: + - Sorts the results by search criteria. Automatically sorts the results by Name, in the ascending order. + This parameter is relevant only for getting few objects. + type: list + elements: dict + suboptions: + ASC: + description: + - Sorts results by the given field in ascending order. + type: str + choices: ['name'] + DESC: + description: + - Sorts results by the given field in descending order. + type: str + choices: ['name'] + domains_to_process: + description: + - Indicates which domains to process the commands on. It cannot be used with the details-level full, must be run from the System Domain only and + with ignore-warnings true. Valid values are, CURRENT_DOMAIN, ALL_DOMAINS_ON_THIS_SERVER. + type: list + elements: str +extends_documentation_fragment: check_point.mgmt.checkpoint_facts +""" + +EXAMPLES = """ +- name: show-smart-task-trigger + cp_mgmt_smart_task_trigger_facts: + name: Before Publish + +- name: show-smart-task-triggers + cp_mgmt_smart_task_trigger_facts: + details_level: standard + limit: 50 + offset: 0 +""" + +RETURN = """ +ansible_facts: + description: The checkpoint object facts. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts + + +def main(): + argument_spec = dict( + name=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + filter=dict(type='str'), + limit=dict(type='int'), + offset=dict(type='int'), + order=dict(type='list', elements='dict', options=dict( + ASC=dict(type='str', choices=['name']), + DESC=dict(type='str', choices=['name']) + )), + domains_to_process=dict(type='list', elements='str') + ) + argument_spec.update(checkpoint_argument_spec_for_facts) + + module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + + api_call_object = "smart-task-trigger" + api_call_object_plural_version = "smart-task-triggers" + + result = api_call_facts(module, api_call_object, api_call_object_plural_version) + module.exit_json(ansible_facts=result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_smtp_server.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_smtp_server.py index 7feb0b7e1..9eff3c612 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_smtp_server.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_smtp_server.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -134,38 +136,79 @@ cp_mgmt_smtp_server: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - port=dict(type='int'), - server=dict(type='str'), - password=dict(type='str', no_log=True), - username=dict(type='str'), - authentication=dict(type='bool'), - encryption=dict(type='str', choices=['none', 'ssl', 'tls']), - tags=dict(type='list', elements='str'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - domains_to_process=dict(type='list', elements='str'), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + port=dict(type="int"), + server=dict(type="str"), + password=dict(type="str", no_log=True), + username=dict(type="str"), + authentication=dict(type="bool"), + encryption=dict(type="str", choices=["none", "ssl", "tls"]), + tags=dict(type="list", elements="str"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + domains_to_process=dict(type="list", elements="str"), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'smtp-server' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "smtp-server" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_smtp_server_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_smtp_server_facts.py index b574885fd..151902f5f 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_smtp_server_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_smtp_server_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -110,32 +112,43 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - filter=dict(type='str'), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - domains_to_process=dict(type='list', elements='str') + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + filter=dict(type="str"), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + domains_to_process=dict(type="list", elements="str"), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "smtp-server" api_call_object_plural_version = "smtp-servers" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_submit_session.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_submit_session.py index 0dfdd0f5e..18abdc243 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_submit_session.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_submit_session.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -56,13 +58,14 @@ cp_mgmt_submit_session: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): - argument_spec = dict( - uid=dict(type='str') - ) + argument_spec = dict(uid=dict(type="str")) argument_spec.update(checkpoint_argument_spec_for_commands) module = AnsibleModule(argument_spec=argument_spec) @@ -73,5 +76,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_tacacs_group.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_tacacs_group.py new file mode 100644 index 000000000..989502da5 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_tacacs_group.py @@ -0,0 +1,146 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_tacacs_group +short_description: Manages tacacs-group objects on Checkpoint over Web Services API +description: + - Manages tacacs-group objects on Checkpoint devices including creating, updating and removing objects. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + name: + description: + - Object name. + type: str + required: True + members: + description: + - Collection of tacacs servers identified by the name or UID. + type: list + elements: str + tags: + description: + - Collection of tag identifiers. + type: list + elements: str + color: + description: + - Color of the object. Should be one of existing colors. + type: str + choices: ['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green', + 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', + 'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', 'yellow'] + comments: + description: + - Comments string. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + groups: + description: + - Collection of group identifiers. + type: list + elements: str + ignore_warnings: + description: + - Apply changes ignoring warnings. + type: bool + ignore_errors: + description: + - Apply changes ignoring errors. You won't be able to publish such a changes. If ignore-warnings flag was omitted - warnings will also be ignored. + type: bool +extends_documentation_fragment: check_point.mgmt.checkpoint_objects +""" + +EXAMPLES = """ +- name: add-tacacs-group + cp_mgmt_tacacs_group: + members: + - t1 + - t3 + - group1 + name: group2 + state: present + +- name: set-tacacs-group + cp_mgmt_tacacs_group: + members: + - tacacs4 + name: group1 + state: present + +- name: delete-tacacs-group + cp_mgmt_tacacs_group: + name: tacacs group + state: absent +""" + +RETURN = """ +cp_mgmt_tacacs_group: + description: The checkpoint object created or updated. + returned: always, except when deleting the object. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call + + +def main(): + argument_spec = dict( + name=dict(type='str', required=True), + members=dict(type='list', elements='str'), + tags=dict(type='list', elements='str'), + color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', + 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', + 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', + 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', + 'yellow']), + comments=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + groups=dict(type='list', elements='str'), + ignore_warnings=dict(type='bool'), + ignore_errors=dict(type='bool') + ) + argument_spec.update(checkpoint_argument_spec_for_objects) + + module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + api_call_object = 'tacacs-group' + + result = api_call(module, api_call_object) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_tacacs_group_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_tacacs_group_facts.py new file mode 100644 index 000000000..00f8302ce --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_tacacs_group_facts.py @@ -0,0 +1,141 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_tacacs_group_facts +short_description: Get tacacs-group objects facts on Checkpoint over Web Services API +description: + - Get tacacs-group objects facts on Checkpoint devices. + - All operations are performed over Web Services API. + - This module handles both operations, get a specific object and get several objects, + For getting a specific object use the parameter 'name'. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + name: + description: + - Object name. + This parameter is relevant only for getting a specific object. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + filter: + description: + - Search expression to filter objects by. The provided text should be exactly the same as it would be given in SmartConsole Object Explorer. The + logical operators in the expression ('AND', 'OR') should be provided in capital letters. The search involves both a IP search and a textual search in + name, comment, tags etc. + type: str + limit: + description: + - The maximal number of returned results. + This parameter is relevant only for getting few objects. + type: int + offset: + description: + - Number of the results to initially skip. + This parameter is relevant only for getting few objects. + type: int + order: + description: + - Sorts the results by search criteria. Automatically sorts the results by Name, in the ascending order. + This parameter is relevant only for getting few objects. + type: list + elements: dict + suboptions: + ASC: + description: + - Sorts results by the given field in ascending order. + type: str + choices: ['name'] + DESC: + description: + - Sorts results by the given field in descending order. + type: str + choices: ['name'] + domains_to_process: + description: + - Indicates which domains to process the commands on. It cannot be used with the details-level full, must be run from the System Domain only and + with ignore-warnings true. Valid values are, CURRENT_DOMAIN, ALL_DOMAINS_ON_THIS_SERVER. + type: list + elements: str +extends_documentation_fragment: check_point.mgmt.checkpoint_facts +""" + +EXAMPLES = """ +- name: show-tacacs-group + cp_mgmt_tacacs_group_facts: + name: group1 + +- name: show-tacacs-groups + cp_mgmt_tacacs_group_facts: + details_level: standard + limit: 50 + offset: 0 +""" + +RETURN = """ +ansible_facts: + description: The checkpoint object facts. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts + + +def main(): + argument_spec = dict( + name=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + filter=dict(type='str'), + limit=dict(type='int'), + offset=dict(type='int'), + order=dict(type='list', elements='dict', options=dict( + ASC=dict(type='str', choices=['name']), + DESC=dict(type='str', choices=['name']) + )), + domains_to_process=dict(type='list', elements='str') + ) + argument_spec.update(checkpoint_argument_spec_for_facts) + + module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + + api_call_object = "tacacs-group" + api_call_object_plural_version = "tacacs-groups" + + result = api_call_facts(module, api_call_object, api_call_object_plural_version) + module.exit_json(ansible_facts=result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_tacacs_server.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_tacacs_server.py new file mode 100644 index 000000000..986b46156 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_tacacs_server.py @@ -0,0 +1,171 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_tacacs_server +short_description: Manages tacacs-server objects on Checkpoint over Web Services API +description: + - Manages tacacs-server objects on Checkpoint devices including creating, updating and removing objects. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + name: + description: + - Object name. + type: str + required: True + secret_key: + description: + - The server's secret key.<br><font color="red">Required only when</font> "server-type" was selected to be "TACACS+". + type: str + server: + description: + - The UID or Name of the host that is the TACACS Server. + type: str + encryption: + description: + - Is there a secret key defined on the server. Must be set true when "server-type" was selected to be "TACACS+". + type: bool + priority: + description: + - The priority of the TACACS Server in case it is a member of a TACACS Group. + type: int + server_type: + description: + - Server type, TACACS or TACACS+. + type: str + choices: ['TACACS', 'TACACS+'] + service: + description: + - Server service, only relevant when "server-type" is TACACS. + type: str + tags: + description: + - Collection of tag identifiers. + type: list + elements: str + color: + description: + - Color of the object. Should be one of existing colors. + type: str + choices: ['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green', + 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', + 'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', 'yellow'] + comments: + description: + - Comments string. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + groups: + description: + - Collection of group identifiers. + type: list + elements: str + ignore_warnings: + description: + - Apply changes ignoring warnings. + type: bool + ignore_errors: + description: + - Apply changes ignoring errors. You won't be able to publish such a changes. If ignore-warnings flag was omitted - warnings will also be ignored. + type: bool +extends_documentation_fragment: check_point.mgmt.checkpoint_objects +""" + +EXAMPLES = """ +- name: add-tacacs-server + cp_mgmt_tacacs_server: + name: tacacs7 + server: h1 + state: present + +- name: set-tacacs-server + cp_mgmt_tacacs_server: + encryption: 'true' + name: tacacs server + priority: '5' + secret_key: '**secret**' + server: d700e8d5-d010-4f37-ab14-f78f5a26426c + server_type: TACACS + state: present + +- name: delete-tacacs-server + cp_mgmt_tacacs_server: + name: tacacs server + state: absent +""" + +RETURN = """ +cp_mgmt_tacacs_server: + description: The checkpoint object created or updated. + returned: always, except when deleting the object. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call + + +def main(): + argument_spec = dict( + name=dict(type='str', required=True), + secret_key=dict(type='str', no_log=True), + server=dict(type='str'), + encryption=dict(type='bool'), + priority=dict(type='int'), + server_type=dict(type='str', choices=['TACACS', 'TACACS+']), + service=dict(type='str'), + tags=dict(type='list', elements='str'), + color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', + 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', + 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', + 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', + 'yellow']), + comments=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + groups=dict(type='list', elements='str'), + ignore_warnings=dict(type='bool'), + ignore_errors=dict(type='bool') + ) + argument_spec.update(checkpoint_argument_spec_for_objects) + + module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + api_call_object = 'tacacs-server' + + result = api_call(module, api_call_object) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_tacacs_server_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_tacacs_server_facts.py new file mode 100644 index 000000000..3a5868a20 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_tacacs_server_facts.py @@ -0,0 +1,141 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_tacacs_server_facts +short_description: Get tacacs-server objects facts on Checkpoint over Web Services API +description: + - Get tacacs-server objects facts on Checkpoint devices. + - All operations are performed over Web Services API. + - This module handles both operations, get a specific object and get several objects, + For getting a specific object use the parameter 'name'. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + name: + description: + - Object name. + This parameter is relevant only for getting a specific object. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + filter: + description: + - Search expression to filter objects by. The provided text should be exactly the same as it would be given in SmartConsole Object Explorer. The + logical operators in the expression ('AND', 'OR') should be provided in capital letters. The search involves both a IP search and a textual search in + name, comment, tags etc. + type: str + limit: + description: + - The maximal number of returned results. + This parameter is relevant only for getting few objects. + type: int + offset: + description: + - Number of the results to initially skip. + This parameter is relevant only for getting few objects. + type: int + order: + description: + - Sorts the results by search criteria. Automatically sorts the results by Name, in the ascending order. + This parameter is relevant only for getting few objects. + type: list + elements: dict + suboptions: + ASC: + description: + - Sorts results by the given field in ascending order. + type: str + choices: ['name'] + DESC: + description: + - Sorts results by the given field in descending order. + type: str + choices: ['name'] + domains_to_process: + description: + - Indicates which domains to process the commands on. It cannot be used with the details-level full, must be run from the System Domain only and + with ignore-warnings true. Valid values are, CURRENT_DOMAIN, ALL_DOMAINS_ON_THIS_SERVER. + type: list + elements: str +extends_documentation_fragment: check_point.mgmt.checkpoint_facts +""" + +EXAMPLES = """ +- name: show-tacacs-server + cp_mgmt_tacacs_server_facts: + name: t1 + +- name: show-tacacs-servers + cp_mgmt_tacacs_server_facts: + details_level: standard + limit: 50 + offset: 0 +""" + +RETURN = """ +ansible_facts: + description: The checkpoint object facts. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts + + +def main(): + argument_spec = dict( + name=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + filter=dict(type='str'), + limit=dict(type='int'), + offset=dict(type='int'), + order=dict(type='list', elements='dict', options=dict( + ASC=dict(type='str', choices=['name']), + DESC=dict(type='str', choices=['name']) + )), + domains_to_process=dict(type='list', elements='str') + ) + argument_spec.update(checkpoint_argument_spec_for_facts) + + module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + + api_call_object = "tacacs-server" + api_call_object_plural_version = "tacacs-servers" + + result = api_call_facts(module, api_call_object, api_call_object_plural_version) + module.exit_json(ansible_facts=result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_tag.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_tag.py index 07bc150ce..2650b1913 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_tag.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_tag.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -96,31 +98,72 @@ cp_mgmt_tag: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - tags=dict(type='list', elements='str'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + tags=dict(type="list", elements="str"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'tag' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "tag" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_tag_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_tag_facts.py index 942e1415b..918c9c8eb 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_tag_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_tag_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -95,30 +97,41 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )) + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "tag" api_call_object_plural_version = "tags" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_task_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_task_facts.py new file mode 100644 index 000000000..f76eba09b --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_task_facts.py @@ -0,0 +1,150 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_task_facts +short_description: Get task objects facts on Checkpoint over Web Services API +description: + - Get task objects facts on Checkpoint devices. + - All operations are performed over Web Services API. + - This module handles both operations, get a specific object and get several objects, + For getting a specific object use the parameter 'name'. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + task_id: + description: + - Unique identifier of one or more tasks. + type: list + elements: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + initiator: + description: + - Initiator's name. If name isn't specified, tasks from all initiators will be shown. + type: str + status: + description: + - Status. + type: str + choices: ['successful', 'failed', 'in-progress', 'all'] + from_date: + description: + - The date from which tracking tasks is to be performed, by the task's last update date. ISO 8601. If timezone isn't specified in the input, the + Management server's timezone is used. + type: str + to_date: + description: + - The date until which tracking tasks is to be performed, by the task's last update date. ISO 8601. If timezone isn't specified in the input, + the Management server's timezone is used. + type: str + limit: + description: + - The maximal number of returned results. + This parameter is relevant only for getting few objects. + type: int + offset: + description: + - Number of the results to initially skip. + This parameter is relevant only for getting few objects. + type: int + order: + description: + - Sorts results by the given field. By default the results are sorted in the descending order by the task's last update date. + This parameter is relevant only for getting few objects. + type: list + elements: dict + suboptions: + ASC: + description: + - Sorts results by the given field in ascending order. + type: str + choices: ['name'] + DESC: + description: + - Sorts results by the given field in descending order. + type: str + choices: ['name'] +extends_documentation_fragment: check_point.mgmt.checkpoint_facts +""" + +EXAMPLES = """ +- name: show-task + cp_mgmt_task_facts: + task_id: 2eec70e5-78a8-4bdb-9a76-cfb5601d0bcb + +- name: show-tasks + cp_mgmt_task_facts: + from_date: '2018-05-23T08:00:00' + initiator: admin1 + status: successful +""" + +RETURN = """ +ansible_facts: + description: The checkpoint object facts. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts + + +def main(): + argument_spec = dict( + task_id=dict(type='list', elements='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + initiator=dict(type='str'), + status=dict(type='str', choices=['successful', 'failed', 'in-progress', 'all']), + from_date=dict(type='str'), + to_date=dict(type='str'), + limit=dict(type='int'), + offset=dict(type='int'), + order=dict(type='list', elements='dict', options=dict( + ASC=dict(type='str', choices=['name']), + DESC=dict(type='str', choices=['name']) + )) + ) + argument_spec.update(checkpoint_argument_spec_for_facts) + + module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + + api_call_object = "task" + api_call_object_plural_version = "tasks" + + result = api_call_facts(module, api_call_object, api_call_object_plural_version) + module.exit_json(ansible_facts=result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_test_sic_status.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_test_sic_status.py index 2eb7dbf0a..7224b7886 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_test_sic_status.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_test_sic_status.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -61,13 +63,14 @@ cp_mgmt_test_sic_status: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): - argument_spec = dict( - name=dict(type='str') - ) + argument_spec = dict(name=dict(type="str")) argument_spec.update(checkpoint_argument_spec_for_commands) module = AnsibleModule(argument_spec=argument_spec) @@ -78,5 +81,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_exception.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_exception.py index b6ea57f63..1b5f2b6bf 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_exception.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_exception.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -173,41 +175,47 @@ cp_mgmt_threat_exception: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call, api_call_for_rule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, + api_call_for_rule, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - position=dict(type='str'), - exception_group_uid=dict(type='str'), - exception_group_name=dict(type='str'), - layer=dict(type='str'), - rule_name=dict(type='str'), - action=dict(type='str'), - destination=dict(type='list', elements='str'), - destination_negate=dict(type='bool'), - enabled=dict(type='bool'), - install_on=dict(type='list', elements='str'), - protected_scope=dict(type='list', elements='str'), - protected_scope_negate=dict(type='bool'), - protection_or_site=dict(type='list', elements='str'), - service=dict(type='list', elements='str'), - service_negate=dict(type='bool'), - source=dict(type='list', elements='str'), - source_negate=dict(type='bool'), - track=dict(type='str'), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + position=dict(type="str"), + exception_group_uid=dict(type="str"), + exception_group_name=dict(type="str"), + layer=dict(type="str"), + rule_name=dict(type="str"), + action=dict(type="str"), + destination=dict(type="list", elements="str"), + destination_negate=dict(type="bool"), + enabled=dict(type="bool"), + install_on=dict(type="list", elements="str"), + protected_scope=dict(type="list", elements="str"), + protected_scope_negate=dict(type="bool"), + protection_or_site=dict(type="list", elements="str"), + service=dict(type="list", elements="str"), + service_negate=dict(type="bool"), + source=dict(type="list", elements="str"), + source_negate=dict(type="bool"), + track=dict(type="str"), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'threat-exception' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "threat-exception" - if module.params['position'] is None: + if module.params["position"] is None: result = api_call(module, api_call_object) else: result = api_call_for_rule(module, api_call_object) @@ -215,5 +223,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_exception_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_exception_facts.py index 1455df234..6473ef001 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_exception_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_exception_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -175,49 +177,66 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - exception_group_uid=dict(type='str'), - exception_group_name=dict(type='str'), - layer=dict(type='str'), - rule_name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - filter=dict(type='str'), - filter_settings=dict(type='dict', options=dict( - search_mode=dict(type='str', choices=['general', 'packet']), - packet_search_settings=dict(type='dict', options=dict( - expand_group_members=dict(type='bool'), - expand_group_with_exclusion_members=dict(type='bool'), - match_on_any=dict(type='bool'), - match_on_group_with_exclusion=dict(type='bool'), - match_on_negate=dict(type='bool') - )) - )), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - package=dict(type='str'), - use_object_dictionary=dict(type='bool'), - dereference_group_members=dict(type='bool'), - show_membership=dict(type='bool') + name=dict(type="str"), + exception_group_uid=dict(type="str"), + exception_group_name=dict(type="str"), + layer=dict(type="str"), + rule_name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + filter=dict(type="str"), + filter_settings=dict( + type="dict", + options=dict( + search_mode=dict(type="str", choices=["general", "packet"]), + packet_search_settings=dict( + type="dict", + options=dict( + expand_group_members=dict(type="bool"), + expand_group_with_exclusion_members=dict(type="bool"), + match_on_any=dict(type="bool"), + match_on_group_with_exclusion=dict(type="bool"), + match_on_negate=dict(type="bool"), + ), + ), + ), + ), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + package=dict(type="str"), + use_object_dictionary=dict(type="bool"), + dereference_group_members=dict(type="bool"), + show_membership=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "threat-exception" api_call_object_plural_version = "threat-rule-exception-rulebase" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_indicator.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_indicator.py index 67772aef5..1fd458e81 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_indicator.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_indicator.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -218,57 +220,115 @@ cp_mgmt_threat_indicator: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - observables=dict(type='list', elements='dict', options=dict( - name=dict(type='str'), - md5=dict(type='str'), - url=dict(type='str'), - ip_address=dict(type='str'), - ip_address_first=dict(type='str'), - ip_address_last=dict(type='str'), - domain=dict(type='str'), - mail_to=dict(type='str'), - mail_from=dict(type='str'), - mail_cc=dict(type='str'), - mail_reply_to=dict(type='str'), - mail_subject=dict(type='str'), - confidence=dict(type='str', choices=['low', 'medium', 'high', 'critical']), - product=dict(type='str', choices=['AV', 'AB']), - severity=dict(type='str', choices=['low', 'medium', 'high', 'critical']), - comments=dict(type='str'), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') - )), - observables_raw_data=dict(type='str'), - action=dict(type='str', choices=['Inactive', 'Ask', 'Prevent', 'Detect']), - profile_overrides=dict(type='list', elements='dict', options=dict( - action=dict(type='str', choices=['Inactive', 'Ask', 'Prevent', 'Detect']), - profile=dict(type='str') - )), - tags=dict(type='list', elements='str'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + observables=dict( + type="list", + elements="dict", + options=dict( + name=dict(type="str"), + md5=dict(type="str"), + url=dict(type="str"), + ip_address=dict(type="str"), + ip_address_first=dict(type="str"), + ip_address_last=dict(type="str"), + domain=dict(type="str"), + mail_to=dict(type="str"), + mail_from=dict(type="str"), + mail_cc=dict(type="str"), + mail_reply_to=dict(type="str"), + mail_subject=dict(type="str"), + confidence=dict( + type="str", choices=["low", "medium", "high", "critical"] + ), + product=dict(type="str", choices=["AV", "AB"]), + severity=dict( + type="str", choices=["low", "medium", "high", "critical"] + ), + comments=dict(type="str"), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), + ), + ), + observables_raw_data=dict(type="str"), + action=dict( + type="str", choices=["Inactive", "Ask", "Prevent", "Detect"] + ), + profile_overrides=dict( + type="list", + elements="dict", + options=dict( + action=dict( + type="str", + choices=["Inactive", "Ask", "Prevent", "Detect"], + ), + profile=dict(type="str"), + ), + ), + tags=dict(type="list", elements="str"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'threat-indicator' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "threat-indicator" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_indicator_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_indicator_facts.py index 3d441c435..7e211e197 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_indicator_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_indicator_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -95,30 +97,41 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )) + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "threat-indicator" api_call_object_plural_version = "threat-indicators" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_layer.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_layer.py index 991b533ef..45d4e8e43 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_layer.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_layer.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["deprecated"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -34,6 +36,10 @@ description: - All operations are performed over Web Services API. version_added: "1.0.0" author: "Or Soffer (@chkp-orso)" +deprecated: + alternative: cp_mgmt_threat_layers + why: Newer and updated modules released with more functionality. + removed_at_date: '2024-11-01' options: name: description: @@ -97,32 +103,73 @@ cp_mgmt_threat_layer: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - add_default_rule=dict(type='bool'), - tags=dict(type='list', elements='str'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + add_default_rule=dict(type="bool"), + tags=dict(type="list", elements="str"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'threat-layer' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "threat-layer" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_layer_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_layer_facts.py index c432b56ec..bfed8eff4 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_layer_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_layer_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -98,30 +100,41 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )) + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "threat-layer" api_call_object_plural_version = "threat-layers" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_layers.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_layers.py new file mode 100644 index 000000000..fdf605544 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_layers.py @@ -0,0 +1,423 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright 2022 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +""" +The module file for cp_mgmt_threat_layers +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +module: cp_mgmt_threat_layers +short_description: Manages THREAT LAYERS resource module +description: + - This resource module allows for addition, deletion, or modification of CP Threat Layers. + - This resource module also takes care of gathering Threat Layers config facts +version_added: "5.0.0" +author: Ansible Security Automation Team (@justjais) <https://github.com/ansible-security>- +options: + config: + description: A dictionary of THREAT LAYERS options + type: dict + suboptions: + name: + description: Object name. Must be unique in the domain. + type: str + add_default_rule: + description: Indicates whether to include a default rule in the new layer. + type: bool + tags: + description: Collection of tag identifiers. + type: list + elements: str + color: + description: Color of the object. Should be one of existing colors. + type: str + choices: + - aquamarine + - black + - blue + - crete blue + - burlywood + - cyan + - dark green + - khaki + - orchid + - dark orange + - dark sea green + - pink + - turquoise + - dark blue + - firebrick + - brown + - forest green + - gold + - dark gold + - gray + - dark gray + - light green + - lemon chiffon + - coral + - sea green + - sky blue + - magenta + - purple + - slate blue + - violet red + - navy blue + - olive + - orange + - red + - sienna + - yellow + comments: + description: Comments string. + type: str + details_level: + description: The level of detail for some of the fields in the response can + vary from showing only the UID value of the object to a fully detailed representation + of the object. + type: str + choices: + - uid + - standard + - full + ignore_warnings: + description: Apply changes ignoring warnings. + type: bool + ignore_errors: + description: Apply changes ignoring errors. You won't be able to publish such + a changes. If ignore-warnings flag was omitted - warnings will also be ignored. + type: bool + limit: + description: + - The maximal number of returned results. + - NOTE, this parameter is a valid parameter only for the GATHERED state, for config states + like, MERGED, REPLACED, and DELETED state it won't be applicable. + type: int + offset: + description: + - Number of the results to initially skip. + - NOTE, this parameter is a valid parameter only for the GATHERED state, for config states + like, MERGED, REPLACED, and DELETED state it won't be applicable. + type: int + order: + description: + - Sorts results by the given field. By default the results are sorted in the ascending order by name. + This parameter is relevant only for getting few objects. + - NOTE, this parameter is a valid parameter only for the GATHERED state, for config states + like, MERGED, REPLACED, and DELETED state it won't be applicable. + type: list + elements: dict + suboptions: + ASC: + description: + - Sorts results by the given field in ascending order. + type: str + DESC: + description: + - Sorts results by the given field in descending order. + type: str + round_trip: + description: + - If set to True, the round trip will filter out the module parameters from the response param, + which will enable the user to fire the config request using the structured gathered data. + - NOTE, this parameter makes relevance only with the GATHERED state, as for config states like, + MERGED, REPLACED, and DELETED state it won't make any config updates, + as it's not a module config parameter. + auto_publish_session: + description: + - Publish the current session if changes have been performed + after task completes. + type: bool + version: + description: + - Version of checkpoint. If not given one, the latest version taken. + type: str + state: + description: + - The state the configuration should be left in + - The state I(gathered) will get the module API configuration from the device + and transform it into structured data in the format as per the module argspec + and the value is returned in the I(gathered) key within the result. + type: str + choices: + - merged + - replaced + - gathered + - deleted +""" + +EXAMPLES = """ + +# Using MERGED state +# ------------------- + +- name: To Add Merge Threat-Layers config + cp_mgmt_threat_layers: + state: merged + config: + name: New Layer 1 + add_default_rule: true + tags: + - test_threat_layer + color: turquoise + comments: test description + ignore_warnings: false + ignore_errors: false + round_trip: true + +# RUN output: +# ----------- + +# mgmt_threat_layers: +# after: +# color: turquoise +# comments: test description +# icon: ApplicationFirewall/rulebase +# ips-layer: false +# name: New Layer 1 +# tags: +# - test_threat_layer +# before: {} + +# Using REPLACED state +# -------------------- + +- name: Replace Threat-layer config + cp_mgmt_threat_layers: + state: replaced + config: + name: New Layer 1 + add_default_rule: true + tags: + - test_threat_layer_replaced + color: cyan + comments: REPLACED description + ignore_warnings: false + ignore_errors: false + round_trip: true + +# RUN output: +# ----------- + +# mgmt_threat_layers: +# after: +# color: cyan +# comments: REPLACED description +# icon: ApplicationFirewall/rulebase +# ips-layer: false +# name: New Layer 1 +# tags: +# - test_threat_layer_replaced +# before: +# color: turquoise +# comments: test description +# icon: ApplicationFirewall/rulebase +# ips-layer: false +# name: New Layer 1 +# tags: +# - test_threat_layer + +# Using GATHERED state +# -------------------- + +# 1. With Round Trip set to True + +- name: To Gather threat-layer by Name + cp_mgmt_threat_layers: + config: + name: New Layer 1 + round_trip: true + state: gathered + +# RUN output: +# ----------- + +# gathered: +# color: turquoise +# comments: test description +# domain: SMC User +# icon: ApplicationFirewall/rulebase +# ips-layer: false +# name: New Layer 1 +# read-only: false +# tags: +# - test_threat_layer +# uid: 4dc060e2-0ed6-48c5-9b0f-3d2fbeb552ba + +# 2. With Round Trip set to False which is the default behaviour + +- name: To Gather threat-layer by Name + cp_mgmt_threat_layers: + config: + name: New Layer 1 + state: gathered + +# RUN output: +# ----------- + +# gathered: +# color: turquoise +# comments: test description +# domain: +# domain-type: domain +# name: SMC User +# uid: 41e821a0-3720-11e3-aa6e-0800200c9fde +# icon: ApplicationFirewall/rulebase +# ips-layer: false +# meta-info: +# creation-time: +# iso-8601: 2022-11-21T07:30+0000 +# posix: 1669015820472 +# creator: admin +# last-modifier: admin +# last-modify-time: +# iso-8601: 2022-11-21T07:30+0000 +# posix: 1669015821024 +# lock: unlocked +# validation-state: ok +# name: New Layer 1 +# read-only: false +# tags: +# - domain: +# domain-type: domain +# name: SMC User +# uid: 41e821a0-3720-11e3-aa6e-0800200c9fde +# name: test_threat_layer +# type: tag +# uid: 59f23149-ed5e-439f-9012-0cdf222a1c97 +# type: threat-layer +# uid: ca196a80-fdc4-4e7b-8b25-e3eed125a25f + +# 3. Gather ALL threat-layer config with DESC order filter + +- name: To Gather ALL threat-layer and order by Name + cp_mgmt_threat_layers: + config: + order: + - DESC: name + state: gathered + +# RUN output: +# ----------- + +# gathered: +# - color: black +# comments: '' +# domain: +# domain-type: domain +# name: SMC User +# uid: 41e821a0-3720-11e3-aa6e-0800200c9fde +# icon: ApplicationFirewall/sharedrulebase +# ips-layer: true +# meta-info: +# creation-time: +# iso-8601: 2020-01-20T09:43+0000 +# posix: 1579513387322 +# creator: System +# last-modifier: System +# last-modify-time: +# iso-8601: 2020-01-20T09:43+0000 +# posix: 1579513387377 +# lock: unlocked +# validation-state: ok +# name: IPS +# read-only: false +# tags: [] +# type: threat-layer +# uid: 90678011-1bcb-4296-8154-fa58c23ecf3b +# - color: black +# comments: '' +# domain: +# domain-type: domain +# name: SMC User +# uid: 41e821a0-3720-11e3-aa6e-0800200c9fde +# icon: ApplicationFirewall/rulebase +# ips-layer: false +# meta-info: +# creation-time: +# iso-8601: 2020-01-20T09:43+0000 +# posix: 1579513386848 +# creator: System +# last-modifier: System +# last-modify-time: +# iso-8601: 2020-01-20T09:43+0000 +# posix: 1579513387396 +# lock: unlocked +# validation-state: ok +# name: Standard Threat Prevention +# read-only: false +# tags: [] +# type: threat-layer +# uid: 0dbe7c44-6d3f-4f28-8f2b-0e6790e57f8a + +# Using DELETED state +# ------------------- + +- name: Delete Threat-layer config by Name and Layer + cp_mgmt_threat_layers: + config: + layer: IPS + name: First threat layer + round_trip: true + state: deleted + +# RUN output: +# ----------- + +# mgmt_threat_layers: +# after: {} +# before: +# action: Optimized +# comments: This is the THREAT RULE +# destination: +# - Any +# destination_negate: false +# enabled: true +# install_on: +# - Policy Targets +# layer: 90678011-1bcb-4296-8154-fa58c23ecf3b +# name: First threat layer +# protected_scope: +# - All_Internet +# protected_scope_negate: false +# service: +# - Any +# service_negate: false +# source: +# - Any +# source_negate: false +# track: None +# track_settings: +# packet_capture: true +""" + +RETURN = """ +before: + description: The configuration prior to the module execution. + returned: when state is I(merged), I(replaced), I(deleted) + type: dict + sample: > + This output will always be in the same format as the + module argspec. +after: + description: The resulting configuration after module execution. + returned: when changed + type: dict + sample: > + This output will always be in the same format as the + module argspec. +gathered: + description: Facts about the network resource gathered from the remote device as structured data. + returned: when state is I(gathered) + type: dict + sample: > + This output will always be in the same format as the + module argspec. +""" diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_profile.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_profile.py index e41b82c84..457f5d402 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_profile.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_profile.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -326,81 +328,191 @@ cp_mgmt_threat_profile: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - active_protections_performance_impact=dict(type='str', choices=['high', 'medium', 'low', 'very_low']), - active_protections_severity=dict(type='str', choices=['Critical', 'High', 'Medium or above', 'Low or above']), - confidence_level_high=dict(type='str', choices=['Inactive', 'Ask', 'Prevent', 'Detect']), - confidence_level_low=dict(type='str', choices=['Inactive', 'Ask', 'Prevent', 'Detect']), - confidence_level_medium=dict(type='str', choices=['Inactive', 'Ask', 'Prevent', 'Detect']), - indicator_overrides=dict(type='list', elements='dict', options=dict( - action=dict(type='str', choices=['Inactive', 'Ask', 'Prevent', 'Detect']), - indicator=dict(type='str') - )), - ips_settings=dict(type='dict', options=dict( - exclude_protection_with_performance_impact=dict(type='bool'), - exclude_protection_with_performance_impact_mode=dict(type='str', choices=['very low', 'low or lower', 'medium or lower', 'high or lower']), - exclude_protection_with_severity=dict(type='bool'), - exclude_protection_with_severity_mode=dict(type='str', choices=['low or above', 'medium or above', 'high or above', 'critical']), - newly_updated_protections=dict(type='str', choices=['active', 'inactive', 'staging']) - )), - malicious_mail_policy_settings=dict(type='dict', options=dict( - add_customized_text_to_email_body=dict(type='bool'), - add_email_subject_prefix=dict(type='bool'), - add_x_header_to_email=dict(type='bool'), - email_action=dict(type='str', choices=['allow', 'block']), - email_body_customized_text=dict(type='str'), - email_subject_prefix_text=dict(type='str'), - failed_to_scan_attachments_text=dict(type='str'), - malicious_attachments_text=dict(type='str'), - malicious_links_text=dict(type='str'), - remove_attachments_and_links=dict(type='bool'), - send_copy=dict(type='bool'), - send_copy_list=dict(type='list', elements='str') - )), - overrides=dict(type='list', elements='dict', options=dict( - action=dict(type='str', choices=['Threat Cloud: Inactive', 'Detect', 'Prevent <br> Core: Drop', 'Inactive', 'Accept']), - protection=dict(type='str'), - capture_packets=dict(type='bool'), - track=dict(type='str', choices=['none', 'log', 'alert', 'mail', 'snmp trap', 'user alert', 'user alert 1', 'user alert 2']) - )), - tags=dict(type='list', elements='str'), - use_indicators=dict(type='bool'), - anti_bot=dict(type='bool'), - anti_virus=dict(type='bool'), - ips=dict(type='bool'), - threat_emulation=dict(type='bool'), - activate_protections_by_extended_attributes=dict(type='list', elements='dict', options=dict( - name=dict(type='str'), - category=dict(type='str') - )), - deactivate_protections_by_extended_attributes=dict(type='list', elements='dict', options=dict( - name=dict(type='str'), - category=dict(type='str') - )), - use_extended_attributes=dict(type='bool'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + active_protections_performance_impact=dict( + type="str", choices=["high", "medium", "low", "very_low"] + ), + active_protections_severity=dict( + type="str", + choices=["Critical", "High", "Medium or above", "Low or above"], + ), + confidence_level_high=dict( + type="str", choices=["Inactive", "Ask", "Prevent", "Detect"] + ), + confidence_level_low=dict( + type="str", choices=["Inactive", "Ask", "Prevent", "Detect"] + ), + confidence_level_medium=dict( + type="str", choices=["Inactive", "Ask", "Prevent", "Detect"] + ), + indicator_overrides=dict( + type="list", + elements="dict", + options=dict( + action=dict( + type="str", + choices=["Inactive", "Ask", "Prevent", "Detect"], + ), + indicator=dict(type="str"), + ), + ), + ips_settings=dict( + type="dict", + options=dict( + exclude_protection_with_performance_impact=dict(type="bool"), + exclude_protection_with_performance_impact_mode=dict( + type="str", + choices=[ + "very low", + "low or lower", + "medium or lower", + "high or lower", + ], + ), + exclude_protection_with_severity=dict(type="bool"), + exclude_protection_with_severity_mode=dict( + type="str", + choices=[ + "low or above", + "medium or above", + "high or above", + "critical", + ], + ), + newly_updated_protections=dict( + type="str", choices=["active", "inactive", "staging"] + ), + ), + ), + malicious_mail_policy_settings=dict( + type="dict", + options=dict( + add_customized_text_to_email_body=dict(type="bool"), + add_email_subject_prefix=dict(type="bool"), + add_x_header_to_email=dict(type="bool"), + email_action=dict(type="str", choices=["allow", "block"]), + email_body_customized_text=dict(type="str"), + email_subject_prefix_text=dict(type="str"), + failed_to_scan_attachments_text=dict(type="str"), + malicious_attachments_text=dict(type="str"), + malicious_links_text=dict(type="str"), + remove_attachments_and_links=dict(type="bool"), + send_copy=dict(type="bool"), + send_copy_list=dict(type="list", elements="str"), + ), + ), + overrides=dict( + type="list", + elements="dict", + options=dict( + action=dict( + type="str", + choices=[ + "Threat Cloud: Inactive", + "Detect", + "Prevent <br> Core: Drop", + "Inactive", + "Accept", + ], + ), + protection=dict(type="str"), + capture_packets=dict(type="bool"), + track=dict( + type="str", + choices=[ + "none", + "log", + "alert", + "mail", + "snmp trap", + "user alert", + "user alert 1", + "user alert 2", + ], + ), + ), + ), + tags=dict(type="list", elements="str"), + use_indicators=dict(type="bool"), + anti_bot=dict(type="bool"), + anti_virus=dict(type="bool"), + ips=dict(type="bool"), + threat_emulation=dict(type="bool"), + activate_protections_by_extended_attributes=dict( + type="list", + elements="dict", + options=dict(name=dict(type="str"), category=dict(type="str")), + ), + deactivate_protections_by_extended_attributes=dict( + type="list", + elements="dict", + options=dict(name=dict(type="str"), category=dict(type="str")), + ), + use_extended_attributes=dict(type="bool"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'threat-profile' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "threat-profile" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_profile_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_profile_facts.py index b3fcbaae2..00dc08a04 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_profile_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_profile_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -98,30 +100,41 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )) + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "threat-profile" api_call_object_plural_version = "threat-profiles" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_protection_override.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_protection_override.py index 22ce24a22..d3d96289c 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_protection_override.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_protection_override.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -101,21 +103,49 @@ cp_mgmt_threat_protection_override: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): argument_spec = dict( - name=dict(type='str'), - comments=dict(type='str'), - follow_up=dict(type='bool'), - overrides=dict(type='list', elements='dict', options=dict( - action=dict(type='str', choices=['Threat Cloud: Inactive', 'Detect', 'Prevent <br> Core: Drop', 'Inactive', 'Accept']), - profile=dict(type='str'), - capture_packets=dict(type='bool'), - track=dict(type='str', choices=['none', 'log', 'alert', 'mail', 'snmp trap', 'user alert', 'user alert 1', 'user alert 2']) - )), - details_level=dict(type='str', choices=['uid', 'standard', 'full']) + name=dict(type="str"), + comments=dict(type="str"), + follow_up=dict(type="bool"), + overrides=dict( + type="list", + elements="dict", + options=dict( + action=dict( + type="str", + choices=[ + "Threat Cloud: Inactive", + "Detect", + "Prevent <br> Core: Drop", + "Inactive", + "Accept", + ], + ), + profile=dict(type="str"), + capture_packets=dict(type="bool"), + track=dict( + type="str", + choices=[ + "none", + "log", + "alert", + "mail", + "snmp trap", + "user alert", + "user alert 1", + "user alert 2", + ], + ), + ), + ), + details_level=dict(type="str", choices=["uid", "standard", "full"]), ) argument_spec.update(checkpoint_argument_spec_for_commands) @@ -127,5 +157,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_rule.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_rule.py index a69286364..11e23389d 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_rule.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_rule.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -169,40 +171,46 @@ cp_mgmt_threat_rule: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call, api_call_for_rule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, + api_call_for_rule, +) def main(): argument_spec = dict( - position=dict(type='str'), - layer=dict(type='str'), - name=dict(type='str', required=True), - action=dict(type='str'), - destination=dict(type='list', elements='str'), - destination_negate=dict(type='bool'), - enabled=dict(type='bool'), - install_on=dict(type='list', elements='str'), - protected_scope=dict(type='list', elements='str'), - protected_scope_negate=dict(type='bool'), - service=dict(type='list', elements='str'), - service_negate=dict(type='bool'), - source=dict(type='list', elements='str'), - source_negate=dict(type='bool'), - track=dict(type='str'), - track_settings=dict(type='dict', options=dict( - packet_capture=dict(type='bool') - )), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + position=dict(type="str"), + layer=dict(type="str"), + name=dict(type="str", required=True), + action=dict(type="str"), + destination=dict(type="list", elements="str"), + destination_negate=dict(type="bool"), + enabled=dict(type="bool"), + install_on=dict(type="list", elements="str"), + protected_scope=dict(type="list", elements="str"), + protected_scope_negate=dict(type="bool"), + service=dict(type="list", elements="str"), + service_negate=dict(type="bool"), + source=dict(type="list", elements="str"), + source_negate=dict(type="bool"), + track=dict(type="str"), + track_settings=dict( + type="dict", options=dict(packet_capture=dict(type="bool")) + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'threat-rule' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "threat-rule" - if module.params['position'] is None: + if module.params["position"] is None: result = api_call(module, api_call_object) else: result = api_call_for_rule(module, api_call_object) @@ -210,5 +218,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_rule_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_rule_facts.py index 683784bc8..ce8fa8fe2 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_rule_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_rule_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -165,46 +167,63 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts_for_rule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts_for_rule, +) def main(): argument_spec = dict( - name=dict(type='str'), - layer=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - filter=dict(type='str'), - filter_settings=dict(type='dict', options=dict( - search_mode=dict(type='str', choices=['general', 'packet']), - packet_search_settings=dict(type='dict', options=dict( - expand_group_members=dict(type='bool'), - expand_group_with_exclusion_members=dict(type='bool'), - match_on_any=dict(type='bool'), - match_on_group_with_exclusion=dict(type='bool'), - match_on_negate=dict(type='bool') - )) - )), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )), - package=dict(type='str'), - use_object_dictionary=dict(type='bool'), - dereference_group_members=dict(type='bool'), - show_membership=dict(type='bool') + name=dict(type="str"), + layer=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + filter=dict(type="str"), + filter_settings=dict( + type="dict", + options=dict( + search_mode=dict(type="str", choices=["general", "packet"]), + packet_search_settings=dict( + type="dict", + options=dict( + expand_group_members=dict(type="bool"), + expand_group_with_exclusion_members=dict(type="bool"), + match_on_any=dict(type="bool"), + match_on_group_with_exclusion=dict(type="bool"), + match_on_negate=dict(type="bool"), + ), + ), + ), + ), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), + package=dict(type="str"), + use_object_dictionary=dict(type="bool"), + dereference_group_members=dict(type="bool"), + show_membership=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "threat-rule" api_call_object_plural_version = "threat-rulebase" - result = api_call_facts_for_rule(module, api_call_object, api_call_object_plural_version) + result = api_call_facts_for_rule( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_time.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_time.py index aa0af5e9a..92f6b8137 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_time.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_time.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -228,58 +230,112 @@ cp_mgmt_time: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - end=dict(type='dict', options=dict( - date=dict(type='str'), - iso_8601=dict(type='str'), - posix=dict(type='int'), - time=dict(type='str') - )), - end_never=dict(type='bool'), - hours_ranges=dict(type='list', elements='dict', options=dict( - enabled=dict(type='bool'), - index=dict(type='int'), - to=dict(type='str') - )), - start=dict(type='dict', options=dict( - date=dict(type='str'), - iso_8601=dict(type='str'), - posix=dict(type='int'), - time=dict(type='str') - )), - start_now=dict(type='bool'), - tags=dict(type='list', elements='str'), - recurrence=dict(type='dict', options=dict( - days=dict(type='list', elements='str'), - month=dict(type='str'), - pattern=dict(type='str'), - weekdays=dict(type='list', elements='str') - )), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - groups=dict(type='list', elements='str'), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + end=dict( + type="dict", + options=dict( + date=dict(type="str"), + iso_8601=dict(type="str"), + posix=dict(type="int"), + time=dict(type="str"), + ), + ), + end_never=dict(type="bool"), + hours_ranges=dict( + type="list", + elements="dict", + options=dict( + enabled=dict(type="bool"), + index=dict(type="int"), + to=dict(type="str"), + ), + ), + start=dict( + type="dict", + options=dict( + date=dict(type="str"), + iso_8601=dict(type="str"), + posix=dict(type="int"), + time=dict(type="str"), + ), + ), + start_now=dict(type="bool"), + tags=dict(type="list", elements="str"), + recurrence=dict( + type="dict", + options=dict( + days=dict(type="list", elements="str"), + month=dict(type="str"), + pattern=dict(type="str"), + weekdays=dict(type="list", elements="str"), + ), + ), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + groups=dict(type="list", elements="str"), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) - argument_spec['hours_ranges']['options']['from'] = dict(type='str') + argument_spec["hours_ranges"]["options"]["from"] = dict(type="str") argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'time' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "time" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_time_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_time_facts.py index 40eb88026..2802e5ae1 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_time_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_time_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -98,30 +100,41 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )) + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "time" api_call_object_plural_version = "times" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_time_group.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_time_group.py new file mode 100644 index 000000000..10ab28db4 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_time_group.py @@ -0,0 +1,148 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_time_group +short_description: Manages time-group objects on Checkpoint over Web Services API +description: + - Manages time-group objects on Checkpoint devices including creating, updating and removing objects. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + name: + description: + - Object name. + type: str + required: True + members: + description: + - Collection of Time Group objects identified by the name or UID. + type: list + elements: str + tags: + description: + - Collection of tag identifiers. + type: list + elements: str + color: + description: + - Color of the object. Should be one of existing colors. + type: str + choices: ['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green', + 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', + 'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', 'yellow'] + comments: + description: + - Comments string. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + groups: + description: + - Collection of group identifiers. + type: list + elements: str + ignore_warnings: + description: + - Apply changes ignoring warnings. + type: bool + ignore_errors: + description: + - Apply changes ignoring errors. You won't be able to publish such a changes. If ignore-warnings flag was omitted - warnings will also be ignored. + type: bool +extends_documentation_fragment: check_point.mgmt.checkpoint_objects +""" + +EXAMPLES = """ +- name: add-time-group + cp_mgmt_time_group: + name: timeGroup-1 + members: + - member1 + - member2 + state: present + +- name: set-time-group + cp_mgmt_time_group: + name: timeGroup-1 + members: + - member1 + - member2 + tags: + - tag1 + state: present + +- name: delete-time-group + cp_mgmt_time_group: + name: timeGroup-1 + state: absent +""" + +RETURN = """ +cp_mgmt_time_group: + description: The checkpoint object created or updated. + returned: always, except when deleting the object. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call + + +def main(): + argument_spec = dict( + name=dict(type='str', required=True), + members=dict(type='list', elements='str'), + tags=dict(type='list', elements='str'), + color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', + 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', + 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', + 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', + 'yellow']), + comments=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + groups=dict(type='list', elements='str'), + ignore_warnings=dict(type='bool'), + ignore_errors=dict(type='bool') + ) + argument_spec.update(checkpoint_argument_spec_for_objects) + + module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + api_call_object = 'time-group' + + result = api_call(module, api_call_object) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_time_group_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_time_group_facts.py new file mode 100644 index 000000000..49146d949 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_time_group_facts.py @@ -0,0 +1,141 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_time_group_facts +short_description: Get time-group objects facts on Checkpoint over Web Services API +description: + - Get time-group objects facts on Checkpoint devices. + - All operations are performed over Web Services API. + - This module handles both operations, get a specific object and get several objects, + For getting a specific object use the parameter 'name'. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + name: + description: + - Object name. + This parameter is relevant only for getting a specific object. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + filter: + description: + - Search expression to filter objects by. The provided text should be exactly the same as it would be given in SmartConsole Object Explorer. The + logical operators in the expression ('AND', 'OR') should be provided in capital letters. The search involves both a IP search and a textual search in + name, comment, tags etc. + type: str + limit: + description: + - The maximal number of returned results. + This parameter is relevant only for getting few objects. + type: int + offset: + description: + - Number of the results to initially skip. + This parameter is relevant only for getting few objects. + type: int + order: + description: + - Sorts the results by search criteria. Automatically sorts the results by Name, in the ascending order. + This parameter is relevant only for getting few objects. + type: list + elements: dict + suboptions: + ASC: + description: + - Sorts results by the given field in ascending order. + type: str + choices: ['name'] + DESC: + description: + - Sorts results by the given field in descending order. + type: str + choices: ['name'] + domains_to_process: + description: + - Indicates which domains to process the commands on. It cannot be used with the details-level full, must be run from the System Domain only and + with ignore-warnings true. Valid values are, CURRENT_DOMAIN, ALL_DOMAINS_ON_THIS_SERVER. + type: list + elements: str +extends_documentation_fragment: check_point.mgmt.checkpoint_facts +""" + +EXAMPLES = """ +- name: show-time-group + cp_mgmt_time_group_facts: + name: timeGroup-1 + +- name: show-time-groups + cp_mgmt_time_group_facts: + details_level: standard + limit: 50 + offset: 0 +""" + +RETURN = """ +ansible_facts: + description: The checkpoint object facts. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts + + +def main(): + argument_spec = dict( + name=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + filter=dict(type='str'), + limit=dict(type='int'), + offset=dict(type='int'), + order=dict(type='list', elements='dict', options=dict( + ASC=dict(type='str', choices=['name']), + DESC=dict(type='str', choices=['name']) + )), + domains_to_process=dict(type='list', elements='str') + ) + argument_spec.update(checkpoint_argument_spec_for_facts) + + module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + + api_call_object = "time-group" + api_call_object_plural_version = "time-groups" + + result = api_call_facts(module, api_call_object, api_call_object_plural_version) + module.exit_json(ansible_facts=result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_trusted_client.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_trusted_client.py index 9b885f83a..f872eb7d9 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_trusted_client.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_trusted_client.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -169,48 +171,102 @@ cp_mgmt_trusted_client: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - ip_address=dict(type='str'), - ipv4_address=dict(type='str'), - ipv6_address=dict(type='str'), - domains_assignment=dict(type='list', elements='str'), - ip_address_first=dict(type='str'), - ipv4_address_first=dict(type='str'), - ipv6_address_first=dict(type='str'), - ip_address_last=dict(type='str'), - ipv4_address_last=dict(type='str'), - ipv6_address_last=dict(type='str'), - mask_length=dict(type='int'), - mask_length4=dict(type='int'), - mask_length6=dict(type='int'), - multi_domain_server_trusted_client=dict(type='bool'), - tags=dict(type='list', elements='str'), - type=dict(type='str', choices=['any', 'domain', 'ipv4 address', 'ipv4 address range', 'ipv4 netmask', - 'ipv6 address', 'ipv6 address range', 'ipv6 netmask', 'name', 'wild cards (ip only)']), - wild_card=dict(type='str'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + ip_address=dict(type="str"), + ipv4_address=dict(type="str"), + ipv6_address=dict(type="str"), + domains_assignment=dict(type="list", elements="str"), + ip_address_first=dict(type="str"), + ipv4_address_first=dict(type="str"), + ipv6_address_first=dict(type="str"), + ip_address_last=dict(type="str"), + ipv4_address_last=dict(type="str"), + ipv6_address_last=dict(type="str"), + mask_length=dict(type="int"), + mask_length4=dict(type="int"), + mask_length6=dict(type="int"), + multi_domain_server_trusted_client=dict(type="bool"), + tags=dict(type="list", elements="str"), + type=dict( + type="str", + choices=[ + "any", + "domain", + "ipv4 address", + "ipv4 address range", + "ipv4 netmask", + "ipv6 address", + "ipv6 address range", + "ipv6 netmask", + "name", + "wild cards (ip only)", + ], + ), + wild_card=dict(type="str"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'trusted-client' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "trusted-client" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_trusted_client_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_trusted_client_facts.py index 8991e1125..46a620f9f 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_trusted_client_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_trusted_client_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -104,31 +106,42 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - filter=dict(type='str'), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )) + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + filter=dict(type="str"), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "trusted-client" api_call_object_plural_version = "trusted-clients" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_uninstall_software_package.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_uninstall_software_package.py index 1ddb16d74..ce1a035ae 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_uninstall_software_package.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_uninstall_software_package.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -79,18 +81,24 @@ cp_mgmt_uninstall_software_package: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): argument_spec = dict( - name=dict(type='str'), - targets=dict(type='list', elements='str'), - cluster_installation_settings=dict(type='dict', options=dict( - cluster_delay=dict(type='int'), - cluster_strategy=dict(type='str') - )), - concurrency_limit=dict(type='int') + name=dict(type="str"), + targets=dict(type="list", elements="str"), + cluster_installation_settings=dict( + type="dict", + options=dict( + cluster_delay=dict(type="int"), + cluster_strategy=dict(type="str"), + ), + ), + concurrency_limit=dict(type="int"), ) argument_spec.update(checkpoint_argument_spec_for_commands) @@ -102,5 +110,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_unlock_administrator.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_unlock_administrator.py new file mode 100644 index 000000000..23fa7a58b --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_unlock_administrator.py @@ -0,0 +1,85 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_unlock_administrator +short_description: Unlock administrator. +description: + - Unlock administrator. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + name: + description: + - Object name. + This parameter is relevant only for getting a specific object. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: unlock-administrator + cp_mgmt_unlock_administrator: + name: aa +""" + +RETURN = """ +cp_mgmt_unlock_administrator: + description: The checkpoint unlock-administrator output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + name=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']) + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "unlock-administrator" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_unlock_object.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_unlock_object.py new file mode 100644 index 000000000..8718ed825 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_unlock_object.py @@ -0,0 +1,96 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_unlock_object +short_description: Unlock object using uid or {name and type}. +description: + - Unlock object using uid or {name and type}. + - Can unlock object only if the current session owns the lock and there are no changes on the object. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + name: + description: + - Object name. Must be unique in the domain. + type: str + type: + description: + - Object type. + type: str + layer: + description: + - Object layer, need to specify the layer if the object is rule/section and uid is not supplied. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: unlock-object + cp_mgmt_unlock_object: + name: host5 + type: host +""" + +RETURN = """ +cp_mgmt_unlock_object: + description: The checkpoint unlock-object output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + name=dict(type='str'), + type=dict(type='str'), + layer=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']) + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "unlock-object" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_updatable_object_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_updatable_object_facts.py new file mode 100644 index 000000000..626794a5e --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_updatable_object_facts.py @@ -0,0 +1,143 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_updatable_object_facts +short_description: Get updatable-object objects facts on Checkpoint over Web Services API +description: + - Get updatable-object objects facts on Checkpoint devices. + - All operations are performed over Web Services API. + - This module handles both operations, get a specific object and get several objects, + For getting a specific object use the parameter 'name'. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + name: + description: + - Object name. + This parameter is relevant only for getting a specific object. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + filter: + description: + - Search expression to filter objects by. The provided text should be exactly the same as it would be given in SmartConsole Object Explorer. The + logical operators in the expression ('AND', 'OR') should be provided in capital letters. The search involves both a IP search and a textual search in + name, comment, tags etc. + type: str + limit: + description: + - The maximal number of returned results. + This parameter is relevant only for getting few objects. + type: int + offset: + description: + - Number of the results to initially skip. + This parameter is relevant only for getting few objects. + type: int + order: + description: + - Sorts the results by search criteria. Automatically sorts the results by Name, in the ascending order. + This parameter is relevant only for getting few objects. + type: list + elements: dict + suboptions: + ASC: + description: + - Sorts results by the given field in ascending order. + type: str + choices: ['name'] + DESC: + description: + - Sorts results by the given field in descending order. + type: str + choices: ['name'] + show_membership: + description: + - Indicates whether to calculate and show "groups" field for every object in reply. + type: bool + domains_to_process: + description: + - Indicates which domains to process the commands on. It cannot be used with the details-level full, must be run from the System Domain only and + with ignore-warnings true. Valid values are, CURRENT_DOMAIN, ALL_DOMAINS_ON_THIS_SERVER. + type: list + elements: str +extends_documentation_fragment: check_point.mgmt.checkpoint_facts +""" + +EXAMPLES = """ +- name: show-updatable-object + cp_mgmt_updatable_object_facts: + name: CodeBuild US East 1 + +- name: show-updatable-objects + cp_mgmt_updatable_object_facts: +""" + +RETURN = """ +ansible_facts: + description: The checkpoint object facts. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts + + +def main(): + argument_spec = dict( + name=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + filter=dict(type='str'), + limit=dict(type='int'), + offset=dict(type='int'), + order=dict(type='list', elements="dict", options=dict( + ASC=dict(type='str', choices=['name']), + DESC=dict(type='str', choices=['name']) + )), + show_membership=dict(type='bool'), + domains_to_process=dict(type='list', elements="str") + ) + argument_spec.update(checkpoint_argument_spec_for_facts) + + module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + + api_call_object = "updatable-object" + api_call_object_plural_version = "updatable-objects" + + result = api_call_facts(module, api_call_object, api_call_object_plural_version) + module.exit_json(ansible_facts=result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_update_provisioned_satellites.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_update_provisioned_satellites.py index 5202c95b5..326e289a7 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_update_provisioned_satellites.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_update_provisioned_satellites.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -59,13 +61,14 @@ cp_mgmt_update_provisioned_satellites: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): - argument_spec = dict( - vpn_center_gateways=dict(type='list', elements='str') - ) + argument_spec = dict(vpn_center_gateways=dict(type="list", elements="str")) argument_spec.update(checkpoint_argument_spec_for_commands) module = AnsibleModule(argument_spec=argument_spec) @@ -76,5 +79,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_update_updatable_objects_repository_content.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_update_updatable_objects_repository_content.py new file mode 100644 index 000000000..315f6af95 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_update_updatable_objects_repository_content.py @@ -0,0 +1,71 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_update_updatable_objects_repository_content +short_description: Updates the content of the Updatable Objects repository from the Check Point User Center. +description: + - Updates the content of the Updatable Objects repository from the Check Point User Center. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: {} +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: update-updatable-objects-repository-content + cp_mgmt_update_updatable_objects_repository_content: +""" + +RETURN = """ +cp_mgmt_update_updatable_objects_repository_content: + description: The checkpoint update-updatable-objects-repository-content output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "update-updatable-objects-repository-content" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_user_group.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_user_group.py new file mode 100644 index 000000000..591645d61 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_user_group.py @@ -0,0 +1,149 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_user_group +short_description: Manages user-group objects on Checkpoint over Web Services API +description: + - Manages user-group objects on Checkpoint devices including creating, updating and removing objects. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + name: + description: + - Object name. + type: str + required: True + email: + description: + - Email Address. + type: str + members: + description: + - Collection of User Group objects identified by the name or UID. + type: list + elements: str + tags: + description: + - Collection of tag identifiers. + type: list + elements: str + color: + description: + - Color of the object. Should be one of existing colors. + type: str + choices: ['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green', + 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', + 'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', 'yellow'] + comments: + description: + - Comments string. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + groups: + description: + - Collection of group identifiers. + type: list + elements: str + ignore_warnings: + description: + - Apply changes ignoring warnings. + type: bool + ignore_errors: + description: + - Apply changes ignoring errors. You won't be able to publish such a changes. If ignore-warnings flag was omitted - warnings will also be ignored. + type: bool +extends_documentation_fragment: check_point.mgmt.checkpoint_objects +""" + +EXAMPLES = """ +- name: add-user-group + cp_mgmt_user_group: + email: myusergroup@email.com + members: + - myuser + name: myusergroup + state: present + +- name: set-user-group + cp_mgmt_user_group: + email: myusergroup123@email.com + name: myusergroup + state: present + +- name: delete-user-group + cp_mgmt_user_group: + name: myusergroup + state: absent +""" + +RETURN = """ +cp_mgmt_user_group: + description: The checkpoint object created or updated. + returned: always, except when deleting the object. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call + + +def main(): + argument_spec = dict( + name=dict(type='str', required=True), + email=dict(type='str'), + members=dict(type='list', elements='str'), + tags=dict(type='list', elements='str'), + color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', + 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', + 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', + 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', + 'yellow']), + comments=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + groups=dict(type='list', elements='str'), + ignore_warnings=dict(type='bool'), + ignore_errors=dict(type='bool') + ) + argument_spec.update(checkpoint_argument_spec_for_objects) + + module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + api_call_object = 'user-group' + + result = api_call(module, api_call_object) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_user_group_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_user_group_facts.py new file mode 100644 index 000000000..97af74777 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_user_group_facts.py @@ -0,0 +1,149 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_user_group_facts +short_description: Get user-group objects facts on Checkpoint over Web Services API +description: + - Get user-group objects facts on Checkpoint devices. + - All operations are performed over Web Services API. + - This module handles both operations, get a specific object and get several objects, + For getting a specific object use the parameter 'name'. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + name: + description: + - Object name. + This parameter is relevant only for getting a specific object. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + filter: + description: + - Search expression to filter objects by. The provided text should be exactly the same as it would be given in SmartConsole Object Explorer. The + logical operators in the expression ('AND', 'OR') should be provided in capital letters. The search involves both a IP search and a textual search in + name, comment, tags etc. + type: str + limit: + description: + - The maximal number of returned results. + This parameter is relevant only for getting few objects. + type: int + offset: + description: + - Number of the results to initially skip. + This parameter is relevant only for getting few objects. + type: int + order: + description: + - Sorts the results by search criteria. Automatically sorts the results by Name, in the ascending order. + This parameter is relevant only for getting few objects. + type: list + elements: dict + suboptions: + ASC: + description: + - Sorts results by the given field in ascending order. + type: str + choices: ['name'] + DESC: + description: + - Sorts results by the given field in descending order. + type: str + choices: ['name'] + dereference_group_members: + description: + - Indicates whether to dereference "members" field by details level for every object in reply. + type: bool + show_membership: + description: + - Indicates whether to calculate and show "groups" field for every object in reply. + type: bool + domains_to_process: + description: + - Indicates which domains to process the commands on. It cannot be used with the details-level full, must be run from the System Domain only and + with ignore-warnings true. Valid values are, CURRENT_DOMAIN, ALL_DOMAINS_ON_THIS_SERVER. + type: list + elements: str +extends_documentation_fragment: check_point.mgmt.checkpoint_facts +""" + +EXAMPLES = """ +- name: show-user-group + cp_mgmt_user_group_facts: + name: myusergroup + +- name: show-user-groups + cp_mgmt_user_group_facts: + details_level: full +""" + +RETURN = """ +ansible_facts: + description: The checkpoint object facts. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts + + +def main(): + argument_spec = dict( + name=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + filter=dict(type='str'), + limit=dict(type='int'), + offset=dict(type='int'), + order=dict(type='list', elements='dict', options=dict( + ASC=dict(type='str', choices=['name']), + DESC=dict(type='str', choices=['name']) + )), + dereference_group_members=dict(type='bool'), + show_membership=dict(type='bool'), + domains_to_process=dict(type='list', elements='str') + ) + argument_spec.update(checkpoint_argument_spec_for_facts) + + module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + + api_call_object = "user-group" + api_call_object_plural_version = "user-groups" + + result = api_call_facts(module, api_call_object, api_call_object_plural_version) + module.exit_json(ansible_facts=result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_verify_policy.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_verify_policy.py index 77a4fc6eb..d9fdfb941 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_verify_policy.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_verify_policy.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -56,13 +58,14 @@ cp_mgmt_verify_policy: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): - argument_spec = dict( - policy_package=dict(type='str') - ) + argument_spec = dict(policy_package=dict(type="str")) argument_spec.update(checkpoint_argument_spec_for_commands) module = AnsibleModule(argument_spec=argument_spec) @@ -73,5 +76,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_verify_software_package.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_verify_software_package.py index 8f1d83816..de7d2155d 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_verify_software_package.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_verify_software_package.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -79,16 +81,21 @@ cp_mgmt_verify_software_package: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_commands, + api_command, +) def main(): argument_spec = dict( - name=dict(type='str'), - targets=dict(type='list', elements='str'), - concurrency_limit=dict(type='int'), - download_package=dict(type='bool'), - download_package_from=dict(type='str', choices=['automatic', 'central', 'target-machine']) + name=dict(type="str"), + targets=dict(type="list", elements="str"), + concurrency_limit=dict(type="int"), + download_package=dict(type="bool"), + download_package_from=dict( + type="str", choices=["automatic", "central", "target-machine"] + ), ) argument_spec.update(checkpoint_argument_spec_for_commands) @@ -100,5 +107,5 @@ def main(): module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_vpn_community_meshed.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_vpn_community_meshed.py index 8ccc016e4..b4b043843 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_vpn_community_meshed.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_vpn_community_meshed.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -184,49 +186,149 @@ cp_mgmt_vpn_community_meshed: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - encryption_method=dict(type='str', choices=['prefer ikev2 but support ikev1', 'ikev2 only', 'ikev1 for ipv4 and ikev2 for ipv6 only']), - encryption_suite=dict(type='str', choices=['suite-b-gcm-256', 'custom', 'vpn b', 'vpn a', 'suite-b-gcm-128']), - gateways=dict(type='list', elements='str'), - ike_phase_1=dict(type='dict', options=dict( - data_integrity=dict(type='str', choices=['aes-xcbc', 'sha1', 'sha256', 'sha384', 'md5']), - diffie_hellman_group=dict(type='str', choices=['group-1', 'group-2', 'group-5', 'group-14', 'group-19', 'group-20']), - encryption_algorithm=dict(type='str', choices=['cast', 'aes-256', 'des', 'aes-128', '3des']) - )), - ike_phase_2=dict(type='dict', options=dict( - data_integrity=dict(type='str', choices=['aes-xcbc', 'sha1', 'sha256', 'sha384', 'md5']), - encryption_algorithm=dict(type='str', choices=['cast', 'aes-gcm-256', 'cast-40', - 'aes-256', 'des', 'aes-128', '3des', 'des-40cp', 'aes-gcm-128', 'none']) - )), - shared_secrets=dict(type='list', elements='dict', no_log=True, options=dict( - external_gateway=dict(type='str'), - shared_secret=dict(type='str', no_log=True) - )), - tags=dict(type='list', elements='str'), - use_shared_secret=dict(type='bool'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + encryption_method=dict( + type="str", + choices=[ + "prefer ikev2 but support ikev1", + "ikev2 only", + "ikev1 for ipv4 and ikev2 for ipv6 only", + ], + ), + encryption_suite=dict( + type="str", + choices=[ + "suite-b-gcm-256", + "custom", + "vpn b", + "vpn a", + "suite-b-gcm-128", + ], + ), + gateways=dict(type="list", elements="str"), + ike_phase_1=dict( + type="dict", + options=dict( + data_integrity=dict( + type="str", + choices=["aes-xcbc", "sha1", "sha256", "sha384", "md5"], + ), + diffie_hellman_group=dict( + type="str", + choices=[ + "group-1", + "group-2", + "group-5", + "group-14", + "group-19", + "group-20", + ], + ), + encryption_algorithm=dict( + type="str", + choices=["cast", "aes-256", "des", "aes-128", "3des"], + ), + ), + ), + ike_phase_2=dict( + type="dict", + options=dict( + data_integrity=dict( + type="str", + choices=["aes-xcbc", "sha1", "sha256", "sha384", "md5"], + ), + encryption_algorithm=dict( + type="str", + choices=[ + "cast", + "aes-gcm-256", + "cast-40", + "aes-256", + "des", + "aes-128", + "3des", + "des-40cp", + "aes-gcm-128", + "none", + ], + ), + ), + ), + shared_secrets=dict( + type="list", + elements="dict", + no_log=True, + options=dict( + external_gateway=dict(type="str"), + shared_secret=dict(type="str", no_log=True), + ), + ), + tags=dict(type="list", elements="str"), + use_shared_secret=dict(type="bool"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'vpn-community-meshed' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "vpn-community-meshed" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_vpn_community_meshed_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_vpn_community_meshed_facts.py index 9ea3882a7..43357f8a1 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_vpn_community_meshed_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_vpn_community_meshed_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -98,30 +100,41 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )) + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "vpn-community-meshed" api_call_object_plural_version = "vpn-communities-meshed" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_vpn_community_remote_access_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_vpn_community_remote_access_facts.py new file mode 100644 index 000000000..78da989b7 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_vpn_community_remote_access_facts.py @@ -0,0 +1,138 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_vpn_community_remote_access_facts +short_description: Get vpn-community-remote-access objects facts on Checkpoint over Web Services API +description: + - Get vpn-community-remote-access objects facts on Checkpoint devices. + - All operations are performed over Web Services API. + - This module handles both operations, get a specific object and get several objects, + For getting a specific object use the parameter 'name'. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + name: + description: + - Object name. + This parameter is relevant only for getting a specific object. + type: str + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + filter: + description: + - Search expression to filter objects by. The provided text should be exactly the same as it would be given in SmartConsole Object Explorer. The + logical operators in the expression ('AND', 'OR') should be provided in capital letters. The search involves both a IP search and a textual search in + name, comment, tags etc. + type: str + limit: + description: + - The maximal number of returned results. + This parameter is relevant only for getting few objects. + type: int + offset: + description: + - Number of the results to initially skip. + This parameter is relevant only for getting few objects. + type: int + order: + description: + - Sorts the results by search criteria. Automatically sorts the results by Name, in the ascending order. + This parameter is relevant only for getting few objects. + type: list + elements: dict + suboptions: + ASC: + description: + - Sorts results by the given field in ascending order. + type: str + choices: ['name'] + DESC: + description: + - Sorts results by the given field in descending order. + type: str + choices: ['name'] + domains_to_process: + description: + - Indicates which domains to process the commands on. It cannot be used with the details-level full, must be run from the System Domain only and + with ignore-warnings true. Valid values are, CURRENT_DOMAIN, ALL_DOMAINS_ON_THIS_SERVER. + type: list + elements: str +extends_documentation_fragment: check_point.mgmt.checkpoint_facts +""" + +EXAMPLES = """ +- name: show-vpn-community-remote-access + cp_mgmt_vpn_community_remote_access_facts: + name: RemoteAccess + +- name: show-vpn-communities-remote-access + cp_mgmt_vpn_community_remote_access_facts: +""" + +RETURN = """ +ansible_facts: + description: The checkpoint object facts. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts + + +def main(): + argument_spec = dict( + name=dict(type='str'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + filter=dict(type='str'), + limit=dict(type='int'), + offset=dict(type='int'), + order=dict(type='list', elements='dict', options=dict( + ASC=dict(type='str', choices=['name']), + DESC=dict(type='str', choices=['name']) + )), + domains_to_process=dict(type='list', elements='str') + ) + argument_spec.update(checkpoint_argument_spec_for_facts) + + module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + + api_call_object = "vpn-community-remote-access" + api_call_object_plural_version = "vpn-communities-remote-access" + + result = api_call_facts(module, api_call_object, api_call_object_plural_version) + module.exit_json(ansible_facts=result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_vpn_community_star.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_vpn_community_star.py index 0073a60de..a5a1030bf 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_vpn_community_star.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_vpn_community_star.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -42,7 +44,7 @@ options: required: True center_gateways: description: - - Collection of Gateway objects representing center gateways identified by the name or UID. + - Collection of center VPN Gateway and VPN Device objects identified by the name or UID. type: list elements: str encryption_method: @@ -55,6 +57,93 @@ options: - The encryption suite to be used. type: str choices: ['suite-b-gcm-256', 'custom', 'vpn b', 'vpn a', 'suite-b-gcm-128'] + granular_encryptions: + description: + - VPN granular encryption settings. + type: list + elements: dict + version_added: "5.1.0" + suboptions: + internal_gateway: + description: + - Internally managed Check Point gateway identified by name or UID, or 'Any' for all internal-gateways participants in this community. + type: str + external_gateway: + description: + - Externally managed or 3rd party gateway identified by name or UID. + type: str + encryption_method: + description: + - The encryption method to be used. + type: str + choices: ['prefer ikev2 but support ikev1', 'ikev2 only', 'ikev1 for ipv4 and ikev2 for ipv6 only'] + encryption_suite: + description: + - The encryption suite to be used. + type: str + choices: ['suite-b-gcm-256', 'custom', 'vpn b', 'vpn a', 'suite-b-gcm-128'] + ike_phase_1: + description: + - Ike Phase 1 settings. Only applicable when the encryption-suite is set to [custom]. + type: dict + suboptions: + encryption_algorithm: + description: + - The encryption algorithm to be used. + type: str + choices: ['cast', 'aes-256', 'des', 'aes-128', '3des'] + data_integrity: + description: + - The hash algorithm to be used. + type: str + choices: ['aes-xcbc', 'sha1', 'sha256', 'sha384', 'sha512', 'md5'] + diffie_hellman_group: + description: + - The Diffie-Hellman group to be used. + type: str + choices: ['group-1', 'group-2', 'group-5', 'group-14', 'group-15', 'group-16', 'group-17', 'group-18', 'group-19', 'group-20', 'group-24'] + ike_p1_rekey_time: + description: + - Indicates the time interval for IKE phase 1 renegotiation. + type: int + ike_p1_rekey_time_unit: + description: + - Indicates the time unit for [ike-p1-rekey-time-unit] parameter, rounded up to minutes scale. + type: str + choices: ['days', 'hours', 'minutes', 'seconds'] + ike_phase_2: + description: + - Ike Phase 2 settings. Only applicable when the encryption-suite is set to [custom]. + type: dict + suboptions: + encryption_algorithm: + description: + - The encryption algorithm to be used. + type: str + choices: ['cast', 'aes-gcm-256', 'cast-40', 'aes-256', 'des', 'aes-128', '3des', 'des-40cp', 'aes-gcm-128', 'none'] + data_integrity: + description: + - The hash algorithm to be used. + type: str + choices: ['aes-xcbc', 'sha1', 'sha256', 'sha384', 'sha512', 'md5'] + ike_p2_use_pfs: + description: + - Indicates whether Perfect Forward Secrecy (PFS) is being used for IKE phase 2. + type: bool + ike_p2_pfs_dh_grp: + description: + - The Diffie-Hellman group to be used. + type: str + choices: ['group-1', 'group-2', 'group-5', 'group-14', 'group-15', 'group-16', 'group-17', 'group-18', 'group-19', 'group-20', 'group-24'] + ike_p2_rekey_time: + description: + - Indicates the time interval for IKE phase 2 renegotiation. + type: int + ike_p2_rekey_time_unit: + description: + - Indicates the time unit for [ike-p2-rekey-time-unit] parameter. + type: str + choices: ['days', 'hours', 'minutes', 'seconds'] ike_phase_1: description: - Ike Phase 1 settings. Only applicable when the encryption-suite is set to [custom]. @@ -75,6 +164,17 @@ options: - The encryption algorithm to be used. type: str choices: ['cast', 'aes-256', 'des', 'aes-128', '3des'] + ike_p1_rekey_time: + description: + - Indicates the time interval for IKE phase 1 renegotiation. + type: int + version_added: "5.1.0" + ike_p1_rekey_time_unit: + description: + - Indicates the time unit for [ike-p1-rekey-time-unit] parameter, rounded up to minutes scale. + type: str + choices: ['days', 'hours', 'minutes', 'seconds'] + version_added: "5.1.0" ike_phase_2: description: - Ike Phase 2 settings. Only applicable when the encryption-suite is set to [custom]. @@ -90,10 +190,47 @@ options: - The encryption algorithm to be used. type: str choices: ['cast', 'aes-gcm-256', 'cast-40', 'aes-256', 'des', 'aes-128', '3des', 'des-40cp', 'aes-gcm-128', 'none'] + ike_p2_use_pfs: + description: + - Indicates whether Perfect Forward Secrecy (PFS) is being used for IKE phase 2. + type: bool + version_added: "5.1.0" + ike_p2_pfs_dh_grp: + description: + - The Diffie-Hellman group to be used. + type: str + choices: ['group-1', 'group-2', 'group-5', 'group-14', 'group-15', 'group-16', 'group-17', 'group-18', 'group-19', 'group-20', 'group-24'] + version_added: "5.1.0" + ike_p2_rekey_time: + description: + - Indicates the time interval for IKE phase 2 renegotiation. + type: int + version_added: "5.1.0" + ike_p2_rekey_time_unit: + description: + - Indicates the time unit for [ike-p2-rekey-time-unit] parameter. + type: str + choices: ['days', 'hours', 'minutes', 'seconds'] + version_added: "5.1.0" mesh_center_gateways: description: - Indicates whether the meshed community is in center. type: bool + override_vpn_domains: + description: + - The Overrides VPN Domains of the participants GWs. + type: list + elements: dict + version_added: "5.1.0" + suboptions: + gateway: + description: + - Participant gateway in override VPN domain identified by the name or UID. + type: str + vpn_domain: + description: + - VPN domain network identified by the name or UID. + type: str satellite_gateways: description: - Collection of Gateway objects representing satellite gateways identified by the name or UID. @@ -118,6 +255,12 @@ options: - Collection of tag identifiers. type: list elements: str + tunnel_granularity: + description: + - VPN tunnel sharing option to be used. + type: str + choices: ['per_host', 'per_subnet', 'universal'] + version_added: "5.1.0" use_shared_secret: description: - Indicates whether the shared secret should be used for all external gateways. @@ -194,51 +337,194 @@ cp_mgmt_vpn_community_star: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - center_gateways=dict(type='list', elements='str'), - encryption_method=dict(type='str', choices=['prefer ikev2 but support ikev1', 'ikev2 only', 'ikev1 for ipv4 and ikev2 for ipv6 only']), - encryption_suite=dict(type='str', choices=['suite-b-gcm-256', 'custom', 'vpn b', 'vpn a', 'suite-b-gcm-128']), - ike_phase_1=dict(type='dict', options=dict( - data_integrity=dict(type='str', choices=['aes-xcbc', 'sha1', 'sha256', 'sha384', 'md5']), - diffie_hellman_group=dict(type='str', choices=['group-1', 'group-2', 'group-5', 'group-14', 'group-19', 'group-20']), - encryption_algorithm=dict(type='str', choices=['cast', 'aes-256', 'des', 'aes-128', '3des']) - )), - ike_phase_2=dict(type='dict', options=dict( - data_integrity=dict(type='str', choices=['aes-xcbc', 'sha1', 'sha256', 'sha384', 'md5']), - encryption_algorithm=dict(type='str', choices=['cast', 'aes-gcm-256', 'cast-40', - 'aes-256', 'des', 'aes-128', '3des', 'des-40cp', 'aes-gcm-128', 'none']) - )), - mesh_center_gateways=dict(type='bool'), - satellite_gateways=dict(type='list', elements='str'), - shared_secrets=dict(type='list', elements='dict', no_log=True, options=dict( + name=dict(type="str", required=True), + center_gateways=dict(type="list", elements="str"), + encryption_method=dict( + type="str", + choices=[ + "prefer ikev2 but support ikev1", + "ikev2 only", + "ikev1 for ipv4 and ikev2 for ipv6 only", + ], + ), + encryption_suite=dict( + type="str", + choices=[ + "suite-b-gcm-256", + "custom", + "vpn b", + "vpn a", + "suite-b-gcm-128", + ], + ), + granular_encryptions=dict(type='list', elements="dict", options=dict( + internal_gateway=dict(type='str'), external_gateway=dict(type='str'), - shared_secret=dict(type='str', no_log=True) + encryption_method=dict(type='str', choices=['prefer ikev2 but support ikev1', 'ikev2 only', + 'ikev1 for ipv4 and ikev2 for ipv6 only']), + encryption_suite=dict(type='str', + choices=['suite-b-gcm-256', 'custom', 'vpn b', 'vpn a', 'suite-b-gcm-128']), + ike_phase_1=dict(type='dict', options=dict( + encryption_algorithm=dict(type='str', choices=['cast', 'aes-256', 'des', 'aes-128', '3des']), + data_integrity=dict(type='str', choices=['aes-xcbc', 'sha1', 'sha256', 'sha384', 'sha512', 'md5']), + diffie_hellman_group=dict(type='str', choices=['group-1', 'group-2', 'group-5', + 'group-14', 'group-15', 'group-16', 'group-17', + 'group-18', 'group-19', 'group-20', + 'group-24']), + ike_p1_rekey_time=dict(type='int', no_log=False), + ike_p1_rekey_time_unit=dict(type='str', choices=['days', 'hours', 'minutes', 'seconds']) + )), + ike_phase_2=dict(type='dict', options=dict( + encryption_algorithm=dict(type='str', choices=['cast', 'aes-gcm-256', 'cast-40', + 'aes-256', 'des', 'aes-128', '3des', 'des-40cp', + 'aes-gcm-128', 'none']), + data_integrity=dict(type='str', choices=['aes-xcbc', 'sha1', 'sha256', 'sha384', 'sha512', 'md5']), + ike_p2_use_pfs=dict(type='bool'), + ike_p2_pfs_dh_grp=dict(type='str', choices=['group-1', 'group-2', 'group-5', + 'group-14', 'group-15', 'group-16', 'group-17', 'group-18', + 'group-19', 'group-20', 'group-24']), + ike_p2_rekey_time=dict(type='int', no_log=False), + ike_p2_rekey_time_unit=dict(type='str', choices=['days', 'hours', 'minutes', 'seconds']), + )) )), - tags=dict(type='list', elements='str'), - use_shared_secret=dict(type='bool'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + ike_phase_1=dict( + type="dict", + options=dict( + data_integrity=dict( + type="str", + choices=["aes-xcbc", "sha1", "sha256", "sha384", "md5"], + ), + diffie_hellman_group=dict( + type="str", + choices=[ + "group-1", + "group-2", + "group-5", + "group-14", + "group-19", + "group-20", + ], + ), + encryption_algorithm=dict( + type="str", + choices=["cast", "aes-256", "des", "aes-128", "3des"], + ), + ike_p1_rekey_time=dict(type='int', no_log=False), + ike_p1_rekey_time_unit=dict(type='str', choices=['days', 'hours', 'minutes', 'seconds']), + ), + ), + ike_phase_2=dict( + type="dict", + options=dict( + data_integrity=dict( + type="str", + choices=["aes-xcbc", "sha1", "sha256", "sha384", "md5"], + ), + encryption_algorithm=dict( + type="str", + choices=[ + "cast", + "aes-gcm-256", + "cast-40", + "aes-256", + "des", + "aes-128", + "3des", + "des-40cp", + "aes-gcm-128", + "none", + ], + ), + ike_p2_use_pfs=dict(type='bool'), + ike_p2_pfs_dh_grp=dict(type='str', choices=['group-1', 'group-2', 'group-5', 'group-14', + 'group-15', 'group-16', 'group-17', 'group-18', 'group-19', + 'group-20', 'group-24']), + ike_p2_rekey_time=dict(type='int', no_log=False), + ike_p2_rekey_time_unit=dict(type='str', choices=['days', 'hours', 'minutes', 'seconds']), + ), + ), + mesh_center_gateways=dict(type="bool"), + override_vpn_domains=dict(type='list', elements="dict", options=dict( + gateway=dict(type='str'), + vpn_domain=dict(type='str') + )), + satellite_gateways=dict(type="list", elements="str"), + shared_secrets=dict( + type="list", + elements="dict", + no_log=True, + options=dict( + external_gateway=dict(type="str"), + shared_secret=dict(type="str", no_log=True), + ), + ), + tags=dict(type="list", elements="str"), + tunnel_granularity=dict(type='str', choices=['per_host', 'per_subnet', 'universal']), + use_shared_secret=dict(type="bool"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'vpn-community-star' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "vpn-community-star" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_vpn_community_star_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_vpn_community_star_facts.py index 09fbd90a6..845c11fc2 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_vpn_community_star_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_vpn_community_star_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -98,30 +100,41 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )) + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "vpn-community-star" api_call_object_plural_version = "vpn-communities-star" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_vsx_run_operation.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_vsx_run_operation.py new file mode 100644 index 000000000..15db77ea1 --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_vsx_run_operation.py @@ -0,0 +1,242 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_vsx_run_operation +short_description: Run the VSX operation by its name and parameters. +description: + - Run the VSX operation by its name and parameters. + - An automatic session publish is part of all the operations in this API. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + operation: + description: + - The name of the operation to run. Each operation has its specific parameters.<br>The available operations are,<ul><li><i>upgrade</i> - + Upgrades the VSX Gateway or VSX Cluster object to a higher version</li><li><i>downgrade</i> - Downgrades the VSX Gateway or VSX Cluster object to a + lower version</li><li><i>add-member</i> - Adds a new VSX Cluster member object</li><li><i>remove-member</i> - Removes a VSX Cluster member + object</li><li><i>reconf-gw</i> - Reconfigures a VSX Gateway after a clean install</li><li><i>reconf-member</i> - Reconfigures a VSX Cluster member + after a clean install</li></ul>. + type: str + choices: ['upgrade', 'downgrade', 'add-member', 'remove-member', 'reconf-gw', 'reconf-member'] + add_member_params: + description: + - Parameters for the operation to add a VSX Cluster member. + type: dict + suboptions: + ipv4_address: + description: + - The IPv4 address of the management interface of the VSX Cluster member. + type: str + ipv4_sync_address: + description: + - The IPv4 address of the sync interface of the VSX Cluster member. + type: str + member_name: + description: + - Name of the new VSX Cluster member object. + type: str + vsx_name: + description: + - Name of the VSX Cluster object. + type: str + vsx_uid: + description: + - UID of the VSX Cluster object. + type: str + downgrade_params: + description: + - Parameters for the operation to downgrade a VSX Gateway or VSX Cluster object to a lower version.<br>In case the current version is already + the target version, or is lower than the target version, no change is done. + type: dict + suboptions: + target_version: + description: + - The target version. + type: str + vsx_name: + description: + - Name of the VSX Gateway or VSX Cluster object. + type: str + vsx_uid: + description: + - UID of the VSX Gateway or VSX Cluster object. + type: str + reconf_gw_params: + description: + - Parameters for the operation to reconfigure a VSX Gateway after a clean install. + type: dict + suboptions: + ipv4_corexl_number: + description: + - Number of IPv4 CoreXL Firewall instances on the target VSX Gateway.<br>Valid values,<br><ul><li>To configure CoreXL Firewall + instances, enter an integer greater or equal to 2.</li><li>To disable CoreXL, enter 1.</li></ul>. + type: int + one_time_password: + description: + - A password required for establishing a Secure Internal Communication (SIC). Enter the same password you used during the First Time + Configuration Wizard on the target VSX Gateway. + type: str + vsx_name: + description: + - Name of the VSX Gateway object. + type: str + vsx_uid: + description: + - UID of the VSX Gateway object. + type: str + reconf_member_params: + description: + - Parameters for the operation to reconfigure a VSX Cluster member after a clean install. + type: dict + suboptions: + ipv4_corexl_number: + description: + - Number of IPv4 CoreXL Firewall instances on the target VSX Cluster member.<br>Valid values,<br><ul><li>To configure CoreXL Firewall + instances, enter an integer greater or equal to 2.</li><li>To disable CoreXL, enter 1.</li></ul>Important - The CoreXL configuration must be the + same on all the cluster members. + type: int + member_uid: + description: + - UID of the VSX Cluster member object. + type: str + member_name: + description: + - Name of the VSX Cluster member object. + type: str + one_time_password: + description: + - A password required for establishing a Secure Internal Communication (SIC). Enter the same password you used during the First Time + Configuration Wizard on the target VSX Cluster member. + type: str + remove_member_params: + description: + - Parameters for the operation to remove a VSX Cluster member object. + type: dict + suboptions: + member_uid: + description: + - UID of the VSX Cluster member object. + type: str + member_name: + description: + - Name of the VSX Cluster member object. + type: str + upgrade_params: + description: + - Parameters for the operation to upgrade a VSX Gateway or VSX Cluster object to a higher version.<br>In case the current version is already the + target version, or is higher than the target version, no change is done. + type: dict + suboptions: + target_version: + description: + - The target version. + type: str + vsx_name: + description: + - Name of the VSX Gateway or VSX Cluster object. + type: str + vsx_uid: + description: + - UID of the VSX Gateway or VSX Cluster object. + type: str +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: vsx-run-operation + cp_mgmt_vsx_run_operation: + add_member_params: + ipv4_address: 25.25.25.223 + ipv4_sync_address: 20.20.20.223 + member_name: Mem3 + vsx_name: VSX_CLUSTER + operation: add-member +""" + +RETURN = """ +cp_mgmt_vsx_run_operation: + description: The checkpoint vsx-run-operation output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + operation=dict(type='str', choices=['upgrade', 'downgrade', 'add-member', 'remove-member', 'reconf-gw', 'reconf-member']), + add_member_params=dict(type='dict', options=dict( + ipv4_address=dict(type='str'), + ipv4_sync_address=dict(type='str'), + member_name=dict(type='str'), + vsx_name=dict(type='str'), + vsx_uid=dict(type='str') + )), + downgrade_params=dict(type='dict', options=dict( + target_version=dict(type='str'), + vsx_name=dict(type='str'), + vsx_uid=dict(type='str') + )), + reconf_gw_params=dict(type='dict', options=dict( + ipv4_corexl_number=dict(type='int'), + one_time_password=dict(type='str', no_log=True), + vsx_name=dict(type='str'), + vsx_uid=dict(type='str') + )), + reconf_member_params=dict(type='dict', options=dict( + ipv4_corexl_number=dict(type='int'), + member_uid=dict(type='str'), + member_name=dict(type='str'), + one_time_password=dict(type='str', no_log=True) + )), + remove_member_params=dict(type='dict', options=dict( + member_uid=dict(type='str'), + member_name=dict(type='str') + )), + upgrade_params=dict(type='dict', options=dict( + target_version=dict(type='str'), + vsx_name=dict(type='str'), + vsx_uid=dict(type='str') + )) + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "vsx-run-operation" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_where_used.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_where_used.py new file mode 100644 index 000000000..e2609fdfc --- /dev/null +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_where_used.py @@ -0,0 +1,116 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Ansible module to manage CheckPoint Firewall (c) 2019 +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = """ +--- +module: cp_mgmt_where_used +short_description: Searches for usage of the target object in other objects and rules. +description: + - Searches for usage of the target object in other objects and rules. + - All operations are performed over Web Services API. +version_added: "5.0.0" +author: "Eden Brillant (@chkp-edenbr)" +options: + name: + description: + - Object name. + type: str + dereference_group_members: + description: + - Indicates whether to dereference "members" field by details level for every object in reply. + type: bool + show_membership: + description: + - Indicates whether to calculate and show "groups" field for every object in reply. + type: bool + async_response: + description: + - Run command in asynchronous mode and return task UID. Use show-task command to check the progress of the task. + type: bool + details_level: + description: + - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed + representation of the object. + type: str + choices: ['uid', 'standard', 'full'] + domains_to_process: + description: + - Indicates which domains to process the commands on. It cannot be used with the details-level full, must be run from the System Domain only and + with ignore-warnings true. Valid values are, CURRENT_DOMAIN, ALL_DOMAINS_ON_THIS_SERVER. + type: list + elements: str + indirect: + description: + - Search for indirect usage. + type: bool + indirect_max_depth: + description: + - Maximum nesting level during indirect usage search. + type: int +extends_documentation_fragment: check_point.mgmt.checkpoint_commands +""" + +EXAMPLES = """ +- name: where-used + cp_mgmt_where_used: + name: Host 1 +""" + +RETURN = """ +cp_mgmt_where_used: + description: The checkpoint where-used output. + returned: always. + type: dict +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command + + +def main(): + argument_spec = dict( + name=dict(type='str'), + dereference_group_members=dict(type='bool'), + show_membership=dict(type='bool'), + async_response=dict(type='bool'), + details_level=dict(type='str', choices=['uid', 'standard', 'full']), + domains_to_process=dict(type='list', elements='str'), + indirect=dict(type='bool'), + indirect_max_depth=dict(type='int') + ) + argument_spec.update(checkpoint_argument_spec_for_commands) + + module = AnsibleModule(argument_spec=argument_spec) + + command = "where-used" + + result = api_command(module, command) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_wildcard.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_wildcard.py index 54739fdfe..24eb2204f 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_wildcard.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_wildcard.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -124,36 +126,77 @@ cp_mgmt_wildcard: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_objects, + api_call, +) def main(): argument_spec = dict( - name=dict(type='str', required=True), - ipv4_address=dict(type='str'), - ipv4_mask_wildcard=dict(type='str'), - ipv6_address=dict(type='str'), - ipv6_mask_wildcard=dict(type='str'), - tags=dict(type='list', elements='str'), - color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', - 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', - 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', - 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', - 'yellow']), - comments=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - groups=dict(type='list', elements='str'), - ignore_warnings=dict(type='bool'), - ignore_errors=dict(type='bool') + name=dict(type="str", required=True), + ipv4_address=dict(type="str"), + ipv4_mask_wildcard=dict(type="str"), + ipv6_address=dict(type="str"), + ipv6_mask_wildcard=dict(type="str"), + tags=dict(type="list", elements="str"), + color=dict( + type="str", + choices=[ + "aquamarine", + "black", + "blue", + "crete blue", + "burlywood", + "cyan", + "dark green", + "khaki", + "orchid", + "dark orange", + "dark sea green", + "pink", + "turquoise", + "dark blue", + "firebrick", + "brown", + "forest green", + "gold", + "dark gold", + "gray", + "dark gray", + "light green", + "lemon chiffon", + "coral", + "sea green", + "sky blue", + "magenta", + "purple", + "slate blue", + "violet red", + "navy blue", + "olive", + "orange", + "red", + "sienna", + "yellow", + ], + ), + comments=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + groups=dict(type="list", elements="str"), + ignore_warnings=dict(type="bool"), + ignore_errors=dict(type="bool"), ) argument_spec.update(checkpoint_argument_spec_for_objects) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - api_call_object = 'wildcard' + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + api_call_object = "wildcard" result = api_call(module, api_call_object) module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_wildcard_facts.py b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_wildcard_facts.py index 474776b4f..cad95ce62 100644 --- a/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_wildcard_facts.py +++ b/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_wildcard_facts.py @@ -17,13 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} DOCUMENTATION = """ --- @@ -98,30 +100,41 @@ ansible_facts: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( + checkpoint_argument_spec_for_facts, + api_call_facts, +) def main(): argument_spec = dict( - name=dict(type='str'), - details_level=dict(type='str', choices=['uid', 'standard', 'full']), - limit=dict(type='int'), - offset=dict(type='int'), - order=dict(type='list', elements='dict', options=dict( - ASC=dict(type='str', choices=['name']), - DESC=dict(type='str', choices=['name']) - )) + name=dict(type="str"), + details_level=dict(type="str", choices=["uid", "standard", "full"]), + limit=dict(type="int"), + offset=dict(type="int"), + order=dict( + type="list", + elements="dict", + options=dict( + ASC=dict(type="str", choices=["name"]), + DESC=dict(type="str", choices=["name"]), + ), + ), ) argument_spec.update(checkpoint_argument_spec_for_facts) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) api_call_object = "wildcard" api_call_object_plural_version = "wildcards" - result = api_call_facts(module, api_call_object, api_call_object_plural_version) + result = api_call_facts( + module, api_call_object, api_call_object_plural_version + ) module.exit_json(ansible_facts=result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ansible_collections/check_point/mgmt/tests/integration/target-prefixes_1.network b/ansible_collections/check_point/mgmt/tests/integration/target-prefixes_1.network new file mode 100644 index 000000000..97fd7d156 --- /dev/null +++ b/ansible_collections/check_point/mgmt/tests/integration/target-prefixes_1.network @@ -0,0 +1 @@ +cp_mgmt diff --git a/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_access_layers/default/main.yaml b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_access_layers/default/main.yaml new file mode 100644 index 000000000..10c0fabcb --- /dev/null +++ b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_access_layers/default/main.yaml @@ -0,0 +1,2 @@ +--- +testcase: '*' diff --git a/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_access_layers/meta/main.yaml b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_access_layers/meta/main.yaml new file mode 100644 index 000000000..23d65c7ef --- /dev/null +++ b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_access_layers/meta/main.yaml @@ -0,0 +1,2 @@ +--- +dependencies: [] diff --git a/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_access_layers/tasks/cli.yaml b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_access_layers/tasks/cli.yaml new file mode 100644 index 000000000..9dc383a2d --- /dev/null +++ b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_access_layers/tasks/cli.yaml @@ -0,0 +1,19 @@ +--- +- name: collect all cli test cases + find: + paths: '{{ role_path }}/tests/cli' + patterns: '{{ testcase }}.yaml' + register: test_cases + delegate_to: localhost + +- name: set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + +- name: Run test case (connection=ansible.netcommon.httpapi) + include: '{{ test_case_to_run }}' + vars: + ansible_connection: ansible.netcommon.httpapi + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: connection_httpapi diff --git a/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_access_layers/tasks/main.yaml b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_access_layers/tasks/main.yaml new file mode 100644 index 000000000..62cc1ae1e --- /dev/null +++ b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_access_layers/tasks/main.yaml @@ -0,0 +1,7 @@ +--- +- include: cli.yaml + tags: + - cli + +- include: redirection.yaml + when: ansible_version.full is version('2.10.0', '>=') diff --git a/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_access_layers/tasks/redirection.yaml b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_access_layers/tasks/redirection.yaml new file mode 100644 index 000000000..a57054c7d --- /dev/null +++ b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_access_layers/tasks/redirection.yaml @@ -0,0 +1,6 @@ +--- +- name: collect all cli test cases + find: + paths: '{{ role_path }}/tests/redirection' + patterns: '{{ testcase }}.yaml' + register: test_cases diff --git a/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_access_layers/tests/cli/_populate_config.yaml b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_access_layers/tests/cli/_populate_config.yaml new file mode 100644 index 000000000..2bdc1037b --- /dev/null +++ b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_access_layers/tests/cli/_populate_config.yaml @@ -0,0 +1,22 @@ +--- +- name: Populate CP MGMT access layer for tests + tags: merged + ibm.qradar.cp_mgmt_access_layers: &id001 + state: merged + config: + name: New Layer 1 + add_default_rule: true + applications_and_url_filtering: true + content_awareness: true + detect_using_x_forward_for: false + firewall: true + implicit_cleanup_action: drop + mobile_access: true + shared: false + tags: + - test_layer + color: aquamarine + comments: test description + details_level: full + ignore_warnings: false + ignore_errors: false diff --git a/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_access_layers/tests/cli/_remove_config.yaml b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_access_layers/tests/cli/_remove_config.yaml new file mode 100644 index 000000000..59f70367e --- /dev/null +++ b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_access_layers/tests/cli/_remove_config.yaml @@ -0,0 +1,6 @@ +--- +- name: Remove already configured CP MGMT access layer by Name + ibm.qradar.cp_mgmt_access_layers: + state: deleted + config: + name: "New Layer 1" diff --git a/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_access_layers/tests/cli/deleted.yaml b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_access_layers/tests/cli/deleted.yaml new file mode 100644 index 000000000..c77d48971 --- /dev/null +++ b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_access_layers/tests/cli/deleted.yaml @@ -0,0 +1,37 @@ +--- +- debug: + msg: Start Deleted integration state for cp_mgmt_access_layers ansible_connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate_config.yaml + +- block: + + - name: Delete attributes of provided configured CP Mgmt Access layers + register: result + ibm.qradar.cp_mgmt_access_layers: &id001 + config: + name: New Layer 1 + state: deleted + + - assert: + that: + - result.changed == true + - "{{ merged['after'] | symmetric_difference(result['cp_mgmt_access_layers']['before']) |\ + \ length == 4 }}" + - merged['before'] == result['cp_mgmt_access_layers']['after'] + + - name: Delete attributes of all configured CP Mgmt Access layers (IDEMPOTENT) + register: result + ibm.qradar.cp_mgmt_access_layers: *id001 + + - name: Assert that the previous delete task was idempotent + assert: + that: + - result.changed == false + + always: + + - include_tasks: _remove_config.yaml diff --git a/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_access_layers/tests/cli/gathered.yaml b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_access_layers/tests/cli/gathered.yaml new file mode 100644 index 000000000..9fded7dd4 --- /dev/null +++ b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_access_layers/tests/cli/gathered.yaml @@ -0,0 +1,26 @@ +--- +- debug: + msg: START cp_mgmt_access_layers gathered integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate_config.yaml + +- block: + + - name: Gather the provided configuration with the exisiting running configuration + register: result + ibm.qradar.cp_mgmt_access_layers: + config: + name: "New Layer 1" + state: gathered + + - assert: + that: + - "{{ merged['after'] | symmetric_difference(result['gathered']) |\ + \ length == 4 }}" + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml diff --git a/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_access_layers/tests/cli/merged.yaml b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_access_layers/tests/cli/merged.yaml new file mode 100644 index 000000000..de218e6fc --- /dev/null +++ b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_access_layers/tests/cli/merged.yaml @@ -0,0 +1,56 @@ +--- +- debug: + msg: START Merged cp_mgmt_access_layers state for integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- block: + + - name: Merge and Create CP Mgmt Access layers + tags: merged + register: result + ibm.qradar.cp_mgmt_access_layers: &id001 + state: merged + config: + name: New Layer 1 + add_default_rule: true + applications_and_url_filtering: true + content_awareness: true + detect_using_x_forward_for: false + firewall: true + implicit_cleanup_action: drop + mobile_access: true + shared: false + tags: + - test_layer + color: aquamarine + comments: test description + details_level: full + ignore_warnings: false + ignore_errors: false + + - name: Assert that task reports change and after dict is correctly generated + assert: + that: + - result['changed'] == true + - "{{ merged['after'] | symmetric_difference(result['cp_mgmt_access_layers']['after']) |\ + \ length == 4 }}" + + - name: Assert that before dicts are correctly generated + assert: + that: + - merged['before'] == result['cp_mgmt_access_layers']['before'] + + - name: Merge provided configuration with Log Sources Management (IDEMPOTENT) + register: result + ibm.qradar.cp_mgmt_access_layers: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + + always: + + - include_tasks: _remove_config.yaml diff --git a/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_access_layers/tests/cli/replaced.yaml b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_access_layers/tests/cli/replaced.yaml new file mode 100644 index 000000000..acbea2505 --- /dev/null +++ b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_access_layers/tests/cli/replaced.yaml @@ -0,0 +1,53 @@ +--- +- debug: + msg: START Replaced cp_mgmt_access_layers state for integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml +- include_tasks: _populate_config.yaml + +- block: + + - name: Replace existing CP Mgmt Access layers + register: result + ibm.qradar.cp_mgmt_access_layers: &id001 + state: replaced + config: + name: New Layer 1 + add_default_rule: true + applications_and_url_filtering: true + content_awareness: false + detect_using_x_forward_for: false + firewall: true + implicit_cleanup_action: drop + mobile_access: true + shared: true + tags: + - test_layer_replaced + color: cyan + comments: test REPLACE description + details_level: full + ignore_warnings: false + ignore_errors: false + + - assert: + that: + - result.changed == true + - "{{ merged['after'] | symmetric_difference(result['cp_mgmt_access_layers']['before']) |\ + \ length == 4 }}" + - "{{ replaced['after'] | symmetric_difference(result['cp_mgmt_access_layers']['after']) |\ + \ length == 4 }}" + + - name: Replaces device configuration of listed CP Mgmt Access layers with provided configuration + (IDEMPOTENT) + register: result + ibm.qradar.cp_mgmt_access_layers: *id001 + + - name: Assert that task was idempotent + assert: + that: + - result['changed'] == false + + always: + + - include_tasks: _remove_config.yaml diff --git a/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_access_layers/tests/cli/rtt.yaml b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_access_layers/tests/cli/rtt.yaml new file mode 100644 index 000000000..dc336348f --- /dev/null +++ b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_access_layers/tests/cli/rtt.yaml @@ -0,0 +1,81 @@ +--- +- debug: + msg: START cp_mgmt_access_layers round trip integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_log_sources_config.yaml + +- block: + + - name: Apply the provided configuration (base config) + register: base_config + ibm.qradar.cp_mgmt_access_layers: &id001 + state: merged + config: + name: New Layer 1 + add_default_rule: true + applications_and_url_filtering: true + content_awareness: true + detect_using_x_forward_for: false + firewall: true + implicit_cleanup_action: drop + mobile_access: true + shared: false + tags: + - test_layer + color: aquamarine + comments: test description + details_level: full + ignore_warnings: false + ignore_errors: false + + - name: Gather CP Mgmt Access layers facts + register: gather_result + ibm.qradar.cp_mgmt_access_layers: + config: + name: "New Layer 1" + state: gathered + + - name: Apply the configuration which need to be reverted + register: result + ibm.qradar.cp_mgmt_access_layers: + state: replaced + config: + name: New Layer 1 + add_default_rule: true + applications_and_url_filtering: true + content_awareness: false + detect_using_x_forward_for: false + firewall: true + implicit_cleanup_action: drop + mobile_access: true + shared: true + tags: + - test_layer_replaced + color: cyan + comments: test REPLACE description + details_level: full + ignore_warnings: false + ignore_errors: false + + - assert: + that: + - result.changed == true + - "{{ merged['before'] | symmetric_difference(result['cp_mgmt_access_layers']['before']) |\ + \ length == 1 }}" + - "{{ replaced['after'] | symmetric_difference(result['cp_mgmt_access_layers']['after']) |\ + \ length == 3 }}" + + - name: Revert back to base config using facts round trip + register: revert + ibm.qradar.cp_mgmt_access_layers: + config: "{{ gather_result['gathered'] }}" + state: replaced + + - assert: + that: + - revert['changed'] == true + + always: + + - include_tasks: _remove_config.yaml diff --git a/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_access_layers/vars/main.yaml b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_access_layers/vars/main.yaml new file mode 100644 index 000000000..7e7c63c52 --- /dev/null +++ b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_access_layers/vars/main.yaml @@ -0,0 +1,136 @@ +--- +merged: + before: [] + + after: + - auto_discovered: false + average_eps: 0 + coalesce_events: true + credibility: 5 + description: Snort IDS remote logs from rsyslog + enabled: true + gateway: false + group_ids: + - 0 + internal: false + language_id: 1 + last_event_time: 0 + log_source_extension_id: null + name: Snort logs + protocol_parameters: + - id: 1 + name: incomingPayloadEncoding + value: UTF-8 + - id: 0 + name: identifier + value: 192.0.2.1 + protocol_type_id: 0 + requires_deploy: true + status: + last_updated: 0 + messages: null + status: NA + store_event_payload: true + target_event_collector_id: 7 + type_id: 2 + wincollect_external_destination_ids: null + wincollect_internal_destination_id: null + - auto_discovered: false + average_eps: 0 + coalesce_events: true + credibility: 5 + description: Apache HTTP Server remote logs from rsyslog + enabled: true + gateway: false + group_ids: + - 0 + internal: false + language_id: 1 + last_event_time: 0 + log_source_extension_id: null + name: Apache HTTP Server logs + protocol_parameters: + - id: 1 + name: incomingPayloadEncoding + value: UTF-8 + - id: 0 + name: identifier + value: 198.51.100.1 + protocol_type_id: 0 + requires_deploy: true + status: + last_updated: 0 + messages: null + status: NA + store_event_payload: true + target_event_collector_id: 7 + type_id: 10 + wincollect_external_destination_ids: null + wincollect_internal_destination_id: null + +replaced: + after: + - auto_discovered: false + average_eps: 0 + coalesce_events: true + credibility: 5 + description: REPLACED Snort IDS remote logs from rsyslog + enabled: true + gateway: false + group_ids: + - 0 + internal: false + language_id: 1 + last_event_time: 0 + log_source_extension_id: null + name: Snort logs + protocol_parameters: + - id: 1 + name: incomingPayloadEncoding + value: UTF-8 + - id: 0 + name: identifier + value: 198.51.100.1 + protocol_type_id: 0 + requires_deploy: true + status: + last_updated: 0 + messages: null + status: NA + store_event_payload: true + target_event_collector_id: 7 + type_id: 2 + wincollect_external_destination_ids: null + wincollect_internal_destination_id: null + - auto_discovered: false + average_eps: 0 + coalesce_events: true + credibility: 5 + description: REPLACED Apache HTTP Server remote logs from rsyslog + enabled: true + gateway: false + group_ids: + - 0 + internal: false + language_id: 1 + last_event_time: 0 + log_source_extension_id: null + name: Apache HTTP Server logs + protocol_parameters: + - id: 1 + name: incomingPayloadEncoding + value: UTF-8 + - id: 0 + name: identifier + value: 192.0.2.1 + protocol_type_id: 0 + requires_deploy: true + status: + last_updated: 0 + messages: null + status: NA + store_event_payload: true + target_event_collector_id: 7 + type_id: 10 + wincollect_external_destination_ids: null + wincollect_internal_destination_id: null diff --git a/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_hosts/default/main.yaml b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_hosts/default/main.yaml new file mode 100644 index 000000000..10c0fabcb --- /dev/null +++ b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_hosts/default/main.yaml @@ -0,0 +1,2 @@ +--- +testcase: '*' diff --git a/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_hosts/meta/main.yaml b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_hosts/meta/main.yaml new file mode 100644 index 000000000..23d65c7ef --- /dev/null +++ b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_hosts/meta/main.yaml @@ -0,0 +1,2 @@ +--- +dependencies: [] diff --git a/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_hosts/tasks/cli.yaml b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_hosts/tasks/cli.yaml new file mode 100644 index 000000000..9dc383a2d --- /dev/null +++ b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_hosts/tasks/cli.yaml @@ -0,0 +1,19 @@ +--- +- name: collect all cli test cases + find: + paths: '{{ role_path }}/tests/cli' + patterns: '{{ testcase }}.yaml' + register: test_cases + delegate_to: localhost + +- name: set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + +- name: Run test case (connection=ansible.netcommon.httpapi) + include: '{{ test_case_to_run }}' + vars: + ansible_connection: ansible.netcommon.httpapi + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: connection_httpapi diff --git a/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_hosts/tasks/main.yaml b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_hosts/tasks/main.yaml new file mode 100644 index 000000000..62cc1ae1e --- /dev/null +++ b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_hosts/tasks/main.yaml @@ -0,0 +1,7 @@ +--- +- include: cli.yaml + tags: + - cli + +- include: redirection.yaml + when: ansible_version.full is version('2.10.0', '>=') diff --git a/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_hosts/tasks/redirection.yaml b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_hosts/tasks/redirection.yaml new file mode 100644 index 000000000..a57054c7d --- /dev/null +++ b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_hosts/tasks/redirection.yaml @@ -0,0 +1,6 @@ +--- +- name: collect all cli test cases + find: + paths: '{{ role_path }}/tests/redirection' + patterns: '{{ testcase }}.yaml' + register: test_cases diff --git a/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_hosts/tests/cli/_populate_config.yaml b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_hosts/tests/cli/_populate_config.yaml new file mode 100644 index 000000000..0b6a9bd21 --- /dev/null +++ b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_hosts/tests/cli/_populate_config.yaml @@ -0,0 +1,13 @@ +--- +- name: Populate CP MGMT hosts for tests + tags: merged + check_point.mgmt.cp_mgmt_hosts: &id001 + state: merged + config: + color: cyan + ip_address: 192.0.2.1 + name: New Host 1 + tags: + - New Host + comments: Host description + auto_publish_session: true diff --git a/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_hosts/tests/cli/_remove_config.yaml b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_hosts/tests/cli/_remove_config.yaml new file mode 100644 index 000000000..9ef24fd20 --- /dev/null +++ b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_hosts/tests/cli/_remove_config.yaml @@ -0,0 +1,6 @@ +--- +- name: Remove already configured CP MGMT Host by Name + check_point.mgmt.cp_mgmt_hosts: + state: deleted + config: + name: "New Host 1" diff --git a/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_hosts/tests/cli/deleted.yaml b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_hosts/tests/cli/deleted.yaml new file mode 100644 index 000000000..bfd40f1c2 --- /dev/null +++ b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_hosts/tests/cli/deleted.yaml @@ -0,0 +1,36 @@ +--- +- debug: + msg: Start Deleted integration state for cp_mgmt_hosts ansible_connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml +- include_tasks: _populate_config.yaml + +- block: + + - name: Delete attributes of provided configured CP Mgmt Hosts + register: result + check_point.mgmt.cp_mgmt_hosts: &id001 + config: + name: New Host 1 + state: deleted + + - assert: + that: + - result.changed == true + - "{{ merged['after'] | symmetric_difference(result['cp_mgmt_hosts']['before']) |\ + \ length == 4 }}" + - merged['before'] == result['cp_mgmt_hosts']['after'] + + - name: Delete attributes of all configured CP Mgmt Hosts (IDEMPOTENT) + register: result + check_point.mgmt.cp_mgmt_hosts: *id001 + + - name: Assert that the previous delete task was idempotent + assert: + that: + - result.changed == false + + always: + + - include_tasks: _remove_config.yaml diff --git a/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_hosts/tests/cli/gathered.yaml b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_hosts/tests/cli/gathered.yaml new file mode 100644 index 000000000..f7d5aedf7 --- /dev/null +++ b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_hosts/tests/cli/gathered.yaml @@ -0,0 +1,25 @@ +--- +- debug: + msg: START cp_mgmt_hosts gathered integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml +- include_tasks: _populate_config.yaml + +- block: + + - name: Gather the provided configuration with the exisiting running configuration + register: result + check_point.mgmt.cp_mgmt_hosts: + config: + name: "New Host 1" + state: gathered + + - assert: + that: + - "{{ merged['after'] | symmetric_difference(result['gathered']) |\ + \ length == 4 }}" + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml diff --git a/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_hosts/tests/cli/merged.yaml b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_hosts/tests/cli/merged.yaml new file mode 100644 index 000000000..990bc846a --- /dev/null +++ b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_hosts/tests/cli/merged.yaml @@ -0,0 +1,47 @@ +--- +- debug: + msg: START Merged cp_mgmt_hosts state for integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- block: + + - name: Merge and Create CP Mgmt Hosts + tags: merged + register: result + check_point.mgmt.cp_mgmt_hosts: &id001 + state: merged + config: + color: cyan + ip_address: 192.0.2.1 + name: New Host 1 + tags: + - New Host + comments: Host description + auto_publish_session: true + + - name: Assert that task reports change and after dict is correctly generated + assert: + that: + - result['changed'] == true + - "{{ merged['after'] | symmetric_difference(result['cp_mgmt_hosts']['after']) |\ + \ length == 4 }}" + + - name: Assert that before dicts are correctly generated + assert: + that: + - merged['before'] == result['cp_mgmt_hosts']['before'] + + - name: Merge provided configuration with Hosts (IDEMPOTENT) + register: result + check_point.mgmt.cp_mgmt_hosts: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + + always: + + - include_tasks: _remove_config.yaml diff --git a/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_hosts/tests/cli/replaced.yaml b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_hosts/tests/cli/replaced.yaml new file mode 100644 index 000000000..dfac6e84b --- /dev/null +++ b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_hosts/tests/cli/replaced.yaml @@ -0,0 +1,46 @@ +--- +- debug: + msg: START Replaced cp_mgmt_hosts state for integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml +- include_tasks: _populate_config.yaml + +- block: + + - name: Replace existing CP Mgmt Hosts + register: result + check_point.mgmt.cp_mgmt_hosts: &id001 + state: replaced + config: + name: New Host 1 + tags: + - New Replaced Host + color: aquamarine + ip_address: 198.51.110.0 + comments: Host Replaced description + ignore_warnings: true + ignore_errors: false + auto_publish_session: true + + - assert: + that: + - result.changed == true + - "{{ merged['after'] | symmetric_difference(result['cp_mgmt_hosts']['before']) |\ + \ length == 4 }}" + - "{{ replaced['after'] | symmetric_difference(result['cp_mgmt_hosts']['after']) |\ + \ length == 4 }}" + + - name: Replaces device configuration of listed CP Mgmt Hosts with provided configuration + (IDEMPOTENT) + register: result + check_point.mgmt.cp_mgmt_hosts: *id001 + + - name: Assert that task was idempotent + assert: + that: + - result['changed'] == false + + always: + + - include_tasks: _remove_config.yaml diff --git a/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_hosts/tests/cli/rtt.yaml b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_hosts/tests/cli/rtt.yaml new file mode 100644 index 000000000..ba2480350 --- /dev/null +++ b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_hosts/tests/cli/rtt.yaml @@ -0,0 +1,65 @@ +--- +- debug: + msg: START cp_mgmt_hosts round trip integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- block: + + - name: Apply the provided configuration (base config) + register: base_config + check_point.mgmt.cp_mgmt_hosts: &id001 + state: merged + config: + color: cyan + ip_address: 192.0.2.1 + name: New Host 1 + tags: + - New Host + comments: Host description + auto_publish_session: true + + - name: Gather CP Mgmt Hosts facts + register: gather_result + check_point.mgmt.cp_mgmt_hosts: + config: + name: "New Layer 1" + state: gathered + + - name: Apply the configuration which need to be reverted + register: result + check_point.mgmt.cp_mgmt_hosts: + state: replaced + config: + name: New Host 1 + tags: + - New Replaced Host + color: aquamarine + ip_address: 198.51.110.0 + comments: Host Replaced description + ignore_warnings: true + ignore_errors: false + auto_publish_session: true + + - assert: + that: + - result.changed == true + - "{{ merged['before'] | symmetric_difference(result['cp_mgmt_hosts']['before']) |\ + \ length == 1 }}" + - "{{ replaced['after'] | symmetric_difference(result['cp_mgmt_hosts']['after']) |\ + \ length == 3 }}" + + - name: Revert back to base config using facts round trip + register: revert + check_point.mgmt.cp_mgmt_hosts: + config: "{{ gather_result['gathered'] }}" + state: replaced + + - assert: + that: + - revert['changed'] == true + + always: + + - include_tasks: _remove_config.yaml diff --git a/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_hosts/vars/main.yaml b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_hosts/vars/main.yaml new file mode 100644 index 000000000..b1ea417a0 --- /dev/null +++ b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_hosts/vars/main.yaml @@ -0,0 +1,28 @@ +--- +merged: + before: [] + + after: + color: cyan + comments: Host description + groups: [] + icon: Objects/host + interfaces: [] + ipv4-address: 192.0.2.1 + name: New Host 1 + nat_settings: {} + tags: + - New Host + +replaced: + after: + color: aquamarine + comments: Host Replaced description + groups: [] + icon: Objects/host + interfaces: [] + ipv4-address: 198.51.110.0 + name: New Host 1 + nat_settings: {} + tags: + - New Replaced Host
\ No newline at end of file diff --git a/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_threat_layers/default/main.yaml b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_threat_layers/default/main.yaml new file mode 100644 index 000000000..10c0fabcb --- /dev/null +++ b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_threat_layers/default/main.yaml @@ -0,0 +1,2 @@ +--- +testcase: '*' diff --git a/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_threat_layers/meta/main.yaml b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_threat_layers/meta/main.yaml new file mode 100644 index 000000000..23d65c7ef --- /dev/null +++ b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_threat_layers/meta/main.yaml @@ -0,0 +1,2 @@ +--- +dependencies: [] diff --git a/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_threat_layers/tasks/cli.yaml b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_threat_layers/tasks/cli.yaml new file mode 100644 index 000000000..9dc383a2d --- /dev/null +++ b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_threat_layers/tasks/cli.yaml @@ -0,0 +1,19 @@ +--- +- name: collect all cli test cases + find: + paths: '{{ role_path }}/tests/cli' + patterns: '{{ testcase }}.yaml' + register: test_cases + delegate_to: localhost + +- name: set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + +- name: Run test case (connection=ansible.netcommon.httpapi) + include: '{{ test_case_to_run }}' + vars: + ansible_connection: ansible.netcommon.httpapi + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: connection_httpapi diff --git a/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_threat_layers/tasks/main.yaml b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_threat_layers/tasks/main.yaml new file mode 100644 index 000000000..62cc1ae1e --- /dev/null +++ b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_threat_layers/tasks/main.yaml @@ -0,0 +1,7 @@ +--- +- include: cli.yaml + tags: + - cli + +- include: redirection.yaml + when: ansible_version.full is version('2.10.0', '>=') diff --git a/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_threat_layers/tasks/redirection.yaml b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_threat_layers/tasks/redirection.yaml new file mode 100644 index 000000000..a57054c7d --- /dev/null +++ b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_threat_layers/tasks/redirection.yaml @@ -0,0 +1,6 @@ +--- +- name: collect all cli test cases + find: + paths: '{{ role_path }}/tests/redirection' + patterns: '{{ testcase }}.yaml' + register: test_cases diff --git a/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_threat_layers/tests/cli/_populate_config.yaml b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_threat_layers/tests/cli/_populate_config.yaml new file mode 100644 index 000000000..a223d461f --- /dev/null +++ b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_threat_layers/tests/cli/_populate_config.yaml @@ -0,0 +1,15 @@ +--- +- name: Populate CP MGMT threat layer for tests + tags: merged + check_point.mgmt.cp_mgmt_threat_layers: &id001 + state: merged + config: + name: New Layer 1 + add_default_rule: true + tags: + - test_threat_layer + color: blue + comments: Initial description + ignore_warnings: false + ignore_errors: false + auto_publish_session: true diff --git a/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_threat_layers/tests/cli/_remove_config.yaml b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_threat_layers/tests/cli/_remove_config.yaml new file mode 100644 index 000000000..b5e85ca3a --- /dev/null +++ b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_threat_layers/tests/cli/_remove_config.yaml @@ -0,0 +1,7 @@ +--- +- name: Remove already configured CP MGMT threat layer by Name + check_point.mgmt.cp_mgmt_threat_layers: + state: deleted + config: + name: "New Layer 1" + auto_publish_session: true diff --git a/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_threat_layers/tests/cli/deleted.yaml b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_threat_layers/tests/cli/deleted.yaml new file mode 100644 index 000000000..39f32ffa3 --- /dev/null +++ b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_threat_layers/tests/cli/deleted.yaml @@ -0,0 +1,37 @@ +--- +- debug: + msg: Start Deleted integration state for cp_mgmt_threat_layers ansible_connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml +- include_tasks: _populate_config.yaml + +- block: + + - name: Delete attributes of provided configured CP Mgmt Threat layers + register: result + check_point.mgmt.cp_mgmt_threat_layers: &id001 + config: + name: New Layer 1 + auto_publish_session: true + state: deleted + + - assert: + that: + - result.changed == true + - "{{ merged['after'] | symmetric_difference(result['cp_mgmt_threat_layers']['before']) |\ + \ length == 4 }}" + - merged['before'] == result['cp_mgmt_threat_layers']['after'] + + - name: Delete attributes of all configured CP Mgmt Threat layers (IDEMPOTENT) + register: result + check_point.mgmt.cp_mgmt_threat_layers: *id001 + + - name: Assert that the previous delete task was idempotent + assert: + that: + - result.changed == false + + always: + + - include_tasks: _remove_config.yaml diff --git a/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_threat_layers/tests/cli/gathered.yaml b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_threat_layers/tests/cli/gathered.yaml new file mode 100644 index 000000000..a1a695f57 --- /dev/null +++ b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_threat_layers/tests/cli/gathered.yaml @@ -0,0 +1,25 @@ +--- +- debug: + msg: START cp_mgmt_threat_layers gathered integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml +- include_tasks: _populate_config.yaml + +- block: + + - name: Gather the provided configuration with the exisiting running configuration + register: result + check_point.mgmt.cp_mgmt_threat_layers: + config: + name: "New Layer 1" + state: gathered + + - assert: + that: + - "{{ merged['after'] | symmetric_difference(result['gathered']) |\ + \ length == 4 }}" + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml diff --git a/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_threat_layers/tests/cli/merged.yaml b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_threat_layers/tests/cli/merged.yaml new file mode 100644 index 000000000..8dfb48a87 --- /dev/null +++ b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_threat_layers/tests/cli/merged.yaml @@ -0,0 +1,49 @@ +--- +- debug: + msg: START Merged cp_mgmt_threat_layers state for integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- block: + + - name: Merge and Create CP Mgmt Threat layers + tags: merged + register: result + check_point.mgmt.cp_mgmt_threat_layers: &id001 + state: merged + config: + name: New Layer 1 + add_default_rule: true + tags: + - test_threat_layer + color: blue + comments: Initial description + ignore_warnings: false + ignore_errors: false + auto_publish_session: true + + - name: Assert that task reports change and after dict is correctly generated + assert: + that: + - result['changed'] == true + - "{{ merged['after'] | symmetric_difference(result['cp_mgmt_threat_layers']['after']) |\ + \ length == 4 }}" + + - name: Assert that before dicts are correctly generated + assert: + that: + - merged['before'] == result['cp_mgmt_threat_layers']['before'] + + - name: Merge provided configuration with CP Mgmt Threat layers (IDEMPOTENT) + register: result + check_point.mgmt.cp_mgmt_threat_layers: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + + always: + + - include_tasks: _remove_config.yaml diff --git a/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_threat_layers/tests/cli/replaced.yaml b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_threat_layers/tests/cli/replaced.yaml new file mode 100644 index 000000000..de9723817 --- /dev/null +++ b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_threat_layers/tests/cli/replaced.yaml @@ -0,0 +1,46 @@ +--- +- debug: + msg: START Replaced cp_mgmt_threat_layers state for integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml +- include_tasks: _populate_config.yaml + +- block: + + - name: Replace existing CP Mgmt Threat layers + register: result + check_point.mgmt.cp_mgmt_threat_layers: &id001 + state: replaced + config: + name: New Layer 1 + add_default_rule: true + tags: + - test_threat_layer_replaced + color: cyan + comments: REPLACED description + ignore_warnings: true + ignore_errors: false + auto_publish_session: true + + - assert: + that: + - result.changed == true + - "{{ merged['after'] | symmetric_difference(result['cp_mgmt_threat_layers']['before']) |\ + \ length == 4 }}" + - "{{ replaced['after'] | symmetric_difference(result['cp_mgmt_threat_layers']['after']) |\ + \ length == 4 }}" + + - name: Replaces device configuration of listed CP Mgmt Threat layers with provided configuration + (IDEMPOTENT) + register: result + check_point.mgmt.cp_mgmt_threat_layers: *id001 + + - name: Assert that task was idempotent + assert: + that: + - result['changed'] == false + + always: + + - include_tasks: _remove_config.yaml diff --git a/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_threat_layers/tests/cli/rtt.yaml b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_threat_layers/tests/cli/rtt.yaml new file mode 100644 index 000000000..69228cd56 --- /dev/null +++ b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_threat_layers/tests/cli/rtt.yaml @@ -0,0 +1,67 @@ +--- +- debug: + msg: START cp_mgmt_threat_layers round trip integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_log_sources_config.yaml + +- block: + + - name: Apply the provided configuration (base config) + register: base_config + check_point.mgmt.cp_mgmt_threat_layers: &id001 + state: merged + config: + name: New Layer 1 + add_default_rule: true + tags: + - test_threat_layer + color: blue + comments: Initial description + ignore_warnings: false + ignore_errors: false + auto_publish_session: true + + - name: Gather CP Mgmt Threat layers facts + register: gather_result + check_point.mgmt.cp_mgmt_threat_layers: + config: + name: "New Layer 1" + state: gathered + + - name: Apply the configuration which need to be reverted + register: result + check_point.mgmt.cp_mgmt_threat_layers: + state: replaced + config: + name: New Layer 1 + add_default_rule: true + tags: + - test_threat_layer_replaced + color: cyan + comments: REPLACED description + ignore_warnings: true + ignore_errors: false + auto_publish_session: true + + - assert: + that: + - result.changed == true + - "{{ merged['before'] | symmetric_difference(result['cp_mgmt_threat_layers']['before']) |\ + \ length == 1 }}" + - "{{ replaced['after'] | symmetric_difference(result['cp_mgmt_threat_layers']['after']) |\ + \ length == 3 }}" + + - name: Revert back to base config using facts round trip + register: revert + check_point.mgmt.cp_mgmt_threat_layers: + config: "{{ gather_result['gathered'] }}" + state: replaced + + - assert: + that: + - revert['changed'] == true + + always: + + - include_tasks: _remove_config.yaml diff --git a/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_threat_layers/vars/main.yaml b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_threat_layers/vars/main.yaml new file mode 100644 index 000000000..42a98bde1 --- /dev/null +++ b/ansible_collections/check_point/mgmt/tests/integration/targets/cp_mgmt_threat_layers/vars/main.yaml @@ -0,0 +1,21 @@ +--- +merged: + before: [] + after: + color: blue + comments: Initial description + icon: ApplicationFirewall/rulebase + ips-layer: false + name: New Layer 1 + tags: + - test_threat_layer + +replaced: + after: + color: cyan + comments: REPLACED description + icon: ApplicationFirewall/rulebase + ips-layer: false + name: New Layer 1 + tags: + - test_threat_layer_replaced
\ No newline at end of file diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_checkpoint_access_rule.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_checkpoint_access_rule.py index e5f70bdbb..1f4e336da 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_checkpoint_access_rule.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_checkpoint_access_rule.py @@ -21,15 +21,29 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleFailJson, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleFailJson, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import _checkpoint_access_rule - -OBJECT = {'layer': 'foo', 'position': 'bar', 'name': 'baz', - 'source': [{'name': 'lol'}], 'destination': [{'name': 'Any'}], - 'action': {'name': 'drop'}, 'enabled': True} -PAYLOAD = {'layer': 'foo', 'position': 'bar', 'name': 'baz'} +from ansible_collections.check_point.mgmt.plugins.modules import ( + _checkpoint_access_rule, +) + +OBJECT = { + "layer": "foo", + "position": "bar", + "name": "baz", + "source": [{"name": "lol"}], + "destination": [{"name": "Any"}], + "action": {"name": "drop"}, + "enabled": True, +} +PAYLOAD = {"layer": "foo", "position": "bar", "name": "baz"} class TestCheckpointAccessRule(object): @@ -37,61 +51,69 @@ class TestCheckpointAccessRule(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible_collections.check_point.mgmt.plugins.modules._checkpoint_access_rule.Connection') + connection_class_mock = mocker.patch( + "ansible_collections.check_point.mgmt.plugins.modules._checkpoint_access_rule.Connection" + ) return connection_class_mock.return_value @pytest.fixture def get_access_rule_200(self, mocker): - mock_function = mocker.patch('ansible_collections.check_point.mgmt.plugins.modules._checkpoint_access_rule.get_access_rule') + mock_function = mocker.patch( + "ansible_collections.check_point.mgmt.plugins.modules._checkpoint_access_rule.get_access_rule" + ) mock_function.return_value = (200, OBJECT) return mock_function.return_value @pytest.fixture def get_access_rule_404(self, mocker): - mock_function = mocker.patch('ansible_collections.check_point.mgmt.plugins.modules._checkpoint_access_rule.get_access_rule') - mock_function.return_value = (404, 'Object not found') + mock_function = mocker.patch( + "ansible_collections.check_point.mgmt.plugins.modules._checkpoint_access_rule.get_access_rule" + ) + mock_function.return_value = (404, "Object not found") return mock_function.return_value def test_create(self, get_access_rule_404, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(PAYLOAD) - assert result['changed'] - assert 'checkpoint_access_rules' in result + assert result["changed"] + assert "checkpoint_access_rules" in result def test_create_idempotent(self, get_access_rule_200, connection_mock): connection_mock.send_request.return_value = (200, PAYLOAD) result = self._run_module(PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, get_access_rule_200, connection_mock): - payload_for_update = {'enabled': False} + payload_for_update = {"enabled": False} payload_for_update.update(PAYLOAD) connection_mock.send_request.return_value = (200, payload_for_update) result = self._run_module(payload_for_update) - assert result['changed'] - assert not result['checkpoint_access_rules']['enabled'] + assert result["changed"] + assert not result["checkpoint_access_rules"]["enabled"] def test_delete(self, get_access_rule_200, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) - payload_for_delete = {'state': 'absent'} + payload_for_delete = {"state": "absent"} payload_for_delete.update(PAYLOAD) result = self._run_module(payload_for_delete) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, get_access_rule_404, connection_mock): - payload = {'name': 'baz', 'state': 'absent'} + payload = {"name": "baz", "state": "absent"} connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(payload) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_checkpoint_host.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_checkpoint_host.py index b5720c5df..f5cb80bd7 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_checkpoint_host.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_checkpoint_host.py @@ -21,15 +21,23 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleFailJson, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleFailJson, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import _checkpoint_host +from ansible_collections.check_point.mgmt.plugins.modules import ( + _checkpoint_host, +) -OBJECT = {'name': 'foo', 'ipv4-address': '192.168.0.15'} -CREATE_PAYLOAD = {'name': 'foo', 'ip_address': '192.168.0.15'} -UPDATE_PAYLOAD = {'name': 'foo', 'ip_address': '192.168.0.16'} -DELETE_PAYLOAD = {'name': 'foo', 'state': 'absent'} +OBJECT = {"name": "foo", "ipv4-address": "192.168.0.15"} +CREATE_PAYLOAD = {"name": "foo", "ip_address": "192.168.0.15"} +UPDATE_PAYLOAD = {"name": "foo", "ip_address": "192.168.0.16"} +DELETE_PAYLOAD = {"name": "foo", "state": "absent"} class TestCheckpointHost(object): @@ -37,55 +45,63 @@ class TestCheckpointHost(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible_collections.check_point.mgmt.plugins.modules._checkpoint_host.Connection') + connection_class_mock = mocker.patch( + "ansible_collections.check_point.mgmt.plugins.modules._checkpoint_host.Connection" + ) return connection_class_mock.return_value @pytest.fixture def get_host_200(self, mocker): - mock_function = mocker.patch('ansible_collections.check_point.mgmt.plugins.modules._checkpoint_host.get_host') + mock_function = mocker.patch( + "ansible_collections.check_point.mgmt.plugins.modules._checkpoint_host.get_host" + ) mock_function.return_value = (200, OBJECT) return mock_function.return_value @pytest.fixture def get_host_404(self, mocker): - mock_function = mocker.patch('ansible_collections.check_point.mgmt.plugins.modules._checkpoint_host.get_host') - mock_function.return_value = (404, 'Object not found') + mock_function = mocker.patch( + "ansible_collections.check_point.mgmt.plugins.modules._checkpoint_host.get_host" + ) + mock_function.return_value = (404, "Object not found") return mock_function.return_value def test_create(self, get_host_404, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] - assert 'checkpoint_hosts' in result + assert result["changed"] + assert "checkpoint_hosts" in result def test_create_idempotent(self, get_host_200, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, get_host_200, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete(self, get_host_200, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, get_host_404, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_checkpoint_session.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_checkpoint_session.py index f0ca83584..ac85dc4a2 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_checkpoint_session.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_checkpoint_session.py @@ -21,12 +21,20 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleFailJson, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleFailJson, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import _checkpoint_session +from ansible_collections.check_point.mgmt.plugins.modules import ( + _checkpoint_session, +) -OBJECT = {'uid': '1234'} +OBJECT = {"uid": "1234"} PAYLOAD = {} @@ -35,16 +43,22 @@ class TestCheckpointAccessRule(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible_collections.check_point.mgmt.plugins.modules._checkpoint_session.Connection') + connection_class_mock = mocker.patch( + "ansible_collections.check_point.mgmt.plugins.modules._checkpoint_session.Connection" + ) return connection_class_mock.return_value @pytest.fixture def get_session_200(self, mocker): - mock_function = mocker.patch('ansible_collections.check_point.mgmt.plugins.modules._checkpoint_session.get_session') + mock_function = mocker.patch( + "ansible_collections.check_point.mgmt.plugins.modules._checkpoint_session.get_session" + ) mock_function.return_value = (200, OBJECT) return mock_function.return_value @@ -52,8 +66,8 @@ class TestCheckpointAccessRule(object): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(PAYLOAD) - assert result['changed'] - assert 'checkpoint_session' in result + assert result["changed"] + assert "checkpoint_session" in result def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_checkpoint_task_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_checkpoint_task_facts.py index b5720c5df..f5cb80bd7 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_checkpoint_task_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_checkpoint_task_facts.py @@ -21,15 +21,23 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleFailJson, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleFailJson, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import _checkpoint_host +from ansible_collections.check_point.mgmt.plugins.modules import ( + _checkpoint_host, +) -OBJECT = {'name': 'foo', 'ipv4-address': '192.168.0.15'} -CREATE_PAYLOAD = {'name': 'foo', 'ip_address': '192.168.0.15'} -UPDATE_PAYLOAD = {'name': 'foo', 'ip_address': '192.168.0.16'} -DELETE_PAYLOAD = {'name': 'foo', 'state': 'absent'} +OBJECT = {"name": "foo", "ipv4-address": "192.168.0.15"} +CREATE_PAYLOAD = {"name": "foo", "ip_address": "192.168.0.15"} +UPDATE_PAYLOAD = {"name": "foo", "ip_address": "192.168.0.16"} +DELETE_PAYLOAD = {"name": "foo", "state": "absent"} class TestCheckpointHost(object): @@ -37,55 +45,63 @@ class TestCheckpointHost(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible_collections.check_point.mgmt.plugins.modules._checkpoint_host.Connection') + connection_class_mock = mocker.patch( + "ansible_collections.check_point.mgmt.plugins.modules._checkpoint_host.Connection" + ) return connection_class_mock.return_value @pytest.fixture def get_host_200(self, mocker): - mock_function = mocker.patch('ansible_collections.check_point.mgmt.plugins.modules._checkpoint_host.get_host') + mock_function = mocker.patch( + "ansible_collections.check_point.mgmt.plugins.modules._checkpoint_host.get_host" + ) mock_function.return_value = (200, OBJECT) return mock_function.return_value @pytest.fixture def get_host_404(self, mocker): - mock_function = mocker.patch('ansible_collections.check_point.mgmt.plugins.modules._checkpoint_host.get_host') - mock_function.return_value = (404, 'Object not found') + mock_function = mocker.patch( + "ansible_collections.check_point.mgmt.plugins.modules._checkpoint_host.get_host" + ) + mock_function.return_value = (404, "Object not found") return mock_function.return_value def test_create(self, get_host_404, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] - assert 'checkpoint_hosts' in result + assert result["changed"] + assert "checkpoint_hosts" in result def test_create_idempotent(self, get_host_200, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, get_host_200, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete(self, get_host_200, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, get_host_404, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_access_layer.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_access_layer.py index 7dc292f7d..6e58b2575 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_access_layer.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_access_layer.py @@ -15,36 +15,37 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_access_layer +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_access_layer, +) -OBJECT = { - "name": "New Layer 1" -} +OBJECT = {"name": "New Layer 1"} -CREATE_PAYLOAD = { - "name": "New Layer 1" -} +CREATE_PAYLOAD = {"name": "New Layer 1"} UPDATE_PAYLOAD = { "name": "New Layer 1", - "applications_and_url_filtering": False + "applications_and_url_filtering": False, } OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD -DELETE_PAYLOAD = { - "name": "New Layer 1", - "state": "absent" -} +DELETE_PAYLOAD = {"name": "New Layer 1", "state": "absent"} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_access_layer.api_call' -api_call_object = 'access-layer' +function_path = "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_access_layer.api_call" +api_call_object = "access-layer" class TestCheckpointAccessLayer(object): @@ -52,56 +53,69 @@ class TestCheckpointAccessLayer(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_access_layer_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_access_layer_facts.py index e7a4d5f19..7c270ec1a 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_access_layer_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_access_layer_facts.py @@ -15,35 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_access_layer_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_access_layer_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} -SHOW_SINGLE_PAYLOAD = { - 'name': 'object_which_is_not_exist' -} +SHOW_SINGLE_PAYLOAD = {"name": "object_which_is_not_exist"} -api_call_object = 'access-layer' -api_call_object_plural_version = 'access-layers' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "access-layer" +api_call_object_plural_version = "access-layers" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointAccessLayerFacts(object): @@ -51,29 +52,40 @@ class TestCheckpointAccessLayerFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_access_role.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_access_role.py index ad5194b17..7900884d6 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_access_role.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_access_role.py @@ -15,20 +15,28 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_access_role +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_access_role, +) OBJECT = { "name": "New Access Role 1", "networks": "any", "users": "any", "machines": "all identified", - "remote_access_clients": "any" + "remote_access_clients": "any", } CREATE_PAYLOAD = { @@ -36,24 +44,21 @@ CREATE_PAYLOAD = { "networks": "any", "users": "any", "machines": "all identified", - "remote_access_clients": "any" + "remote_access_clients": "any", } UPDATE_PAYLOAD = { "name": "New Access Role 1", "users": "all identified", - "machines": "any" + "machines": "any", } OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD -DELETE_PAYLOAD = { - "name": "New Access Role 1", - "state": "absent" -} +DELETE_PAYLOAD = {"name": "New Access Role 1", "state": "absent"} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_access_role.api_call' -api_call_object = 'access-role' +function_path = "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_access_role.api_call" +api_call_object = "access-role" class TestCheckpointAccessRole(object): @@ -61,56 +66,69 @@ class TestCheckpointAccessRole(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_access_role_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_access_role_facts.py index 55416777a..a88568dc1 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_access_role_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_access_role_facts.py @@ -15,35 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_access_role_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_access_role_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} -SHOW_SINGLE_PAYLOAD = { - 'name': 'object_which_is_not_exist' -} +SHOW_SINGLE_PAYLOAD = {"name": "object_which_is_not_exist"} -api_call_object = 'access-role' -api_call_object_plural_version = 'access-roles' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "access-role" +api_call_object_plural_version = "access-roles" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointAccessRoleFacts(object): @@ -51,29 +52,40 @@ class TestCheckpointAccessRoleFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_access_rule.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_access_rule.py index b0163d70e..1f37e8b39 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_access_rule.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_access_rule.py @@ -15,30 +15,28 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_access_rule +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_access_rule, +) -OBJECT = { - "layer": "Network", - "name": "Rule 1", - "service": [ - "SMTP", - "AOL" - ] -} +OBJECT = {"layer": "Network", "name": "Rule 1", "service": ["SMTP", "AOL"]} CREATE_PAYLOAD = { "layer": "Network", "name": "Rule 1", - "service": [ - "SMTP", - "AOL" - ] + "service": ["SMTP", "AOL"], } UPDATE_PAYLOAD = { @@ -46,19 +44,16 @@ UPDATE_PAYLOAD = { "layer": "Network", "action_settings": { "limit": "Upload_1Gbps", - "enable_identity_captive_portal": True - } + "enable_identity_captive_portal": True, + }, } OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD -DELETE_PAYLOAD = { - "name": "Rule 1", - "state": "absent" -} +DELETE_PAYLOAD = {"name": "Rule 1", "state": "absent"} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_access_rule.api_call' -api_call_object = 'access-rule' +function_path = "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_access_rule.api_call" +api_call_object = "access-rule" class TestCheckpointAccessRule(object): @@ -66,56 +61,69 @@ class TestCheckpointAccessRule(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_access_rule_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_access_rule_facts.py index 87f532c40..bf177740f 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_access_rule_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_access_rule_facts.py @@ -15,35 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_access_rule_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_access_rule_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} -SHOW_SINGLE_PAYLOAD = { - 'name': 'object_which_is_not_exist' -} +SHOW_SINGLE_PAYLOAD = {"name": "object_which_is_not_exist"} -api_call_object = 'access-rule' -api_call_object_plural_version = 'access-rulebase' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "access-rule" +api_call_object_plural_version = "access-rulebase" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointAccessRuleFacts(object): @@ -51,29 +52,40 @@ class TestCheckpointAccessRuleFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_access_section.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_access_section.py index 1adc7d5e6..da1577745 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_access_section.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_access_section.py @@ -15,40 +15,34 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_access_section +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_access_section, +) -OBJECT = { - "layer": "Network", - "position": 1, - "name": "New Section 1" -} +OBJECT = {"layer": "Network", "position": 1, "name": "New Section 1"} -CREATE_PAYLOAD = { - "layer": "Network", - "position": 1, - "name": "New Section 1" -} +CREATE_PAYLOAD = {"layer": "Network", "position": 1, "name": "New Section 1"} -UPDATE_PAYLOAD = { - "layer": "Network", - "name": "New Section 1" -} +UPDATE_PAYLOAD = {"layer": "Network", "name": "New Section 1"} OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD -DELETE_PAYLOAD = { - "name": "New Section 1", - "state": "absent" -} +DELETE_PAYLOAD = {"name": "New Section 1", "state": "absent"} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_access_section.api_call' -api_call_object = 'access-section' +function_path = "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_access_section.api_call" +api_call_object = "access-section" class TestCheckpointAccessSection(object): @@ -56,56 +50,69 @@ class TestCheckpointAccessSection(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_add_api_key.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_add_api_key.py index a3977c569..68ac9ed28 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_add_api_key.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_add_api_key.py @@ -15,25 +15,28 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_add_api_key +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_add_api_key, +) -PAYLOAD = { - "admin_name": "admin", - "wait_for_task": False -} +PAYLOAD = {"admin_name": "admin", "wait_for_task": False} -RETURN_PAYLOAD = { - "task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad" -} +RETURN_PAYLOAD = {"task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad"} -command = 'add-api-key' -failure_msg = '{command failed}' +command = "add-api-key" +failure_msg = "{command failed}" class TestCheckpointAddApiKey(object): @@ -41,18 +44,22 @@ class TestCheckpointAddApiKey(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_command(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, RETURN_PAYLOAD) result = self._run_module(PAYLOAD) - assert result['changed'] + assert result["changed"] assert RETURN_PAYLOAD == result[command] def test_command_fail(self, mocker, connection_mock): @@ -62,7 +69,10 @@ class TestCheckpointAddApiKey(object): except Exception as e: result = e.args[0] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_add_data_center_object.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_add_data_center_object.py index 63e65675f..151903d19 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_add_data_center_object.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_add_data_center_object.py @@ -15,27 +15,33 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_add_data_center_object +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_add_data_center_object, +) PAYLOAD = { "uri": "/Datacenters/VMs/My VM1", "name": "VM1 mgmt name", "data_center_name": "vCenter 1", - "wait_for_task": False + "wait_for_task": False, } -RETURN_PAYLOAD = { - "task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad" -} +RETURN_PAYLOAD = {"task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad"} -command = 'add-data-center-object' -failure_msg = '{command failed}' +command = "add-data-center-object" +failure_msg = "{command failed}" class TestCheckpointAddDataCenterObject(object): @@ -43,18 +49,22 @@ class TestCheckpointAddDataCenterObject(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_command(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, RETURN_PAYLOAD) result = self._run_module(PAYLOAD) - assert result['changed'] + assert result["changed"] assert RETURN_PAYLOAD == result[command] def test_command_fail(self, mocker, connection_mock): @@ -64,7 +74,10 @@ class TestCheckpointAddDataCenterObject(object): except Exception as e: result = e.args[0] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_add_nat_rule.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_add_nat_rule.py index dc5dbbf85..9683c03e4 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_add_nat_rule.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_add_nat_rule.py @@ -15,33 +15,37 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_add_nat_rule +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_add_nat_rule, +) PAYLOAD = { "package": "standard", "position": 1, "comments": "comment example1 nat999", "enabled": False, - "install_on": [ - "Policy Targets" - ], + "install_on": ["Policy Targets"], "original_source": "Any", "original_destination": "All_Internet", - "wait_for_task": False + "wait_for_task": False, } -RETURN_PAYLOAD = { - "task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad" -} +RETURN_PAYLOAD = {"task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad"} -command = 'add-nat-rule' -failure_msg = '{command failed}' +command = "add-nat-rule" +failure_msg = "{command failed}" class TestCheckpointAddNatRule(object): @@ -49,18 +53,22 @@ class TestCheckpointAddNatRule(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_command(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, RETURN_PAYLOAD) result = self._run_module(PAYLOAD) - assert result['changed'] + assert result["changed"] assert RETURN_PAYLOAD == result[command] def test_command_fail(self, mocker, connection_mock): @@ -70,7 +78,10 @@ class TestCheckpointAddNatRule(object): except Exception as e: result = e.args[0] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_address_range.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_address_range.py index 42f494e0f..8194e4287 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_address_range.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_address_range.py @@ -15,42 +15,47 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_address_range +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_address_range, +) OBJECT = { "name": "New Address Range 1", "ip_address_first": "192.0.2.1", - "ip_address_last": "192.0.2.10" + "ip_address_last": "192.0.2.10", } CREATE_PAYLOAD = { "name": "New Address Range 1", "ip_address_first": "192.0.2.1", - "ip_address_last": "192.0.2.10" + "ip_address_last": "192.0.2.10", } UPDATE_PAYLOAD = { "name": "New Address Range 1", "color": "blue", "ip_address_first": "192.0.2.1", - "ip_address_last": "192.0.2.1" + "ip_address_last": "192.0.2.1", } OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD -DELETE_PAYLOAD = { - "name": "New Address Range 1", - "state": "absent" -} +DELETE_PAYLOAD = {"name": "New Address Range 1", "state": "absent"} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_address_range.api_call' -api_call_object = 'address-range' +function_path = "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_address_range.api_call" +api_call_object = "address-range" class TestCheckpointAddressRange(object): @@ -58,56 +63,69 @@ class TestCheckpointAddressRange(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_address_range_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_address_range_facts.py index 9f8da5379..9defd092d 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_address_range_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_address_range_facts.py @@ -15,35 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_address_range_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_address_range_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} -SHOW_SINGLE_PAYLOAD = { - 'name': 'object_which_is_not_exist' -} +SHOW_SINGLE_PAYLOAD = {"name": "object_which_is_not_exist"} -api_call_object = 'address-range' -api_call_object_plural_version = 'address-ranges' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "address-range" +api_call_object_plural_version = "address-ranges" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointAddressRangeFacts(object): @@ -51,29 +52,40 @@ class TestCheckpointAddressRangeFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_administrator.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_administrator.py index 1c1b27145..73a2b85e9 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_administrator.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_administrator.py @@ -15,13 +15,21 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_administrator +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_administrator, +) OBJECT = { "name": "admin", @@ -30,7 +38,7 @@ OBJECT = { "must_change_password": False, "phone_number": "1800-800-800", "authentication_method": "undefined", - "permissions_profile": "read write all" + "permissions_profile": "read write all", } CREATE_PAYLOAD = { @@ -40,24 +48,21 @@ CREATE_PAYLOAD = { "must_change_password": False, "phone_number": "1800-800-800", "authentication_method": "undefined", - "permissions_profile": "read write all" + "permissions_profile": "read write all", } UPDATE_PAYLOAD = { "name": "admin", "password": "bew secret", - "permissions_profile": "read only profile" + "permissions_profile": "read only profile", } OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD -DELETE_PAYLOAD = { - "name": "admin", - "state": "absent" -} +DELETE_PAYLOAD = {"name": "admin", "state": "absent"} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_administrator.api_call' -api_call_object = 'administrator' +function_path = "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_administrator.api_call" +api_call_object = "administrator" class TestCheckpointAdministrator(object): @@ -65,56 +70,69 @@ class TestCheckpointAdministrator(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_administrator_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_administrator_facts.py index 157e2373a..a6a3f19de 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_administrator_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_administrator_facts.py @@ -15,35 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_administrator_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_administrator_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} -SHOW_SINGLE_PAYLOAD = { - 'name': 'object_which_is_not_exist' -} +SHOW_SINGLE_PAYLOAD = {"name": "object_which_is_not_exist"} -api_call_object = 'administrator' -api_call_object_plural_version = 'administrators' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "administrator" +api_call_object_plural_version = "administrators" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointAdministratorFacts(object): @@ -51,29 +52,40 @@ class TestCheckpointAdministratorFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_application_site.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_application_site.py index 7ddf93a27..f99207bcc 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_application_site.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_application_site.py @@ -15,13 +15,21 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_application_site +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_application_site, +) OBJECT = { "name": "New Application Site 1", @@ -30,13 +38,10 @@ OBJECT = { "additional_categories": [ "Instant Chat", "Supports Streaming", - "New Application Site Category 1" - ], - "url_list": [ - "www.cnet.com", - "www.stackoverflow.com" + "New Application Site Category 1", ], - "urls_defined_as_regular_expression": False + "url_list": ["www.cnet.com", "www.stackoverflow.com"], + "urls_defined_as_regular_expression": False, } CREATE_PAYLOAD = { @@ -46,31 +51,25 @@ CREATE_PAYLOAD = { "additional_categories": [ "Instant Chat", "Supports Streaming", - "New Application Site Category 1" - ], - "url_list": [ - "www.cnet.com", - "www.stackoverflow.com" + "New Application Site Category 1", ], - "urls_defined_as_regular_expression": False + "url_list": ["www.cnet.com", "www.stackoverflow.com"], + "urls_defined_as_regular_expression": False, } UPDATE_PAYLOAD = { "name": "New Application Site 1", "description": "My New Application Site", "primary_category": "Instant Chat", - "urls_defined_as_regular_expression": True + "urls_defined_as_regular_expression": True, } OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD -DELETE_PAYLOAD = { - "name": "New Application Site 1", - "state": "absent" -} +DELETE_PAYLOAD = {"name": "New Application Site 1", "state": "absent"} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_application_site.api_call' -api_call_object = 'application-site' +function_path = "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_application_site.api_call" +api_call_object = "application-site" class TestCheckpointApplicationSite(object): @@ -78,56 +77,69 @@ class TestCheckpointApplicationSite(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_application_site_category.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_application_site_category.py index 787e21070..fd2ed8c64 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_application_site_category.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_application_site_category.py @@ -15,38 +15,43 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_application_site_category +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_application_site_category, +) OBJECT = { "name": "New Application Site Category 1", - "description": "My Application Site category" + "description": "My Application Site category", } CREATE_PAYLOAD = { "name": "New Application Site Category 1", - "description": "My Application Site category" + "description": "My Application Site category", } UPDATE_PAYLOAD = { "name": "New Application Site Category 1", - "description": "My new Application Site category" + "description": "My new Application Site category", } OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD -DELETE_PAYLOAD = { - "name": "New Application Site Category 1", - "state": "absent" -} +DELETE_PAYLOAD = {"name": "New Application Site Category 1", "state": "absent"} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_application_site_category.api_call' -api_call_object = 'application-site-category' +function_path = "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_application_site_category.api_call" +api_call_object = "application-site-category" class TestCheckpointApplicationSiteCategory(object): @@ -54,56 +59,69 @@ class TestCheckpointApplicationSiteCategory(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_application_site_category_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_application_site_category_facts.py index a46f05feb..f37c8779a 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_application_site_category_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_application_site_category_facts.py @@ -15,35 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_application_site_category_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_application_site_category_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} -SHOW_SINGLE_PAYLOAD = { - 'name': 'object_which_is_not_exist' -} +SHOW_SINGLE_PAYLOAD = {"name": "object_which_is_not_exist"} -api_call_object = 'application-site-category' -api_call_object_plural_version = 'application-site-categories' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "application-site-category" +api_call_object_plural_version = "application-site-categories" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointApplicationSiteCategoryFacts(object): @@ -51,29 +52,40 @@ class TestCheckpointApplicationSiteCategoryFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_application_site_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_application_site_facts.py index 05f9fcfac..7fa8c25b2 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_application_site_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_application_site_facts.py @@ -15,35 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_application_site_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_application_site_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} -SHOW_SINGLE_PAYLOAD = { - 'name': 'object_which_is_not_exist' -} +SHOW_SINGLE_PAYLOAD = {"name": "object_which_is_not_exist"} -api_call_object = 'application-site' -api_call_object_plural_version = 'application-sites' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "application-site" +api_call_object_plural_version = "application-sites" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointApplicationSiteFacts(object): @@ -51,29 +52,40 @@ class TestCheckpointApplicationSiteFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_application_site_group.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_application_site_group.py index 25c71bb0d..8f3559595 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_application_site_group.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_application_site_group.py @@ -15,13 +15,21 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_application_site_group +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_application_site_group, +) OBJECT = { "name": "New Application Site Group 1", @@ -29,8 +37,8 @@ OBJECT = { "facebook", "Social Networking", "New Application Site 1", - "New Application Site Category 1" - ] + "New Application Site Category 1", + ], } CREATE_PAYLOAD = { @@ -39,23 +47,18 @@ CREATE_PAYLOAD = { "facebook", "Social Networking", "New Application Site 1", - "New Application Site Category 1" - ] + "New Application Site Category 1", + ], } -UPDATE_PAYLOAD = { - "name": "New Application Site Group 1" -} +UPDATE_PAYLOAD = {"name": "New Application Site Group 1"} OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD -DELETE_PAYLOAD = { - "name": "New Application Site Group 1", - "state": "absent" -} +DELETE_PAYLOAD = {"name": "New Application Site Group 1", "state": "absent"} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_application_site_group.api_call' -api_call_object = 'application-site-group' +function_path = "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_application_site_group.api_call" +api_call_object = "application-site-group" class TestCheckpointApplicationSiteGroup(object): @@ -63,56 +66,69 @@ class TestCheckpointApplicationSiteGroup(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_application_site_group_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_application_site_group_facts.py index acc880171..3cc01a13d 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_application_site_group_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_application_site_group_facts.py @@ -15,35 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_application_site_group_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_application_site_group_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} -SHOW_SINGLE_PAYLOAD = { - 'name': 'object_which_is_not_exist' -} +SHOW_SINGLE_PAYLOAD = {"name": "object_which_is_not_exist"} -api_call_object = 'application-site-group' -api_call_object_plural_version = 'application-site-groups' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "application-site-group" +api_call_object_plural_version = "application-site-groups" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointApplicationSiteGroupFacts(object): @@ -51,29 +52,40 @@ class TestCheckpointApplicationSiteGroupFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_assign_global_assignment.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_assign_global_assignment.py index 59b9245e1..f7f62bfeb 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_assign_global_assignment.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_assign_global_assignment.py @@ -15,26 +15,32 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_assign_global_assignment +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_assign_global_assignment, +) PAYLOAD = { "global_domains": "Global2", "dependent_domains": "domain1", - "wait_for_task": False + "wait_for_task": False, } -RETURN_PAYLOAD = { - "task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad" -} +RETURN_PAYLOAD = {"task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad"} -command = 'assign-global-assignment' -failure_msg = '{command failed}' +command = "assign-global-assignment" +failure_msg = "{command failed}" class TestCheckpointAssignGlobalAssignment(object): @@ -42,18 +48,22 @@ class TestCheckpointAssignGlobalAssignment(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_command(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, RETURN_PAYLOAD) result = self._run_module(PAYLOAD) - assert result['changed'] + assert result["changed"] assert RETURN_PAYLOAD == result[command] def test_command_fail(self, mocker, connection_mock): @@ -63,7 +73,10 @@ class TestCheckpointAssignGlobalAssignment(object): except Exception as e: result = e.args[0] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_data_center_object_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_data_center_object_facts.py index 4a5ac2ec7..081c01b0c 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_data_center_object_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_data_center_object_facts.py @@ -15,35 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_data_center_object_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_data_center_object_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} -SHOW_SINGLE_PAYLOAD = { - 'name': 'object_which_is_not_exist' -} +SHOW_SINGLE_PAYLOAD = {"name": "object_which_is_not_exist"} -api_call_object = 'data-center-object' -api_call_object_plural_version = 'data-center-objects' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "data-center-object" +api_call_object_plural_version = "data-center-objects" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointDataCenterObjectFacts(object): @@ -51,29 +52,40 @@ class TestCheckpointDataCenterObjectFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_delete_api_key.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_delete_api_key.py index 3fe6f254d..ada03a23f 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_delete_api_key.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_delete_api_key.py @@ -15,25 +15,31 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_delete_api_key +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_delete_api_key, +) PAYLOAD = { "api_key": "eea3be76f4a8eb740ee872bcedc692748ff256a2d21c9ffd2754facbde046d00", - "wait_for_task": False + "wait_for_task": False, } -RETURN_PAYLOAD = { - "task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad" -} +RETURN_PAYLOAD = {"task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad"} -command = 'delete-api-key' -failure_msg = '{command failed}' +command = "delete-api-key" +failure_msg = "{command failed}" class TestCheckpointDeleteApiKey(object): @@ -41,18 +47,22 @@ class TestCheckpointDeleteApiKey(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_command(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, RETURN_PAYLOAD) result = self._run_module(PAYLOAD) - assert result['changed'] + assert result["changed"] assert RETURN_PAYLOAD == result[command] def test_command_fail(self, mocker, connection_mock): @@ -62,7 +72,10 @@ class TestCheckpointDeleteApiKey(object): except Exception as e: result = e.args[0] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_delete_data_center_object.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_delete_data_center_object.py index 192307721..d179b9391 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_delete_data_center_object.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_delete_data_center_object.py @@ -15,25 +15,28 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_delete_data_center_object +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_delete_data_center_object, +) -PAYLOAD = { - "name": "VM1 mgmt name", - "wait_for_task": False -} +PAYLOAD = {"name": "VM1 mgmt name", "wait_for_task": False} -RETURN_PAYLOAD = { - "task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad" -} +RETURN_PAYLOAD = {"task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad"} -command = 'delete-data-center-object' -failure_msg = '{command failed}' +command = "delete-data-center-object" +failure_msg = "{command failed}" class TestCheckpointDeleteDataCenterObject(object): @@ -41,18 +44,22 @@ class TestCheckpointDeleteDataCenterObject(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_command(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, RETURN_PAYLOAD) result = self._run_module(PAYLOAD) - assert result['changed'] + assert result["changed"] assert RETURN_PAYLOAD == result[command] def test_command_fail(self, mocker, connection_mock): @@ -62,7 +69,10 @@ class TestCheckpointDeleteDataCenterObject(object): except Exception as e: result = e.args[0] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_delete_nat_rule.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_delete_nat_rule.py index 9fbfae566..b83c3b8a7 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_delete_nat_rule.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_delete_nat_rule.py @@ -15,25 +15,28 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_delete_nat_rule +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_delete_nat_rule, +) -PAYLOAD = { - "package": "standard", - "wait_for_task": False -} +PAYLOAD = {"package": "standard", "wait_for_task": False} -RETURN_PAYLOAD = { - "task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad" -} +RETURN_PAYLOAD = {"task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad"} -command = 'delete-nat-rule' -failure_msg = '{command failed}' +command = "delete-nat-rule" +failure_msg = "{command failed}" class TestCheckpointDeleteNatRule(object): @@ -41,18 +44,22 @@ class TestCheckpointDeleteNatRule(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_command(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, RETURN_PAYLOAD) result = self._run_module(PAYLOAD) - assert result['changed'] + assert result["changed"] assert RETURN_PAYLOAD == result[command] def test_command_fail(self, mocker, connection_mock): @@ -62,7 +69,10 @@ class TestCheckpointDeleteNatRule(object): except Exception as e: result = e.args[0] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_discard.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_discard.py index 052b482e2..78988ecc4 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_discard.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_discard.py @@ -15,24 +15,28 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_discard +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_discard, +) -PAYLOAD = { - "wait_for_task": False -} +PAYLOAD = {"wait_for_task": False} -RETURN_PAYLOAD = { - "task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad" -} +RETURN_PAYLOAD = {"task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad"} -command = 'discard' -failure_msg = '{command failed}' +command = "discard" +failure_msg = "{command failed}" class TestCheckpointDiscard(object): @@ -40,18 +44,22 @@ class TestCheckpointDiscard(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_command(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, RETURN_PAYLOAD) result = self._run_module(PAYLOAD) - assert result['changed'] + assert result["changed"] assert RETURN_PAYLOAD == result[command] def test_command_fail(self, mocker, connection_mock): @@ -61,7 +69,10 @@ class TestCheckpointDiscard(object): except Exception as e: result = e.args[0] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_dns_domain.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_dns_domain.py index 09b03155f..8cc857b88 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_dns_domain.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_dns_domain.py @@ -15,38 +15,34 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_dns_domain +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_dns_domain, +) -OBJECT = { - "name": ".www.example.com", - "is_sub_domain": False -} +OBJECT = {"name": ".www.example.com", "is_sub_domain": False} -CREATE_PAYLOAD = { - "name": ".www.example.com", - "is_sub_domain": False -} +CREATE_PAYLOAD = {"name": ".www.example.com", "is_sub_domain": False} -UPDATE_PAYLOAD = { - "name": ".www.example.com", - "is_sub_domain": True -} +UPDATE_PAYLOAD = {"name": ".www.example.com", "is_sub_domain": True} OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD -DELETE_PAYLOAD = { - "name": ".www.example.com", - "state": "absent" -} +DELETE_PAYLOAD = {"name": ".www.example.com", "state": "absent"} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_dns_domain.api_call' -api_call_object = 'dns-domain' +function_path = "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_dns_domain.api_call" +api_call_object = "dns-domain" class TestCheckpointDnsDomain(object): @@ -54,56 +50,69 @@ class TestCheckpointDnsDomain(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_dns_domain_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_dns_domain_facts.py index 3cfbe62b1..1eace501e 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_dns_domain_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_dns_domain_facts.py @@ -15,35 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_dns_domain_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_dns_domain_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} -SHOW_SINGLE_PAYLOAD = { - 'name': 'object_which_is_not_exist' -} +SHOW_SINGLE_PAYLOAD = {"name": "object_which_is_not_exist"} -api_call_object = 'dns-domain' -api_call_object_plural_version = 'dns-domains' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "dns-domain" +api_call_object_plural_version = "dns-domains" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointDnsDomainFacts(object): @@ -51,29 +52,40 @@ class TestCheckpointDnsDomainFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_dynamic_object.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_dynamic_object.py index f168d60d6..11bf9c5e7 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_dynamic_object.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_dynamic_object.py @@ -15,39 +15,42 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_dynamic_object +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_dynamic_object, +) OBJECT = { "name": "Dynamic_Object_1", "comments": "My Dynamic Object 1", - "color": "yellow" + "color": "yellow", } CREATE_PAYLOAD = { "name": "Dynamic_Object_1", "comments": "My Dynamic Object 1", - "color": "yellow" + "color": "yellow", } -UPDATE_PAYLOAD = { - "name": "Dynamic_Object_1" -} +UPDATE_PAYLOAD = {"name": "Dynamic_Object_1"} OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD -DELETE_PAYLOAD = { - "name": "Dynamic_Object_1", - "state": "absent" -} +DELETE_PAYLOAD = {"name": "Dynamic_Object_1", "state": "absent"} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_dynamic_object.api_call' -api_call_object = 'dynamic-object' +function_path = "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_dynamic_object.api_call" +api_call_object = "dynamic-object" class TestCheckpointDynamicObject(object): @@ -55,56 +58,69 @@ class TestCheckpointDynamicObject(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_dynamic_object_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_dynamic_object_facts.py index add11efde..4af4120f0 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_dynamic_object_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_dynamic_object_facts.py @@ -15,35 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_dynamic_object_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_dynamic_object_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} -SHOW_SINGLE_PAYLOAD = { - 'name': 'object_which_is_not_exist' -} +SHOW_SINGLE_PAYLOAD = {"name": "object_which_is_not_exist"} -api_call_object = 'dynamic-object' -api_call_object_plural_version = 'dynamic-objects' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "dynamic-object" +api_call_object_plural_version = "dynamic-objects" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointDynamicObjectFacts(object): @@ -51,29 +52,40 @@ class TestCheckpointDynamicObjectFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_exception_group.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_exception_group.py index 7fa127fd3..3451e04aa 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_exception_group.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_exception_group.py @@ -15,39 +15,44 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_exception_group +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_exception_group, +) OBJECT = { "name": "exception_group_2", - "apply_on": "manually-select-threat-rules" + "apply_on": "manually-select-threat-rules", } CREATE_PAYLOAD = { "name": "exception_group_2", - "apply_on": "manually-select-threat-rules" + "apply_on": "manually-select-threat-rules", } UPDATE_PAYLOAD = { "name": "exception_group_2", "tags": "tag3", - "apply_on": "all-threat-rules" + "apply_on": "all-threat-rules", } OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD -DELETE_PAYLOAD = { - "name": "exception_group_2", - "state": "absent" -} +DELETE_PAYLOAD = {"name": "exception_group_2", "state": "absent"} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_exception_group.api_call' -api_call_object = 'exception-group' +function_path = "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_exception_group.api_call" +api_call_object = "exception-group" class TestCheckpointExceptionGroup(object): @@ -55,56 +60,69 @@ class TestCheckpointExceptionGroup(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_exception_group_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_exception_group_facts.py index dc3a56ba6..9775d75a7 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_exception_group_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_exception_group_facts.py @@ -15,35 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_exception_group_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_exception_group_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} -SHOW_SINGLE_PAYLOAD = { - 'name': 'object_which_is_not_exist' -} +SHOW_SINGLE_PAYLOAD = {"name": "object_which_is_not_exist"} -api_call_object = 'exception-group' -api_call_object_plural_version = 'exception-groups' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "exception-group" +api_call_object_plural_version = "exception-groups" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointExceptionGroupFacts(object): @@ -51,29 +52,40 @@ class TestCheckpointExceptionGroupFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_global_assignment.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_global_assignment.py index 633059c83..d275328a3 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_global_assignment.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_global_assignment.py @@ -15,20 +15,28 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_global_assignment +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_global_assignment, +) OBJECT = { "global_domain": "Global", "dependent_domain": "domain2", "global_access_policy": "standard", "global_threat_prevention_policy": "standard", - "manage_protection_actions": True + "manage_protection_actions": True, } CREATE_PAYLOAD = { @@ -36,22 +44,22 @@ CREATE_PAYLOAD = { "dependent_domain": "domain2", "global_access_policy": "standard", "global_threat_prevention_policy": "standard", - "manage_protection_actions": True + "manage_protection_actions": True, } UPDATE_PAYLOAD = { "global_domain": "Global2", "dependent_domain": "domain1", "global_threat_prevention_policy": "", - "manage_protection_actions": False + "manage_protection_actions": False, } OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD DELETE_PAYLOAD = {} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_global_assignment.api_call' -api_call_object = 'global-assignment' +function_path = "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_global_assignment.api_call" +api_call_object = "global-assignment" class TestCheckpointGlobalAssignment(object): @@ -59,56 +67,69 @@ class TestCheckpointGlobalAssignment(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_global_assignment_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_global_assignment_facts.py index a997ab8d3..77b31801b 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_global_assignment_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_global_assignment_facts.py @@ -15,33 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_global_assignment_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_global_assignment_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} SHOW_SINGLE_PAYLOAD = {} -api_call_object = 'global-assignment' -api_call_object_plural_version = 'global-assignments' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "global-assignment" +api_call_object_plural_version = "global-assignments" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointGlobalAssignmentFacts(object): @@ -49,29 +52,40 @@ class TestCheckpointGlobalAssignmentFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_group.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_group.py index 07af4db9a..bdbca543c 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_group.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_group.py @@ -15,43 +15,35 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_group -OBJECT = { - "name": "New Group 5", - "members": [ - "New Host 1", - "My Test Host 3" - ] -} +OBJECT = {"name": "New Group 5", "members": ["New Host 1", "My Test Host 3"]} CREATE_PAYLOAD = { "name": "New Group 5", - "members": [ - "New Host 1", - "My Test Host 3" - ] + "members": ["New Host 1", "My Test Host 3"], } -UPDATE_PAYLOAD = { - "name": "New Group 5" -} +UPDATE_PAYLOAD = {"name": "New Group 5"} OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD -DELETE_PAYLOAD = { - "name": "New Group 5", - "state": "absent" -} +DELETE_PAYLOAD = {"name": "New Group 5", "state": "absent"} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_group.api_call' -api_call_object = 'group' +function_path = "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_group.api_call" +api_call_object = "group" class TestCheckpointGroup(object): @@ -59,56 +51,69 @@ class TestCheckpointGroup(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_group_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_group_facts.py index e85b6b74c..9b129c737 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_group_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_group_facts.py @@ -15,35 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_group_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_group_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} -SHOW_SINGLE_PAYLOAD = { - 'name': 'object_which_is_not_exist' -} +SHOW_SINGLE_PAYLOAD = {"name": "object_which_is_not_exist"} -api_call_object = 'group' -api_call_object_plural_version = 'groups' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "group" +api_call_object_plural_version = "groups" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointGroupFacts(object): @@ -51,29 +52,40 @@ class TestCheckpointGroupFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_group_with_exclusion.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_group_with_exclusion.py index 188fd75ba..bd7492940 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_group_with_exclusion.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_group_with_exclusion.py @@ -15,41 +15,46 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_group_with_exclusion +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_group_with_exclusion, +) OBJECT = { "name": "Group with exclusion", "include": "New Group 1", - "except": "New Group 2" + "except": "New Group 2", } CREATE_PAYLOAD = { "name": "Group with exclusion", "include": "New Group 1", - "except": "New Group 2" + "except": "New Group 2", } UPDATE_PAYLOAD = { "name": "Group with exclusion", "include": "New Group 2", - "except": "New Group 1" + "except": "New Group 1", } OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD -DELETE_PAYLOAD = { - "name": "Group with exclusion", - "state": "absent" -} +DELETE_PAYLOAD = {"name": "Group with exclusion", "state": "absent"} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_group_with_exclusion.api_call' -api_call_object = 'group-with-exclusion' +function_path = "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_group_with_exclusion.api_call" +api_call_object = "group-with-exclusion" class TestCheckpointGroupWithExclusion(object): @@ -57,56 +62,69 @@ class TestCheckpointGroupWithExclusion(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_group_with_exclusion_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_group_with_exclusion_facts.py index e819625f6..f5652a767 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_group_with_exclusion_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_group_with_exclusion_facts.py @@ -15,35 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_group_with_exclusion_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_group_with_exclusion_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} -SHOW_SINGLE_PAYLOAD = { - 'name': 'object_which_is_not_exist' -} +SHOW_SINGLE_PAYLOAD = {"name": "object_which_is_not_exist"} -api_call_object = 'group-with-exclusion' -api_call_object_plural_version = 'groups-with-exclusion' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "group-with-exclusion" +api_call_object_plural_version = "groups-with-exclusion" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointGroupWithExclusionFacts(object): @@ -51,29 +52,40 @@ class TestCheckpointGroupWithExclusionFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_host.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_host.py index abaa9e3b0..ae91a4e5b 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_host.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_host.py @@ -15,39 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_host -OBJECT = { - "name": "New Host 1", - "ip_address": "192.0.2.1" -} +OBJECT = {"name": "New Host 1", "ip_address": "192.0.2.1"} -CREATE_PAYLOAD = { - "name": "New Host 1", - "ip_address": "192.0.2.1" -} +CREATE_PAYLOAD = {"name": "New Host 1", "ip_address": "192.0.2.1"} UPDATE_PAYLOAD = { "name": "New Host 1", "color": "blue", - "ipv4_address": "192.0.2.2" + "ipv4_address": "192.0.2.2", } OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD -DELETE_PAYLOAD = { - "name": "New Host 1", - "state": "absent" -} +DELETE_PAYLOAD = {"name": "New Host 1", "state": "absent"} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_host.api_call' -api_call_object = 'host' +function_path = "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_host.api_call" +api_call_object = "host" class TestCheckpointHost(object): @@ -55,56 +52,69 @@ class TestCheckpointHost(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_host_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_host_facts.py index 182aa81e7..3c050b727 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_host_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_host_facts.py @@ -15,35 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_host_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_host_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} -SHOW_SINGLE_PAYLOAD = { - 'name': 'object_which_is_not_exist' -} +SHOW_SINGLE_PAYLOAD = {"name": "object_which_is_not_exist"} -api_call_object = 'host' -api_call_object_plural_version = 'hosts' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "host" +api_call_object_plural_version = "hosts" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointHostFacts(object): @@ -51,29 +52,40 @@ class TestCheckpointHostFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_https_section.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_https_section.py index 3dc063a35..5cdbe0d48 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_https_section.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_https_section.py @@ -15,40 +15,38 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_https_section +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_https_section, +) -OBJECT = { - "layer": "Default Layer", - "position": 1, - "name": "New Section 1" -} +OBJECT = {"layer": "Default Layer", "position": 1, "name": "New Section 1"} CREATE_PAYLOAD = { "layer": "Default Layer", "position": 1, - "name": "New Section 1" + "name": "New Section 1", } -UPDATE_PAYLOAD = { - "layer": "Default Layer", - "name": "New Section 1" -} +UPDATE_PAYLOAD = {"layer": "Default Layer", "name": "New Section 1"} OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD -DELETE_PAYLOAD = { - "name": "New Section 1", - "state": "absent" -} +DELETE_PAYLOAD = {"name": "New Section 1", "state": "absent"} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_https_section.api_call' -api_call_object = 'https-section' +function_path = "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_https_section.api_call" +api_call_object = "https-section" class TestCheckpointHttpsSection(object): @@ -56,56 +54,69 @@ class TestCheckpointHttpsSection(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_install_policy.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_install_policy.py index 3086f5c96..f82172e39 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_install_policy.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_install_policy.py @@ -15,30 +15,34 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_install_policy +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_install_policy, +) PAYLOAD = { "access": True, - "targets": [ - "corporate-gateway" - ], + "targets": ["corporate-gateway"], "policy_package": "standard", "threat_prevention": True, - "wait_for_task": False + "wait_for_task": False, } -RETURN_PAYLOAD = { - "task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad" -} +RETURN_PAYLOAD = {"task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad"} -command = 'install-policy' -failure_msg = '{command failed}' +command = "install-policy" +failure_msg = "{command failed}" class TestCheckpointInstallPolicy(object): @@ -46,18 +50,22 @@ class TestCheckpointInstallPolicy(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_command(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, RETURN_PAYLOAD) result = self._run_module(PAYLOAD) - assert result['changed'] + assert result["changed"] assert RETURN_PAYLOAD == result[command] def test_command_fail(self, mocker, connection_mock): @@ -67,7 +75,10 @@ class TestCheckpointInstallPolicy(object): except Exception as e: result = e.args[0] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_install_software_package.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_install_software_package.py index 4442abbc9..0b1e25404 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_install_software_package.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_install_software_package.py @@ -15,25 +15,31 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_install_software_package +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_install_software_package, +) PAYLOAD = { "name": "Check_Point_R80_40_JHF_MCD_DEMO_019_MAIN_Bundle_T1_VISIBLE_FULL.tgz", - "wait_for_task": False + "wait_for_task": False, } -RETURN_PAYLOAD = { - "task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad" -} +RETURN_PAYLOAD = {"task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad"} -command = 'install-software-package' -failure_msg = '{command failed}' +command = "install-software-package" +failure_msg = "{command failed}" class TestCheckpointInstallSoftwarePackage(object): @@ -41,18 +47,22 @@ class TestCheckpointInstallSoftwarePackage(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_command(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, RETURN_PAYLOAD) result = self._run_module(PAYLOAD) - assert result['changed'] + assert result["changed"] assert RETURN_PAYLOAD == result[command] def test_command_fail(self, mocker, connection_mock): @@ -62,7 +72,10 @@ class TestCheckpointInstallSoftwarePackage(object): except Exception as e: result = e.args[0] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_mds_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_mds_facts.py index 938e4a498..0a874b9b6 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_mds_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_mds_facts.py @@ -15,35 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_mds_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_mds_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} -SHOW_SINGLE_PAYLOAD = { - 'name': 'object_which_is_not_exist' -} +SHOW_SINGLE_PAYLOAD = {"name": "object_which_is_not_exist"} -api_call_object = 'mds' -api_call_object_plural_version = 'mdss' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "mds" +api_call_object_plural_version = "mdss" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointMdsFacts(object): @@ -51,29 +52,40 @@ class TestCheckpointMdsFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_multicast_address_range.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_multicast_address_range.py index 8a68f9019..d5346f869 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_multicast_address_range.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_multicast_address_range.py @@ -15,41 +15,46 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_multicast_address_range +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_multicast_address_range, +) OBJECT = { "name": "New Multicast Address Range", "ip_address_first": "224.0.0.1", - "ip_address_last": "224.0.0.4" + "ip_address_last": "224.0.0.4", } CREATE_PAYLOAD = { "name": "New Multicast Address Range", "ip_address_first": "224.0.0.1", - "ip_address_last": "224.0.0.4" + "ip_address_last": "224.0.0.4", } UPDATE_PAYLOAD = { "name": "New Multicast Address Range", "ip_address_first": "224.0.0.7", - "ip_address_last": "224.0.0.10" + "ip_address_last": "224.0.0.10", } OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD -DELETE_PAYLOAD = { - "name": "New Multicast Address Range", - "state": "absent" -} +DELETE_PAYLOAD = {"name": "New Multicast Address Range", "state": "absent"} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_multicast_address_range.api_call' -api_call_object = 'multicast-address-range' +function_path = "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_multicast_address_range.api_call" +api_call_object = "multicast-address-range" class TestCheckpointMulticastAddressRange(object): @@ -57,56 +62,69 @@ class TestCheckpointMulticastAddressRange(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_multicast_address_range_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_multicast_address_range_facts.py index 3de8fa060..70fc8cb96 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_multicast_address_range_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_multicast_address_range_facts.py @@ -15,35 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_multicast_address_range_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_multicast_address_range_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} -SHOW_SINGLE_PAYLOAD = { - 'name': 'object_which_is_not_exist' -} +SHOW_SINGLE_PAYLOAD = {"name": "object_which_is_not_exist"} -api_call_object = 'multicast-address-range' -api_call_object_plural_version = 'multicast-address-ranges' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "multicast-address-range" +api_call_object_plural_version = "multicast-address-ranges" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointMulticastAddressRangeFacts(object): @@ -51,29 +52,40 @@ class TestCheckpointMulticastAddressRangeFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_nat_rule_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_nat_rule_facts.py index eae9cf61a..62c354f23 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_nat_rule_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_nat_rule_facts.py @@ -15,35 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_nat_rule_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_nat_rule_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} -SHOW_SINGLE_PAYLOAD = { - 'name': 'object_which_is_not_exist' -} +SHOW_SINGLE_PAYLOAD = {"name": "object_which_is_not_exist"} -api_call_object = 'nat-rule' -api_call_object_plural_version = 'nat-rulebase' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "nat-rule" +api_call_object_plural_version = "nat-rulebase" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointNatRuleFacts(object): @@ -51,29 +52,40 @@ class TestCheckpointNatRuleFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_nat_section.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_nat_section.py index d666ca88f..def51683b 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_nat_section.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_nat_section.py @@ -15,40 +15,38 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_nat_section +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_nat_section, +) -OBJECT = { - "package": "standard", - "name": "New Section 1", - "position": 1 -} +OBJECT = {"package": "standard", "name": "New Section 1", "position": 1} CREATE_PAYLOAD = { "package": "standard", "name": "New Section 1", - "position": 1 + "position": 1, } -UPDATE_PAYLOAD = { - "package": "standard", - "name": "New Section 1" -} +UPDATE_PAYLOAD = {"package": "standard", "name": "New Section 1"} OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD -DELETE_PAYLOAD = { - "name": "New Section 1", - "state": "absent" -} +DELETE_PAYLOAD = {"name": "New Section 1", "state": "absent"} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_nat_section.api_call' -api_call_object = 'nat-section' +function_path = "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_nat_section.api_call" +api_call_object = "nat-section" class TestCheckpointNatSection(object): @@ -56,56 +54,69 @@ class TestCheckpointNatSection(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_network.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_network.py index 0935108fc..fedbbd8ea 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_network.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_network.py @@ -15,42 +15,47 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_network +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_network, +) OBJECT = { "name": "New Network 1", "subnet": "192.0.2.0", - "subnet_mask": "255.255.255.0" + "subnet_mask": "255.255.255.0", } CREATE_PAYLOAD = { "name": "New Network 1", "subnet": "192.0.2.0", - "subnet_mask": "255.255.255.0" + "subnet_mask": "255.255.255.0", } UPDATE_PAYLOAD = { "name": "New Network 1", "color": "blue", "subnet": "192.0.0.0", - "mask_length": 16 + "mask_length": 16, } OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD -DELETE_PAYLOAD = { - "name": "New Network 1", - "state": "absent" -} +DELETE_PAYLOAD = {"name": "New Network 1", "state": "absent"} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_network.api_call' -api_call_object = 'network' +function_path = "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_network.api_call" +api_call_object = "network" class TestCheckpointNetwork(object): @@ -58,56 +63,69 @@ class TestCheckpointNetwork(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_network_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_network_facts.py index 1302dbba1..05bf7df6c 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_network_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_network_facts.py @@ -15,35 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_network_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_network_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} -SHOW_SINGLE_PAYLOAD = { - 'name': 'object_which_is_not_exist' -} +SHOW_SINGLE_PAYLOAD = {"name": "object_which_is_not_exist"} -api_call_object = 'network' -api_call_object_plural_version = 'networks' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "network" +api_call_object_plural_version = "networks" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointNetworkFacts(object): @@ -51,29 +52,40 @@ class TestCheckpointNetworkFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_package.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_package.py index dd389dad4..4e8f93e47 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_package.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_package.py @@ -15,20 +15,28 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_package +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_package, +) OBJECT = { "name": "New_Standard_Package_1", "comments": "My Comments", "color": "orange", "access": True, - "threat_prevention": False + "threat_prevention": False, } CREATE_PAYLOAD = { @@ -36,38 +44,21 @@ CREATE_PAYLOAD = { "comments": "My Comments", "color": "orange", "access": True, - "threat_prevention": False + "threat_prevention": False, } UPDATE_PAYLOAD = { "name": "New_Standard_Package_1", - "access_layers": { - "add": [ - { - "name": "New Access Layer 1", - "position": 1 - } - ] - }, - "threat_layers": { - "add": [ - { - "name": "New Layer 1", - "position": 2 - } - ] - } + "access_layers": {"add": [{"name": "New Access Layer 1", "position": 1}]}, + "threat_layers": {"add": [{"name": "New Layer 1", "position": 2}]}, } OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD -DELETE_PAYLOAD = { - "name": "New_Standard_Package_1", - "state": "absent" -} +DELETE_PAYLOAD = {"name": "New_Standard_Package_1", "state": "absent"} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_package.api_call' -api_call_object = 'package' +function_path = "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_package.api_call" +api_call_object = "package" class TestCheckpointPackage(object): @@ -75,56 +66,69 @@ class TestCheckpointPackage(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_package_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_package_facts.py index fbb825b32..0040fb9b2 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_package_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_package_facts.py @@ -15,35 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_package_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_package_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} -SHOW_SINGLE_PAYLOAD = { - 'name': 'object_which_is_not_exist' -} +SHOW_SINGLE_PAYLOAD = {"name": "object_which_is_not_exist"} -api_call_object = 'package' -api_call_object_plural_version = 'packages' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "package" +api_call_object_plural_version = "packages" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointPackageFacts(object): @@ -51,29 +52,40 @@ class TestCheckpointPackageFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_publish.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_publish.py index bcce0851c..18016e26e 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_publish.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_publish.py @@ -15,24 +15,28 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_publish +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_publish, +) -PAYLOAD = { - "wait_for_task": False -} +PAYLOAD = {"wait_for_task": False} -RETURN_PAYLOAD = { - "task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad" -} +RETURN_PAYLOAD = {"task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad"} -command = 'publish' -failure_msg = '{command failed}' +command = "publish" +failure_msg = "{command failed}" class TestCheckpointPublish(object): @@ -40,18 +44,22 @@ class TestCheckpointPublish(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_command(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, RETURN_PAYLOAD) result = self._run_module(PAYLOAD) - assert result['changed'] + assert result["changed"] assert RETURN_PAYLOAD == result[command] def test_command_fail(self, mocker, connection_mock): @@ -61,7 +69,10 @@ class TestCheckpointPublish(object): except Exception as e: result = e.args[0] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_put_file.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_put_file.py index 7ad11efa7..0364e2885 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_put_file.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_put_file.py @@ -15,30 +15,34 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_put_file +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_put_file, +) PAYLOAD = { - "targets": [ - "corporate-gateway" - ], + "targets": ["corporate-gateway"], "file_path": "/home/admin/", "file_name": "vsx_conf", "file_content": "vs ip 192.0.2.1\nvs2 ip 192.0.2.2", - "wait_for_task": False + "wait_for_task": False, } -RETURN_PAYLOAD = { - "task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad" -} +RETURN_PAYLOAD = {"task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad"} -command = 'put-file' -failure_msg = '{command failed}' +command = "put-file" +failure_msg = "{command failed}" class TestCheckpointPutFile(object): @@ -46,18 +50,22 @@ class TestCheckpointPutFile(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_command(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, RETURN_PAYLOAD) result = self._run_module(PAYLOAD) - assert result['changed'] + assert result["changed"] assert RETURN_PAYLOAD == result[command] def test_command_fail(self, mocker, connection_mock): @@ -67,7 +75,10 @@ class TestCheckpointPutFile(object): except Exception as e: result = e.args[0] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_run_ips_update.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_run_ips_update.py index 7202790a5..69c322fc0 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_run_ips_update.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_run_ips_update.py @@ -15,24 +15,28 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_run_ips_update +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_run_ips_update, +) -PAYLOAD = { - "wait_for_task": False -} +PAYLOAD = {"wait_for_task": False} -RETURN_PAYLOAD = { - "task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad" -} +RETURN_PAYLOAD = {"task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad"} -command = 'run-ips-update' -failure_msg = '{command failed}' +command = "run-ips-update" +failure_msg = "{command failed}" class TestCheckpointRunIpsUpdate(object): @@ -40,18 +44,22 @@ class TestCheckpointRunIpsUpdate(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_command(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, RETURN_PAYLOAD) result = self._run_module(PAYLOAD) - assert result['changed'] + assert result["changed"] assert RETURN_PAYLOAD == result[command] def test_command_fail(self, mocker, connection_mock): @@ -61,7 +69,10 @@ class TestCheckpointRunIpsUpdate(object): except Exception as e: result = e.args[0] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_run_script.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_run_script.py index 730b5bffa..b168aacf0 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_run_script.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_run_script.py @@ -15,29 +15,33 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_run_script +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_run_script, +) PAYLOAD = { "script": "ls -l /", - "targets": [ - "corporate-gateway" - ], + "targets": ["corporate-gateway"], "script_name": "Script Example: List files under / dir", - "wait_for_task": False + "wait_for_task": False, } -RETURN_PAYLOAD = { - "task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad" -} +RETURN_PAYLOAD = {"task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad"} -command = 'run-script' -failure_msg = '{command failed}' +command = "run-script" +failure_msg = "{command failed}" class TestCheckpointRunScript(object): @@ -45,18 +49,22 @@ class TestCheckpointRunScript(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_command(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, RETURN_PAYLOAD) result = self._run_module(PAYLOAD) - assert result['changed'] + assert result["changed"] assert RETURN_PAYLOAD == result[command] def test_command_fail(self, mocker, connection_mock): @@ -66,7 +74,10 @@ class TestCheckpointRunScript(object): except Exception as e: result = e.args[0] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_security_zone.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_security_zone.py index 13ef758b7..ec11e2eb6 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_security_zone.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_security_zone.py @@ -15,39 +15,42 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_security_zone +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_security_zone, +) OBJECT = { "name": "SZone1", "comments": "My Security Zone 1", - "color": "yellow" + "color": "yellow", } CREATE_PAYLOAD = { "name": "SZone1", "comments": "My Security Zone 1", - "color": "yellow" + "color": "yellow", } -UPDATE_PAYLOAD = { - "name": "SZone1" -} +UPDATE_PAYLOAD = {"name": "SZone1"} OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD -DELETE_PAYLOAD = { - "name": "SZone1", - "state": "absent" -} +DELETE_PAYLOAD = {"name": "SZone1", "state": "absent"} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_security_zone.api_call' -api_call_object = 'security-zone' +function_path = "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_security_zone.api_call" +api_call_object = "security-zone" class TestCheckpointSecurityZone(object): @@ -55,56 +58,69 @@ class TestCheckpointSecurityZone(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_security_zone_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_security_zone_facts.py index 3fa95f4d3..c2bc3d4d7 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_security_zone_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_security_zone_facts.py @@ -15,35 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_security_zone_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_security_zone_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} -SHOW_SINGLE_PAYLOAD = { - 'name': 'object_which_is_not_exist' -} +SHOW_SINGLE_PAYLOAD = {"name": "object_which_is_not_exist"} -api_call_object = 'security-zone' -api_call_object_plural_version = 'security-zones' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "security-zone" +api_call_object_plural_version = "security-zones" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointSecurityZoneFacts(object): @@ -51,29 +52,40 @@ class TestCheckpointSecurityZoneFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_dce_rpc.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_dce_rpc.py index d8fd216a7..89043c4cd 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_dce_rpc.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_dce_rpc.py @@ -15,41 +15,46 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_service_dce_rpc +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_service_dce_rpc, +) OBJECT = { "name": "New_DCE-RPC_Service_1", "interface_uuid": "97aeb460-9aea-11d5-bd16-0090272ccb30", - "keep_connections_open_after_policy_installation": False + "keep_connections_open_after_policy_installation": False, } CREATE_PAYLOAD = { "name": "New_DCE-RPC_Service_1", "interface_uuid": "97aeb460-9aea-11d5-bd16-0090272ccb30", - "keep_connections_open_after_policy_installation": False + "keep_connections_open_after_policy_installation": False, } UPDATE_PAYLOAD = { "name": "New_DCE-RPC_Service_1", "color": "blue", - "interface_uuid": "44aeb460-9aea-11d5-bd16-009027266b30" + "interface_uuid": "44aeb460-9aea-11d5-bd16-009027266b30", } OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD -DELETE_PAYLOAD = { - "name": "New_DCE-RPC_Service_1", - "state": "absent" -} +DELETE_PAYLOAD = {"name": "New_DCE-RPC_Service_1", "state": "absent"} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_service_dce_rpc.api_call' -api_call_object = 'service-dce-rpc' +function_path = "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_service_dce_rpc.api_call" +api_call_object = "service-dce-rpc" class TestCheckpointServiceDceRpc(object): @@ -57,56 +62,69 @@ class TestCheckpointServiceDceRpc(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_dce_rpc_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_dce_rpc_facts.py index f06c615a3..8771a6a46 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_dce_rpc_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_dce_rpc_facts.py @@ -15,35 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_service_dce_rpc_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_service_dce_rpc_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} -SHOW_SINGLE_PAYLOAD = { - 'name': 'object_which_is_not_exist' -} +SHOW_SINGLE_PAYLOAD = {"name": "object_which_is_not_exist"} -api_call_object = 'service-dce-rpc' -api_call_object_plural_version = 'services-dce-rpc' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "service-dce-rpc" +api_call_object_plural_version = "services-dce-rpc" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointServiceDceRpcFacts(object): @@ -51,29 +52,40 @@ class TestCheckpointServiceDceRpcFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_group.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_group.py index f325f873f..df408aa9e 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_group.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_group.py @@ -15,47 +15,40 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_service_group +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_service_group, +) OBJECT = { "name": "New Service Group 1", - "members": [ - "https", - "bootp", - "nisplus", - "HP-OpCdistm" - ] + "members": ["https", "bootp", "nisplus", "HP-OpCdistm"], } CREATE_PAYLOAD = { "name": "New Service Group 1", - "members": [ - "https", - "bootp", - "nisplus", - "HP-OpCdistm" - ] + "members": ["https", "bootp", "nisplus", "HP-OpCdistm"], } -UPDATE_PAYLOAD = { - "name": "New Service Group 1" -} +UPDATE_PAYLOAD = {"name": "New Service Group 1"} OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD -DELETE_PAYLOAD = { - "name": "New Service Group 1", - "state": "absent" -} +DELETE_PAYLOAD = {"name": "New Service Group 1", "state": "absent"} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_service_group.api_call' -api_call_object = 'service-group' +function_path = "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_service_group.api_call" +api_call_object = "service-group" class TestCheckpointServiceGroup(object): @@ -63,56 +56,69 @@ class TestCheckpointServiceGroup(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_group_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_group_facts.py index 2457157cd..b0f32c51d 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_group_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_group_facts.py @@ -15,35 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_service_group_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_service_group_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} -SHOW_SINGLE_PAYLOAD = { - 'name': 'object_which_is_not_exist' -} +SHOW_SINGLE_PAYLOAD = {"name": "object_which_is_not_exist"} -api_call_object = 'service-group' -api_call_object_plural_version = 'service-groups' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "service-group" +api_call_object_plural_version = "service-groups" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointServiceGroupFacts(object): @@ -51,29 +52,40 @@ class TestCheckpointServiceGroupFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_icmp.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_icmp.py index 173dfec12..ae6acebcf 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_icmp.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_icmp.py @@ -15,41 +15,34 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_service_icmp - -OBJECT = { - "name": "Icmp1", - "icmp_type": 5, - "icmp_code": 7 -} - -CREATE_PAYLOAD = { - "name": "Icmp1", - "icmp_type": 5, - "icmp_code": 7 -} - -UPDATE_PAYLOAD = { - "name": "Icmp1", - "icmp_type": 45, - "icmp_code": 13 -} +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_service_icmp, +) + +OBJECT = {"name": "Icmp1", "icmp_type": 5, "icmp_code": 7} + +CREATE_PAYLOAD = {"name": "Icmp1", "icmp_type": 5, "icmp_code": 7} + +UPDATE_PAYLOAD = {"name": "Icmp1", "icmp_type": 45, "icmp_code": 13} OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD -DELETE_PAYLOAD = { - "name": "Icmp1", - "state": "absent" -} +DELETE_PAYLOAD = {"name": "Icmp1", "state": "absent"} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_service_icmp.api_call' -api_call_object = 'service-icmp' +function_path = "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_service_icmp.api_call" +api_call_object = "service-icmp" class TestCheckpointServiceIcmp(object): @@ -57,56 +50,69 @@ class TestCheckpointServiceIcmp(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_icmp6.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_icmp6.py index 2194bed2d..1a2e87cb1 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_icmp6.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_icmp6.py @@ -15,41 +15,34 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_service_icmp6 - -OBJECT = { - "name": "Icmp1", - "icmp_type": 5, - "icmp_code": 7 -} - -CREATE_PAYLOAD = { - "name": "Icmp1", - "icmp_type": 5, - "icmp_code": 7 -} - -UPDATE_PAYLOAD = { - "name": "Icmp1", - "icmp_type": 45, - "icmp_code": 13 -} +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_service_icmp6, +) + +OBJECT = {"name": "Icmp1", "icmp_type": 5, "icmp_code": 7} + +CREATE_PAYLOAD = {"name": "Icmp1", "icmp_type": 5, "icmp_code": 7} + +UPDATE_PAYLOAD = {"name": "Icmp1", "icmp_type": 45, "icmp_code": 13} OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD -DELETE_PAYLOAD = { - "name": "Icmp1", - "state": "absent" -} +DELETE_PAYLOAD = {"name": "Icmp1", "state": "absent"} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_service_icmp6.api_call' -api_call_object = 'service-icmp6' +function_path = "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_service_icmp6.api_call" +api_call_object = "service-icmp6" class TestCheckpointServiceIcmp6(object): @@ -57,56 +50,69 @@ class TestCheckpointServiceIcmp6(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_icmp6_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_icmp6_facts.py index 7ac4fd7ad..d633c882d 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_icmp6_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_icmp6_facts.py @@ -15,35 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_service_icmp6_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_service_icmp6_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} -SHOW_SINGLE_PAYLOAD = { - 'name': 'object_which_is_not_exist' -} +SHOW_SINGLE_PAYLOAD = {"name": "object_which_is_not_exist"} -api_call_object = 'service-icmp6' -api_call_object_plural_version = 'services-icmp6' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "service-icmp6" +api_call_object_plural_version = "services-icmp6" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointServiceIcmp6Facts(object): @@ -51,29 +52,40 @@ class TestCheckpointServiceIcmp6Facts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_icmp_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_icmp_facts.py index c5979e7f3..82d777416 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_icmp_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_icmp_facts.py @@ -15,35 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_service_icmp_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_service_icmp_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} -SHOW_SINGLE_PAYLOAD = { - 'name': 'object_which_is_not_exist' -} +SHOW_SINGLE_PAYLOAD = {"name": "object_which_is_not_exist"} -api_call_object = 'service-icmp' -api_call_object_plural_version = 'services-icmp' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "service-icmp" +api_call_object_plural_version = "services-icmp" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointServiceIcmpFacts(object): @@ -51,29 +52,40 @@ class TestCheckpointServiceIcmpFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_other.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_other.py index 993481cca..7898cb6eb 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_other.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_other.py @@ -15,13 +15,21 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_service_other +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_service_other, +) OBJECT = { "name": "New_Service_1", @@ -33,8 +41,8 @@ OBJECT = { "aggressive_aging": { "enable": True, "timeout": 360, - "use_default_timeout": False - } + "use_default_timeout": False, + }, } CREATE_PAYLOAD = { @@ -47,27 +55,22 @@ CREATE_PAYLOAD = { "aggressive_aging": { "enable": True, "timeout": 360, - "use_default_timeout": False - } + "use_default_timeout": False, + }, } UPDATE_PAYLOAD = { "name": "New_Service_1", "color": "blue", - "aggressive_aging": { - "default_timeout": 3600 - } + "aggressive_aging": {"default_timeout": 3600}, } OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD -DELETE_PAYLOAD = { - "name": "New_Service_1", - "state": "absent" -} +DELETE_PAYLOAD = {"name": "New_Service_1", "state": "absent"} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_service_other.api_call' -api_call_object = 'service-other' +function_path = "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_service_other.api_call" +api_call_object = "service-other" class TestCheckpointServiceOther(object): @@ -75,56 +78,69 @@ class TestCheckpointServiceOther(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_other_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_other_facts.py index ea8af4e1a..678a909b8 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_other_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_other_facts.py @@ -15,35 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_service_other_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_service_other_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} -SHOW_SINGLE_PAYLOAD = { - 'name': 'object_which_is_not_exist' -} +SHOW_SINGLE_PAYLOAD = {"name": "object_which_is_not_exist"} -api_call_object = 'service-other' -api_call_object_plural_version = 'services-other' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "service-other" +api_call_object_plural_version = "services-other" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointServiceOtherFacts(object): @@ -51,29 +52,40 @@ class TestCheckpointServiceOtherFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_rpc.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_rpc.py index da12b433d..df92c9f9b 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_rpc.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_rpc.py @@ -15,41 +15,46 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_service_rpc +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_service_rpc, +) OBJECT = { "name": "New_RPC_Service_1", "program_number": 5669, - "keep_connections_open_after_policy_installation": False + "keep_connections_open_after_policy_installation": False, } CREATE_PAYLOAD = { "name": "New_RPC_Service_1", "program_number": 5669, - "keep_connections_open_after_policy_installation": False + "keep_connections_open_after_policy_installation": False, } UPDATE_PAYLOAD = { "name": "New_RPC_Service_1", "color": "blue", - "program_number": 5656 + "program_number": 5656, } OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD -DELETE_PAYLOAD = { - "name": "New_RPC_Service_1", - "state": "absent" -} +DELETE_PAYLOAD = {"name": "New_RPC_Service_1", "state": "absent"} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_service_rpc.api_call' -api_call_object = 'service-rpc' +function_path = "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_service_rpc.api_call" +api_call_object = "service-rpc" class TestCheckpointServiceRpc(object): @@ -57,56 +62,69 @@ class TestCheckpointServiceRpc(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_rpc_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_rpc_facts.py index 88aa379e3..5792b06d8 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_rpc_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_rpc_facts.py @@ -15,35 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_service_rpc_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_service_rpc_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} -SHOW_SINGLE_PAYLOAD = { - 'name': 'object_which_is_not_exist' -} +SHOW_SINGLE_PAYLOAD = {"name": "object_which_is_not_exist"} -api_call_object = 'service-rpc' -api_call_object_plural_version = 'services-rpc' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "service-rpc" +api_call_object_plural_version = "services-rpc" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointServiceRpcFacts(object): @@ -51,29 +52,40 @@ class TestCheckpointServiceRpcFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_sctp.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_sctp.py index 70296bc47..d8fc219c1 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_sctp.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_sctp.py @@ -15,13 +15,21 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_service_sctp +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_service_sctp, +) OBJECT = { "name": "New_SCTP_Service_1", @@ -33,8 +41,8 @@ OBJECT = { "aggressive_aging": { "enable": True, "timeout": 360, - "use_default_timeout": False - } + "use_default_timeout": False, + }, } CREATE_PAYLOAD = { @@ -47,28 +55,23 @@ CREATE_PAYLOAD = { "aggressive_aging": { "enable": True, "timeout": 360, - "use_default_timeout": False - } + "use_default_timeout": False, + }, } UPDATE_PAYLOAD = { "name": "New_SCTP_Service_1", "color": "blue", "port": 5656, - "aggressive_aging": { - "default_timeout": 3600 - } + "aggressive_aging": {"default_timeout": 3600}, } OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD -DELETE_PAYLOAD = { - "name": "New_SCTP_Service_1", - "state": "absent" -} +DELETE_PAYLOAD = {"name": "New_SCTP_Service_1", "state": "absent"} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_service_sctp.api_call' -api_call_object = 'service-sctp' +function_path = "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_service_sctp.api_call" +api_call_object = "service-sctp" class TestCheckpointServiceSctp(object): @@ -76,56 +79,69 @@ class TestCheckpointServiceSctp(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_sctp_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_sctp_facts.py index fe05693d2..fb3afa691 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_sctp_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_sctp_facts.py @@ -15,35 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_service_sctp_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_service_sctp_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} -SHOW_SINGLE_PAYLOAD = { - 'name': 'object_which_is_not_exist' -} +SHOW_SINGLE_PAYLOAD = {"name": "object_which_is_not_exist"} -api_call_object = 'service-sctp' -api_call_object_plural_version = 'services-sctp' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "service-sctp" +api_call_object_plural_version = "services-sctp" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointServiceSctpFacts(object): @@ -51,29 +52,40 @@ class TestCheckpointServiceSctpFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_tcp.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_tcp.py index 347606f08..fd4faa61e 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_tcp.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_tcp.py @@ -15,13 +15,21 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_service_tcp +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_service_tcp, +) OBJECT = { "name": "New_TCP_Service_1", @@ -33,8 +41,8 @@ OBJECT = { "aggressive_aging": { "enable": True, "timeout": 360, - "use_default_timeout": False - } + "use_default_timeout": False, + }, } CREATE_PAYLOAD = { @@ -47,28 +55,23 @@ CREATE_PAYLOAD = { "aggressive_aging": { "enable": True, "timeout": 360, - "use_default_timeout": False - } + "use_default_timeout": False, + }, } UPDATE_PAYLOAD = { "name": "New_TCP_Service_1", "color": "blue", "port": 5656, - "aggressive_aging": { - "default_timeout": 3600 - } + "aggressive_aging": {"default_timeout": 3600}, } OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD -DELETE_PAYLOAD = { - "name": "New_TCP_Service_1", - "state": "absent" -} +DELETE_PAYLOAD = {"name": "New_TCP_Service_1", "state": "absent"} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_service_tcp.api_call' -api_call_object = 'service-tcp' +function_path = "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_service_tcp.api_call" +api_call_object = "service-tcp" class TestCheckpointServiceTcp(object): @@ -76,56 +79,69 @@ class TestCheckpointServiceTcp(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_tcp_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_tcp_facts.py index 25c087db1..e852b5811 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_tcp_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_tcp_facts.py @@ -15,35 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_service_tcp_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_service_tcp_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} -SHOW_SINGLE_PAYLOAD = { - 'name': 'object_which_is_not_exist' -} +SHOW_SINGLE_PAYLOAD = {"name": "object_which_is_not_exist"} -api_call_object = 'service-tcp' -api_call_object_plural_version = 'services-tcp' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "service-tcp" +api_call_object_plural_version = "services-tcp" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointServiceTcpFacts(object): @@ -51,29 +52,40 @@ class TestCheckpointServiceTcpFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_udp.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_udp.py index c8c803400..a881c52c9 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_udp.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_udp.py @@ -15,13 +15,21 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_service_udp +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_service_udp, +) OBJECT = { "name": "New_UDP_Service_1", @@ -33,9 +41,9 @@ OBJECT = { "aggressive_aging": { "enable": True, "timeout": 360, - "use_default_timeout": False + "use_default_timeout": False, }, - "accept_replies": False + "accept_replies": False, } CREATE_PAYLOAD = { @@ -48,30 +56,25 @@ CREATE_PAYLOAD = { "aggressive_aging": { "enable": True, "timeout": 360, - "use_default_timeout": False + "use_default_timeout": False, }, - "accept_replies": False + "accept_replies": False, } UPDATE_PAYLOAD = { "name": "New_UDP_Service_1", "color": "blue", "port": 5656, - "aggressive_aging": { - "default_timeout": 3600 - }, - "accept_replies": True + "aggressive_aging": {"default_timeout": 3600}, + "accept_replies": True, } OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD -DELETE_PAYLOAD = { - "name": "New_UDP_Service_1", - "state": "absent" -} +DELETE_PAYLOAD = {"name": "New_UDP_Service_1", "state": "absent"} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_service_udp.api_call' -api_call_object = 'service-udp' +function_path = "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_service_udp.api_call" +api_call_object = "service-udp" class TestCheckpointServiceUdp(object): @@ -79,56 +82,69 @@ class TestCheckpointServiceUdp(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_udp_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_udp_facts.py index f213be300..35376b81e 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_udp_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_service_udp_facts.py @@ -15,35 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_service_udp_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_service_udp_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} -SHOW_SINGLE_PAYLOAD = { - 'name': 'object_which_is_not_exist' -} +SHOW_SINGLE_PAYLOAD = {"name": "object_which_is_not_exist"} -api_call_object = 'service-udp' -api_call_object_plural_version = 'services-udp' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "service-udp" +api_call_object_plural_version = "services-udp" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointServiceUdpFacts(object): @@ -51,29 +52,40 @@ class TestCheckpointServiceUdpFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_session_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_session_facts.py index 88485836f..205fd1fe6 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_session_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_session_facts.py @@ -15,33 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_session_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_session_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} SHOW_SINGLE_PAYLOAD = {} -api_call_object = 'session' -api_call_object_plural_version = 'sessions' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "session" +api_call_object_plural_version = "sessions" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointSessionFacts(object): @@ -49,29 +52,40 @@ class TestCheckpointSessionFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_set_nat_rule.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_set_nat_rule.py index 9defa2bc5..26037f9dc 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_set_nat_rule.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_set_nat_rule.py @@ -15,13 +15,21 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_set_nat_rule +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_set_nat_rule, +) PAYLOAD = { "package": "standard", @@ -29,15 +37,13 @@ PAYLOAD = { "comments": "rule for RND members RNDNetwork-> RND to Internal Network", "original_service": "ssh_version_2", "original_source": "Any", - "wait_for_task": False + "wait_for_task": False, } -RETURN_PAYLOAD = { - "task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad" -} +RETURN_PAYLOAD = {"task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad"} -command = 'set-nat-rule' -failure_msg = '{command failed}' +command = "set-nat-rule" +failure_msg = "{command failed}" class TestCheckpointSetNatRule(object): @@ -45,18 +51,22 @@ class TestCheckpointSetNatRule(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_command(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, RETURN_PAYLOAD) result = self._run_module(PAYLOAD) - assert result['changed'] + assert result["changed"] assert RETURN_PAYLOAD == result[command] def test_command_fail(self, mocker, connection_mock): @@ -66,7 +76,10 @@ class TestCheckpointSetNatRule(object): except Exception as e: result = e.args[0] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_show_access_section.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_show_access_section.py index 78af3cded..142adbd8b 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_show_access_section.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_show_access_section.py @@ -15,26 +15,28 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_show_access_section +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_show_access_section, +) -PAYLOAD = { - "layer": "Network", - "name": "New Section 1", - "wait_for_task": False -} +PAYLOAD = {"layer": "Network", "name": "New Section 1", "wait_for_task": False} -RETURN_PAYLOAD = { - "task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad" -} +RETURN_PAYLOAD = {"task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad"} -command = 'show-access-section' -failure_msg = '{command failed}' +command = "show-access-section" +failure_msg = "{command failed}" class TestCheckpointShowAccessSection(object): @@ -42,18 +44,22 @@ class TestCheckpointShowAccessSection(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_command(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, RETURN_PAYLOAD) result = self._run_module(PAYLOAD) - assert result['changed'] + assert result["changed"] assert RETURN_PAYLOAD == result[command] def test_command_fail(self, mocker, connection_mock): @@ -63,7 +69,10 @@ class TestCheckpointShowAccessSection(object): except Exception as e: result = e.args[0] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_show_https_section.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_show_https_section.py index 91080ea5b..961798946 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_show_https_section.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_show_https_section.py @@ -15,26 +15,32 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_show_https_section +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_show_https_section, +) PAYLOAD = { "layer": "Default Layer", "name": "New Section 1", - "wait_for_task": False + "wait_for_task": False, } -RETURN_PAYLOAD = { - "task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad" -} +RETURN_PAYLOAD = {"task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad"} -command = 'show-https-section' -failure_msg = '{command failed}' +command = "show-https-section" +failure_msg = "{command failed}" class TestCheckpointShowHttpsSection(object): @@ -42,18 +48,22 @@ class TestCheckpointShowHttpsSection(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_command(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, RETURN_PAYLOAD) result = self._run_module(PAYLOAD) - assert result['changed'] + assert result["changed"] assert RETURN_PAYLOAD == result[command] def test_command_fail(self, mocker, connection_mock): @@ -63,7 +73,10 @@ class TestCheckpointShowHttpsSection(object): except Exception as e: result = e.args[0] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_show_nat_section.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_show_nat_section.py index 41b0d22a5..cb2cacdc2 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_show_nat_section.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_show_nat_section.py @@ -15,26 +15,32 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_show_nat_section +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_show_nat_section, +) PAYLOAD = { "package": "standard", "name": "New Section 1", - "wait_for_task": False + "wait_for_task": False, } -RETURN_PAYLOAD = { - "task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad" -} +RETURN_PAYLOAD = {"task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad"} -command = 'show-nat-section' -failure_msg = '{command failed}' +command = "show-nat-section" +failure_msg = "{command failed}" class TestCheckpointShowNatSection(object): @@ -42,18 +48,22 @@ class TestCheckpointShowNatSection(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_command(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, RETURN_PAYLOAD) result = self._run_module(PAYLOAD) - assert result['changed'] + assert result["changed"] assert RETURN_PAYLOAD == result[command] def test_command_fail(self, mocker, connection_mock): @@ -63,7 +73,10 @@ class TestCheckpointShowNatSection(object): except Exception as e: result = e.args[0] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_show_software_package_details.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_show_software_package_details.py index 71f581877..c17ee0e4a 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_show_software_package_details.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_show_software_package_details.py @@ -15,25 +15,31 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_show_software_package_details +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_show_software_package_details, +) PAYLOAD = { "name": "Check_Point_R80_40_JHF_MCD_DEMO_019_MAIN_Bundle_T1_VISIBLE_FULL.tgz", - "wait_for_task": False + "wait_for_task": False, } -RETURN_PAYLOAD = { - "task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad" -} +RETURN_PAYLOAD = {"task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad"} -command = 'show-software-package-details' -failure_msg = '{command failed}' +command = "show-software-package-details" +failure_msg = "{command failed}" class TestCheckpointShowSoftwarePackageDetails(object): @@ -41,18 +47,22 @@ class TestCheckpointShowSoftwarePackageDetails(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_command(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, RETURN_PAYLOAD) result = self._run_module(PAYLOAD) - assert result['changed'] + assert result["changed"] assert RETURN_PAYLOAD == result[command] def test_command_fail(self, mocker, connection_mock): @@ -62,7 +72,10 @@ class TestCheckpointShowSoftwarePackageDetails(object): except Exception as e: result = e.args[0] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_simple_gateway.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_simple_gateway.py index 7dce34d84..c88bc8aba 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_simple_gateway.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_simple_gateway.py @@ -15,23 +15,25 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_simple_gateway +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_simple_gateway, +) -OBJECT = { - "name": "gw1", - "ip_address": "192.0.2.1" -} +OBJECT = {"name": "gw1", "ip_address": "192.0.2.1"} -CREATE_PAYLOAD = { - "name": "gw1", - "ip_address": "192.0.2.1" -} +CREATE_PAYLOAD = {"name": "gw1", "ip_address": "192.0.2.1"} UPDATE_PAYLOAD = { "name": "gw1", @@ -40,18 +42,15 @@ UPDATE_PAYLOAD = { "url_filtering": True, "anti_bot": True, "anti_virus": True, - "threat_emulation": True + "threat_emulation": True, } OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD -DELETE_PAYLOAD = { - "name": "gw1", - "state": "absent" -} +DELETE_PAYLOAD = {"name": "gw1", "state": "absent"} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_simple_gateway.api_call' -api_call_object = 'simple-gateway' +function_path = "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_simple_gateway.api_call" +api_call_object = "simple-gateway" class TestCheckpointSimpleGateway(object): @@ -59,56 +58,69 @@ class TestCheckpointSimpleGateway(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_simple_gateway_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_simple_gateway_facts.py index f89d476de..ced9855d7 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_simple_gateway_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_simple_gateway_facts.py @@ -15,35 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_simple_gateway_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_simple_gateway_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} -SHOW_SINGLE_PAYLOAD = { - 'name': 'object_which_is_not_exist' -} +SHOW_SINGLE_PAYLOAD = {"name": "object_which_is_not_exist"} -api_call_object = 'simple-gateway' -api_call_object_plural_version = 'simple-gateways' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "simple-gateway" +api_call_object_plural_version = "simple-gateways" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointSimpleGatewayFacts(object): @@ -51,29 +52,40 @@ class TestCheckpointSimpleGatewayFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_tag.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_tag.py index 5f2e7c0eb..106eee3cd 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_tag.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_tag.py @@ -15,43 +15,34 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_tag -OBJECT = { - "name": "My New Tag1", - "tags": [ - "tag1", - "tag2" - ] -} - -CREATE_PAYLOAD = { - "name": "My New Tag1", - "tags": [ - "tag1", - "tag2" - ] -} - -UPDATE_PAYLOAD = { - "name": "My New Tag1" -} +OBJECT = {"name": "My New Tag1", "tags": ["tag1", "tag2"]} + +CREATE_PAYLOAD = {"name": "My New Tag1", "tags": ["tag1", "tag2"]} + +UPDATE_PAYLOAD = {"name": "My New Tag1"} OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD -DELETE_PAYLOAD = { - "name": "My New Tag1", - "state": "absent" -} +DELETE_PAYLOAD = {"name": "My New Tag1", "state": "absent"} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_tag.api_call' -api_call_object = 'tag' +function_path = ( + "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_tag.api_call" +) +api_call_object = "tag" class TestCheckpointTag(object): @@ -59,56 +50,69 @@ class TestCheckpointTag(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_tag_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_tag_facts.py index cb41722b4..3236d188e 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_tag_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_tag_facts.py @@ -15,35 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_tag_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_tag_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} -SHOW_SINGLE_PAYLOAD = { - 'name': 'object_which_is_not_exist' -} +SHOW_SINGLE_PAYLOAD = {"name": "object_which_is_not_exist"} -api_call_object = 'tag' -api_call_object_plural_version = 'tags' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "tag" +api_call_object_plural_version = "tags" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointTagFacts(object): @@ -51,29 +52,40 @@ class TestCheckpointTagFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_exception.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_exception.py index d9f4e183b..61425ee5e 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_exception.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_exception.py @@ -15,20 +15,28 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_threat_exception +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_threat_exception, +) OBJECT = { "layer": "New Layer 1", "name": "Exception Rule", "track": "Log", "rule_name": "First rule", - "protected_scope": "All_Internet" + "protected_scope": "All_Internet", } CREATE_PAYLOAD = { @@ -36,7 +44,7 @@ CREATE_PAYLOAD = { "name": "Exception Rule", "track": "Log", "rule_name": "First rule", - "protected_scope": "All_Internet" + "protected_scope": "All_Internet", } UPDATE_PAYLOAD = { @@ -47,13 +55,10 @@ UPDATE_PAYLOAD = { OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD -DELETE_PAYLOAD = { - "name": "Exception Rule", - "state": "absent" -} +DELETE_PAYLOAD = {"name": "Exception Rule", "state": "absent"} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_threat_exception.api_call' -api_call_object = 'threat-exception' +function_path = "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_threat_exception.api_call" +api_call_object = "threat-exception" class TestCheckpointThreatException(object): @@ -61,56 +66,69 @@ class TestCheckpointThreatException(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_exception_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_exception_facts.py index dd4881d0b..39c5e8ca4 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_exception_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_exception_facts.py @@ -15,35 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_threat_exception_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_threat_exception_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} -SHOW_SINGLE_PAYLOAD = { - 'name': 'object_which_is_not_exist' -} +SHOW_SINGLE_PAYLOAD = {"name": "object_which_is_not_exist"} -api_call_object = 'threat-exception' -api_call_object_plural_version = 'threat-rule-exception-rulebase' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "threat-exception" +api_call_object_plural_version = "threat-rule-exception-rulebase" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointThreatExceptionFacts(object): @@ -51,29 +52,40 @@ class TestCheckpointThreatExceptionFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_indicator.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_indicator.py index e004acc5c..36584b539 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_indicator.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_indicator.py @@ -15,13 +15,21 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_threat_indicator +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_threat_indicator, +) OBJECT = { "name": "My_Indicator", @@ -31,17 +39,12 @@ OBJECT = { "mail-to": "someone@somewhere.com", "confidence": "medium", "severity": "low", - "product": "AV" + "product": "AV", } ], "action": "Inactive", - "profile_overrides": [ - { - "profile": "My_Profile", - "action": "detect" - } - ], - "ignore_warnings": True + "profile_overrides": [{"profile": "My_Profile", "action": "detect"}], + "ignore_warnings": True, } CREATE_PAYLOAD = { @@ -52,34 +55,26 @@ CREATE_PAYLOAD = { "mail-to": "someone@somewhere.com", "confidence": "medium", "severity": "low", - "product": "AV" + "product": "AV", } ], "action": "Inactive", - "profile_overrides": [ - { - "profile": "My_Profile", - "action": "detect" - } - ], - "ignore_warnings": True + "profile_overrides": [{"profile": "My_Profile", "action": "detect"}], + "ignore_warnings": True, } UPDATE_PAYLOAD = { "name": "My_Indicator", "action": "Inactive", - "ignore_warnings": True + "ignore_warnings": True, } OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD -DELETE_PAYLOAD = { - "name": "My_Indicator", - "state": "absent" -} +DELETE_PAYLOAD = {"name": "My_Indicator", "state": "absent"} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_threat_indicator.api_call' -api_call_object = 'threat-indicator' +function_path = "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_threat_indicator.api_call" +api_call_object = "threat-indicator" class TestCheckpointThreatIndicator(object): @@ -87,56 +82,69 @@ class TestCheckpointThreatIndicator(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_indicator_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_indicator_facts.py index 12ec3d5c3..549ec9f2c 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_indicator_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_indicator_facts.py @@ -15,35 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_threat_indicator_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_threat_indicator_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} -SHOW_SINGLE_PAYLOAD = { - 'name': 'object_which_is_not_exist' -} +SHOW_SINGLE_PAYLOAD = {"name": "object_which_is_not_exist"} -api_call_object = 'threat-indicator' -api_call_object_plural_version = 'threat-indicators' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "threat-indicator" +api_call_object_plural_version = "threat-indicators" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointThreatIndicatorFacts(object): @@ -51,29 +52,40 @@ class TestCheckpointThreatIndicatorFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_layer.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_layer.py index c10c2584c..79bbba532 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_layer.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_layer.py @@ -15,35 +15,34 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_threat_layer +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_threat_layer, +) -OBJECT = { - "name": "New Layer 1" -} +OBJECT = {"name": "New Layer 1"} -CREATE_PAYLOAD = { - "name": "New Layer 1" -} +CREATE_PAYLOAD = {"name": "New Layer 1"} -UPDATE_PAYLOAD = { - "name": "New Layer 1" -} +UPDATE_PAYLOAD = {"name": "New Layer 1"} OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD -DELETE_PAYLOAD = { - "name": "New Layer 1", - "state": "absent" -} +DELETE_PAYLOAD = {"name": "New Layer 1", "state": "absent"} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_threat_layer.api_call' -api_call_object = 'threat-layer' +function_path = "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_threat_layer.api_call" +api_call_object = "threat-layer" class TestCheckpointThreatLayer(object): @@ -51,56 +50,69 @@ class TestCheckpointThreatLayer(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_layer_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_layer_facts.py index 258925965..d643582af 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_layer_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_layer_facts.py @@ -15,35 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_threat_layer_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_threat_layer_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} -SHOW_SINGLE_PAYLOAD = { - 'name': 'object_which_is_not_exist' -} +SHOW_SINGLE_PAYLOAD = {"name": "object_which_is_not_exist"} -api_call_object = 'threat-layer' -api_call_object_plural_version = 'threat-layers' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "threat-layer" +api_call_object_plural_version = "threat-layers" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointThreatLayerFacts(object): @@ -51,29 +52,40 @@ class TestCheckpointThreatLayerFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_profile.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_profile.py index b786d0520..479221809 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_profile.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_profile.py @@ -15,13 +15,21 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_threat_profile +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_threat_profile, +) OBJECT = { "name": "New Profile 1", @@ -36,8 +44,8 @@ OBJECT = { "ips_settings": { "newly_updated_protections": "staging", "exclude_protection_with_performance_impact": True, - "exclude_protection_with_performance_impact_mode": "high or lower" - } + "exclude_protection_with_performance_impact_mode": "high or lower", + }, } CREATE_PAYLOAD = { @@ -53,8 +61,8 @@ CREATE_PAYLOAD = { "ips_settings": { "newly_updated_protections": "staging", "exclude_protection_with_performance_impact": True, - "exclude_protection_with_performance_impact_mode": "high or lower" - } + "exclude_protection_with_performance_impact_mode": "high or lower", + }, } UPDATE_PAYLOAD = { @@ -72,19 +80,16 @@ UPDATE_PAYLOAD = { "ips_settings": { "newly_updated_protections": "active", "exclude_protection_with_performance_impact": True, - "exclude_protection_with_performance_impact_mode": "high or lower" - } + "exclude_protection_with_performance_impact_mode": "high or lower", + }, } OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD -DELETE_PAYLOAD = { - "name": "New Profile 1", - "state": "absent" -} +DELETE_PAYLOAD = {"name": "New Profile 1", "state": "absent"} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_threat_profile.api_call' -api_call_object = 'threat-profile' +function_path = "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_threat_profile.api_call" +api_call_object = "threat-profile" class TestCheckpointThreatProfile(object): @@ -92,56 +97,69 @@ class TestCheckpointThreatProfile(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_profile_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_profile_facts.py index 7ab8f8e39..a36c6fbfb 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_profile_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_profile_facts.py @@ -15,35 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_threat_profile_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_threat_profile_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} -SHOW_SINGLE_PAYLOAD = { - 'name': 'object_which_is_not_exist' -} +SHOW_SINGLE_PAYLOAD = {"name": "object_which_is_not_exist"} -api_call_object = 'threat-profile' -api_call_object_plural_version = 'threat-profiles' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "threat-profile" +api_call_object_plural_version = "threat-profiles" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointThreatProfileFacts(object): @@ -51,29 +52,40 @@ class TestCheckpointThreatProfileFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_protection_override.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_protection_override.py index 435721419..42ef98830 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_protection_override.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_protection_override.py @@ -15,13 +15,21 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_threat_protection_override +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_threat_protection_override, +) PAYLOAD = { "name": "FTP Commands", @@ -30,18 +38,16 @@ PAYLOAD = { "profile": "New Profile 1", "action": "inactive", "track": "None", - "capture-packets": True + "capture-packets": True, } ], - "wait_for_task": False + "wait_for_task": False, } -RETURN_PAYLOAD = { - "task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad" -} +RETURN_PAYLOAD = {"task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad"} -command = 'set-threat-protection' -failure_msg = '{command failed}' +command = "set-threat-protection" +failure_msg = "{command failed}" class TestCheckpointThreatProtectionOverride(object): @@ -49,18 +55,22 @@ class TestCheckpointThreatProtectionOverride(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_command(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, RETURN_PAYLOAD) result = self._run_module(PAYLOAD) - assert result['changed'] + assert result["changed"] assert RETURN_PAYLOAD == result[command] def test_command_fail(self, mocker, connection_mock): @@ -70,7 +80,10 @@ class TestCheckpointThreatProtectionOverride(object): except Exception as e: result = e.args[0] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_rule.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_rule.py index b300b0243..1e9188e58 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_rule.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_rule.py @@ -15,13 +15,21 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_threat_rule +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_threat_rule, +) OBJECT = { "layer": "New Layer 1", @@ -29,7 +37,7 @@ OBJECT = { "comments": "", "track": "None", "protected_scope": "All_Internet", - "install_on": "Policy Targets" + "install_on": "Policy Targets", } CREATE_PAYLOAD = { @@ -38,7 +46,7 @@ CREATE_PAYLOAD = { "comments": "", "track": "None", "protected_scope": "All_Internet", - "install_on": "Policy Targets" + "install_on": "Policy Targets", } UPDATE_PAYLOAD = { @@ -47,18 +55,15 @@ UPDATE_PAYLOAD = { "action": "New Profile 1", "name": "First threat rule", "protected_scope": "All_Internet", - "install_on": "Policy Targets" + "install_on": "Policy Targets", } OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD -DELETE_PAYLOAD = { - "name": "First threat rule", - "state": "absent" -} +DELETE_PAYLOAD = {"name": "First threat rule", "state": "absent"} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_threat_rule.api_call' -api_call_object = 'threat-rule' +function_path = "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_threat_rule.api_call" +api_call_object = "threat-rule" class TestCheckpointThreatRule(object): @@ -66,56 +71,69 @@ class TestCheckpointThreatRule(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_rule_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_rule_facts.py index 13491cbea..64a7af436 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_rule_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_threat_rule_facts.py @@ -15,35 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_threat_rule_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_threat_rule_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} -SHOW_SINGLE_PAYLOAD = { - 'name': 'object_which_is_not_exist' -} +SHOW_SINGLE_PAYLOAD = {"name": "object_which_is_not_exist"} -api_call_object = 'threat-rule' -api_call_object_plural_version = 'threat-rulebase' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "threat-rule" +api_call_object_plural_version = "threat-rulebase" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointThreatRuleFacts(object): @@ -51,29 +52,40 @@ class TestCheckpointThreatRuleFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_time.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_time.py index c1f336d9f..387b6ced1 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_time.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_time.py @@ -15,110 +15,66 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_time OBJECT = { "name": "timeObject1", - "end": { - "date": "24-Nov-2014", - "time": "21:22" - }, + "end": {"date": "24-Nov-2014", "time": "21:22"}, "recurrence": { "pattern": "Daily", "month": "Any", - "weekdays": [ - "Sun", - "Mon" - ], - "days": [ - "1" - ] + "weekdays": ["Sun", "Mon"], + "days": ["1"], }, "start_now": True, "end_never": False, "hours_ranges": [ - { - "from": "00:00", - "to": "00:00", - "enabled": True, - "index": 1 - }, - { - "from": "00:00", - "to": "00:00", - "enabled": False, - "index": 2 - } - ] + {"from": "00:00", "to": "00:00", "enabled": True, "index": 1}, + {"from": "00:00", "to": "00:00", "enabled": False, "index": 2}, + ], } CREATE_PAYLOAD = { "name": "timeObject1", - "end": { - "date": "24-Nov-2014", - "time": "21:22" - }, + "end": {"date": "24-Nov-2014", "time": "21:22"}, "recurrence": { "pattern": "Daily", "month": "Any", - "weekdays": [ - "Sun", - "Mon" - ], - "days": [ - "1" - ] + "weekdays": ["Sun", "Mon"], + "days": ["1"], }, "start_now": True, "end_never": False, "hours_ranges": [ - { - "from": "00:00", - "to": "00:00", - "enabled": True, - "index": 1 - }, - { - "from": "00:00", - "to": "00:00", - "enabled": False, - "index": 2 - } - ] + {"from": "00:00", "to": "00:00", "enabled": True, "index": 1}, + {"from": "00:00", "to": "00:00", "enabled": False, "index": 2}, + ], } UPDATE_PAYLOAD = { "name": "timeObject1", - "recurrence": { - "pattern": "Weekly", - "weekdays": [ - "Fri" - ], - "month": "Any" - }, - "hours_ranges": [ - { - "from": "00:22", - "to": "00:33" - } - ] + "recurrence": {"pattern": "Weekly", "weekdays": ["Fri"], "month": "Any"}, + "hours_ranges": [{"from": "00:22", "to": "00:33"}], } OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD -DELETE_PAYLOAD = { - "name": "timeObject1", - "state": "absent" -} +DELETE_PAYLOAD = {"name": "timeObject1", "state": "absent"} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_time.api_call' -api_call_object = 'time' +function_path = "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_time.api_call" +api_call_object = "time" class TestCheckpointTime(object): @@ -126,56 +82,69 @@ class TestCheckpointTime(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_time_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_time_facts.py index c44c962e5..af2ebc42c 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_time_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_time_facts.py @@ -15,35 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_time_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_time_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} -SHOW_SINGLE_PAYLOAD = { - 'name': 'object_which_is_not_exist' -} +SHOW_SINGLE_PAYLOAD = {"name": "object_which_is_not_exist"} -api_call_object = 'time' -api_call_object_plural_version = 'times' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "time" +api_call_object_plural_version = "times" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointTimeFacts(object): @@ -51,29 +52,40 @@ class TestCheckpointTimeFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_uninstall_software_package.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_uninstall_software_package.py index 09bb5c37e..a3ba2ff8e 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_uninstall_software_package.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_uninstall_software_package.py @@ -15,25 +15,31 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_uninstall_software_package +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_uninstall_software_package, +) PAYLOAD = { "name": "Check_Point_R80_40_JHF_MCD_DEMO_019_MAIN_Bundle_T1_VISIBLE_FULL.tgz", - "wait_for_task": False + "wait_for_task": False, } -RETURN_PAYLOAD = { - "task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad" -} +RETURN_PAYLOAD = {"task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad"} -command = 'uninstall-software-package' -failure_msg = '{command failed}' +command = "uninstall-software-package" +failure_msg = "{command failed}" class TestCheckpointUninstallSoftwarePackage(object): @@ -41,18 +47,22 @@ class TestCheckpointUninstallSoftwarePackage(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_command(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, RETURN_PAYLOAD) result = self._run_module(PAYLOAD) - assert result['changed'] + assert result["changed"] assert RETURN_PAYLOAD == result[command] def test_command_fail(self, mocker, connection_mock): @@ -62,7 +72,10 @@ class TestCheckpointUninstallSoftwarePackage(object): except Exception as e: result = e.args[0] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_verify_policy.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_verify_policy.py index bd708bff0..21c5e3125 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_verify_policy.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_verify_policy.py @@ -15,25 +15,28 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_verify_policy +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_verify_policy, +) -PAYLOAD = { - "policy_package": "standard", - "wait_for_task": False -} +PAYLOAD = {"policy_package": "standard", "wait_for_task": False} -RETURN_PAYLOAD = { - "task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad" -} +RETURN_PAYLOAD = {"task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad"} -command = 'verify-policy' -failure_msg = '{command failed}' +command = "verify-policy" +failure_msg = "{command failed}" class TestCheckpointVerifyPolicy(object): @@ -41,18 +44,22 @@ class TestCheckpointVerifyPolicy(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_command(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, RETURN_PAYLOAD) result = self._run_module(PAYLOAD) - assert result['changed'] + assert result["changed"] assert RETURN_PAYLOAD == result[command] def test_command_fail(self, mocker, connection_mock): @@ -62,7 +69,10 @@ class TestCheckpointVerifyPolicy(object): except Exception as e: result = e.args[0] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_verify_software_package.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_verify_software_package.py index 8a89e42f3..024a56db1 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_verify_software_package.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_verify_software_package.py @@ -15,25 +15,31 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_verify_software_package +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_verify_software_package, +) PAYLOAD = { "name": "Check_Point_R80_40_JHF_MCD_DEMO_019_MAIN_Bundle_T1_VISIBLE_FULL.tgz", - "wait_for_task": False + "wait_for_task": False, } -RETURN_PAYLOAD = { - "task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad" -} +RETURN_PAYLOAD = {"task-id": "53de74b7-8f19-4cbe-99fc-a81ef0759bad"} -command = 'verify-software-package' -failure_msg = '{command failed}' +command = "verify-software-package" +failure_msg = "{command failed}" class TestCheckpointVerifySoftwarePackage(object): @@ -41,18 +47,22 @@ class TestCheckpointVerifySoftwarePackage(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_command(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, RETURN_PAYLOAD) result = self._run_module(PAYLOAD) - assert result['changed'] + assert result["changed"] assert RETURN_PAYLOAD == result[command] def test_command_fail(self, mocker, connection_mock): @@ -62,7 +72,10 @@ class TestCheckpointVerifySoftwarePackage(object): except Exception as e: result = e.args[0] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_vpn_community_meshed.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_vpn_community_meshed.py index 82ce2929e..bb9fdd2f8 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_vpn_community_meshed.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_vpn_community_meshed.py @@ -15,13 +15,21 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_vpn_community_meshed +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_vpn_community_meshed, +) OBJECT = { "name": "New_VPN_Community_Meshed_1", @@ -30,12 +38,12 @@ OBJECT = { "ike_phase_1": { "data_integrity": "sha1", "encryption_algorithm": "aes-128", - "diffie_hellman_group": "group-1" + "diffie_hellman_group": "group-1", }, "ike_phase_2": { "data_integrity": "aes-xcbc", - "encryption_algorithm": "aes-gcm-128" - } + "encryption_algorithm": "aes-gcm-128", + }, } CREATE_PAYLOAD = { @@ -45,12 +53,12 @@ CREATE_PAYLOAD = { "ike_phase_1": { "data_integrity": "sha1", "encryption_algorithm": "aes-128", - "diffie_hellman_group": "group-1" + "diffie_hellman_group": "group-1", }, "ike_phase_2": { "data_integrity": "aes-xcbc", - "encryption_algorithm": "aes-gcm-128" - } + "encryption_algorithm": "aes-gcm-128", + }, } UPDATE_PAYLOAD = { @@ -60,23 +68,20 @@ UPDATE_PAYLOAD = { "ike_phase_1": { "data_integrity": "sha1", "encryption_algorithm": "aes-128", - "diffie_hellman_group": "group-1" + "diffie_hellman_group": "group-1", }, "ike_phase_2": { "data_integrity": "aes-xcbc", - "encryption_algorithm": "aes-gcm-128" - } + "encryption_algorithm": "aes-gcm-128", + }, } OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD -DELETE_PAYLOAD = { - "name": "New_VPN_Community_Meshed_1", - "state": "absent" -} +DELETE_PAYLOAD = {"name": "New_VPN_Community_Meshed_1", "state": "absent"} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_vpn_community_meshed.api_call' -api_call_object = 'vpn-community-meshed' +function_path = "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_vpn_community_meshed.api_call" +api_call_object = "vpn-community-meshed" class TestCheckpointVpnCommunityMeshed(object): @@ -84,56 +89,69 @@ class TestCheckpointVpnCommunityMeshed(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_vpn_community_meshed_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_vpn_community_meshed_facts.py index 2b0b8404a..b935bb79f 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_vpn_community_meshed_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_vpn_community_meshed_facts.py @@ -15,35 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_vpn_community_meshed_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_vpn_community_meshed_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} -SHOW_SINGLE_PAYLOAD = { - 'name': 'object_which_is_not_exist' -} +SHOW_SINGLE_PAYLOAD = {"name": "object_which_is_not_exist"} -api_call_object = 'vpn-community-meshed' -api_call_object_plural_version = 'vpn-communities-meshed' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "vpn-community-meshed" +api_call_object_plural_version = "vpn-communities-meshed" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointVpnCommunityMeshedFacts(object): @@ -51,29 +52,40 @@ class TestCheckpointVpnCommunityMeshedFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_vpn_community_star.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_vpn_community_star.py index 5bea660fc..86f1a55ab 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_vpn_community_star.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_vpn_community_star.py @@ -15,48 +15,52 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_vpn_community_star +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_vpn_community_star, +) OBJECT = { "name": "New_VPN_Community_Star_1", - "center_gateways": [ - "Second_Security_Gateway" - ], + "center_gateways": ["Second_Security_Gateway"], "encryption_method": "prefer ikev2 but support ikev1", "encryption_suite": "custom", "ike_phase_1": { "data_integrity": "sha1", "encryption_algorithm": "aes-128", - "diffie_hellman_group": "group-1" + "diffie_hellman_group": "group-1", }, "ike_phase_2": { "data_integrity": "aes-xcbc", - "encryption_algorithm": "aes-gcm-128" - } + "encryption_algorithm": "aes-gcm-128", + }, } CREATE_PAYLOAD = { "name": "New_VPN_Community_Star_1", - "center_gateways": [ - "Second_Security_Gateway" - ], + "center_gateways": ["Second_Security_Gateway"], "encryption_method": "prefer ikev2 but support ikev1", "encryption_suite": "custom", "ike_phase_1": { "data_integrity": "sha1", "encryption_algorithm": "aes-128", - "diffie_hellman_group": "group-1" + "diffie_hellman_group": "group-1", }, "ike_phase_2": { "data_integrity": "aes-xcbc", - "encryption_algorithm": "aes-gcm-128" - } + "encryption_algorithm": "aes-gcm-128", + }, } UPDATE_PAYLOAD = { @@ -66,23 +70,20 @@ UPDATE_PAYLOAD = { "ike_phase_1": { "data_integrity": "sha1", "encryption_algorithm": "aes-128", - "diffie_hellman_group": "group-1" + "diffie_hellman_group": "group-1", }, "ike_phase_2": { "data_integrity": "aes-xcbc", - "encryption_algorithm": "aes-gcm-128" - } + "encryption_algorithm": "aes-gcm-128", + }, } OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD -DELETE_PAYLOAD = { - "name": "New_VPN_Community_Star_1", - "state": "absent" -} +DELETE_PAYLOAD = {"name": "New_VPN_Community_Star_1", "state": "absent"} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_vpn_community_star.api_call' -api_call_object = 'vpn-community-star' +function_path = "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_vpn_community_star.api_call" +api_call_object = "vpn-community-star" class TestCheckpointVpnCommunityStar(object): @@ -90,56 +91,69 @@ class TestCheckpointVpnCommunityStar(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_vpn_community_star_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_vpn_community_star_facts.py index 34a2d1dc7..54b3233bd 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_vpn_community_star_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_vpn_community_star_facts.py @@ -15,35 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_vpn_community_star_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_vpn_community_star_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} -SHOW_SINGLE_PAYLOAD = { - 'name': 'object_which_is_not_exist' -} +SHOW_SINGLE_PAYLOAD = {"name": "object_which_is_not_exist"} -api_call_object = 'vpn-community-star' -api_call_object_plural_version = 'vpn-communities-star' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "vpn-community-star" +api_call_object_plural_version = "vpn-communities-star" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointVpnCommunityStarFacts(object): @@ -51,29 +52,40 @@ class TestCheckpointVpnCommunityStarFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_wildcard.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_wildcard.py index c0a5090e9..3a72009e8 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_wildcard.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_wildcard.py @@ -15,42 +15,47 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_wildcard +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_wildcard, +) OBJECT = { "name": "New Wildcard 1", "ipv4_address": "192.168.2.1", - "ipv4_mask_wildcard": "0.0.0.128" + "ipv4_mask_wildcard": "0.0.0.128", } CREATE_PAYLOAD = { "name": "New Wildcard 1", "ipv4_address": "192.168.2.1", - "ipv4_mask_wildcard": "0.0.0.128" + "ipv4_mask_wildcard": "0.0.0.128", } UPDATE_PAYLOAD = { "name": "New Wildcard 1", "color": "blue", "ipv6_address": "2001:db8::1111", - "ipv6_mask_wildcard": "ffff:ffff::f0f0" + "ipv6_mask_wildcard": "ffff:ffff::f0f0", } OBJECT_AFTER_UPDATE = UPDATE_PAYLOAD -DELETE_PAYLOAD = { - "name": "New Wildcard 1", - "state": "absent" -} +DELETE_PAYLOAD = {"name": "New Wildcard 1", "state": "absent"} -function_path = 'ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_wildcard.api_call' -api_call_object = 'wildcard' +function_path = "ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_wildcard.api_call" +api_call_object = "wildcard" class TestCheckpointWildcard(object): @@ -58,56 +63,69 @@ class TestCheckpointWildcard(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value def test_create(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT} + mock_function.return_value = {"changed": True, api_call_object: OBJECT} result = self._run_module(CREATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT.items() == result[api_call_object].items() def test_create_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT, + } result = self._run_module(CREATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_update(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": True, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert result['changed'] + assert result["changed"] assert OBJECT_AFTER_UPDATE.items() == result[api_call_object].items() def test_update_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False, api_call_object: OBJECT_AFTER_UPDATE} + mock_function.return_value = { + "changed": False, + api_call_object: OBJECT_AFTER_UPDATE, + } result = self._run_module(UPDATE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def test_delete(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': True} + mock_function.return_value = {"changed": True} result = self._run_module(DELETE_PAYLOAD) - assert result['changed'] + assert result["changed"] def test_delete_idempotent(self, mocker, connection_mock): mock_function = mocker.patch(function_path) - mock_function.return_value = {'changed': False} + mock_function.return_value = {"changed": False} result = self._run_module(DELETE_PAYLOAD) - assert not result['changed'] + assert not result["changed"] def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_wildcard_facts.py b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_wildcard_facts.py index a16c3fe81..5484623a8 100644 --- a/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_wildcard_facts.py +++ b/ansible_collections/check_point/mgmt/tests/units/modules/test_cp_mgmt_wildcard_facts.py @@ -15,35 +15,36 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest -from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson +from units.modules.utils import ( + set_module_args, + exit_json, + fail_json, + AnsibleExitJson, +) from ansible.module_utils import basic -from ansible_collections.check_point.mgmt.plugins.modules import cp_mgmt_wildcard_facts +from ansible_collections.check_point.mgmt.plugins.modules import ( + cp_mgmt_wildcard_facts, +) OBJECT = { "from": 1, "to": 1, "total": 6, - "objects": [ - "53de74b7-8f19-4cbe-99fc-a81ef0759bad" - ] + "objects": ["53de74b7-8f19-4cbe-99fc-a81ef0759bad"], } -SHOW_PLURAL_PAYLOAD = { - 'limit': 1, - 'details_level': 'uid' -} +SHOW_PLURAL_PAYLOAD = {"limit": 1, "details_level": "uid"} -SHOW_SINGLE_PAYLOAD = { - 'name': 'object_which_is_not_exist' -} +SHOW_SINGLE_PAYLOAD = {"name": "object_which_is_not_exist"} -api_call_object = 'wildcard' -api_call_object_plural_version = 'wildcards' -failure_msg = '''{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}''' +api_call_object = "wildcard" +api_call_object_plural_version = "wildcards" +failure_msg = """{u'message': u'Requested object [object_which_is_not_exist] not found', u'code': u'generic_err_object_not_found'}""" class TestCheckpointWildcardFacts(object): @@ -51,29 +52,40 @@ class TestCheckpointWildcardFacts(object): @pytest.fixture(autouse=True) def module_mock(self, mocker): - return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) + return mocker.patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) @pytest.fixture def connection_mock(self, mocker): - connection_class_mock = mocker.patch('ansible.module_utils.network.checkpoint.checkpoint.Connection') + connection_class_mock = mocker.patch( + "ansible.module_utils.network.checkpoint.checkpoint.Connection" + ) return connection_class_mock.return_value - def test_show_single_object_which_is_not_exist(self, mocker, connection_mock): + def test_show_single_object_which_is_not_exist( + self, mocker, connection_mock + ): connection_mock.send_request.return_value = (404, failure_msg) try: result = self._run_module(SHOW_SINGLE_PAYLOAD) except Exception as e: result = e.args[0] - assert result['failed'] - assert 'Checkpoint device returned error 404 with message ' + failure_msg == result['msg'] + assert result["failed"] + assert ( + "Checkpoint device returned error 404 with message " + failure_msg + == result["msg"] + ) def test_show_few_objects(self, mocker, connection_mock): connection_mock.send_request.return_value = (200, OBJECT) result = self._run_module(SHOW_PLURAL_PAYLOAD) - assert not result['changed'] - assert OBJECT == result['ansible_facts'][api_call_object_plural_version] + assert not result["changed"] + assert ( + OBJECT == result["ansible_facts"][api_call_object_plural_version] + ) def _run_module(self, module_args): set_module_args(module_args) diff --git a/ansible_collections/check_point/mgmt/tests/units/plugins/httpapi/test_checkpoint.py b/ansible_collections/check_point/mgmt/tests/units/plugins/httpapi/test_checkpoint.py index 32ac0b0f3..adfaac557 100644 --- a/ansible_collections/check_point/mgmt/tests/units/plugins/httpapi/test_checkpoint.py +++ b/ansible_collections/check_point/mgmt/tests/units/plugins/httpapi/test_checkpoint.py @@ -1,7 +1,8 @@ # (c) 2018 Red Hat Inc. # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function + __metaclass__ = type import json @@ -13,19 +14,17 @@ from units.compat import unittest from ansible.errors import AnsibleConnectionFailure from ansible.module_utils.connection import ConnectionError from ansible.module_utils.six import BytesIO, StringIO -from ansible_collections.check_point.mgmt.plugins.httpapi.checkpoint import HttpApi +from ansible_collections.check_point.mgmt.plugins.httpapi.checkpoint import ( + HttpApi, +) -EXPECTED_BASE_HEADERS = { - 'Content-Type': 'application/json' -} +EXPECTED_BASE_HEADERS = {"Content-Type": "application/json"} class FakeCheckpointHttpApiPlugin(HttpApi): def __init__(self, conn): super(FakeCheckpointHttpApiPlugin, self).__init__(conn) - self.hostvars = { - 'domain': None - } + self.hostvars = {"domain": None} def get_option(self, option): return self.hostvars[option] @@ -35,52 +34,70 @@ class FakeCheckpointHttpApiPlugin(HttpApi): class TestCheckpointHttpApi(unittest.TestCase): - def setUp(self): self.connection_mock = mock.Mock() - self.checkpoint_plugin = FakeCheckpointHttpApiPlugin(self.connection_mock) - self.checkpoint_plugin._load_name = 'httpapi' + self.checkpoint_plugin = FakeCheckpointHttpApiPlugin( + self.connection_mock + ) + self.checkpoint_plugin._load_name = "httpapi" - def test_login_raises_exception_when_username_and_password_are_not_provided(self): + def test_login_raises_exception_when_username_and_password_are_not_provided( + self, + ): with self.assertRaises(AnsibleConnectionFailure) as res: self.checkpoint_plugin.login(None, None) - assert 'Username and password are required' in str(res.exception) + assert "Username and password are required" in str(res.exception) def test_login_raises_exception_when_invalid_response(self): self.connection_mock.send.return_value = self._connection_response( - {'NOSIDKEY': 'NOSIDVALUE'} + {"NOSIDKEY": "NOSIDVALUE"} ) with self.assertRaises(ConnectionError) as res: - self.checkpoint_plugin.login('foo', 'bar') + self.checkpoint_plugin.login("foo", "bar") - assert 'Server returned response without token info during connection authentication' in str(res.exception) + assert ( + "Server returned response without token info during connection authentication" + in str(res.exception) + ) - def test_send_request_should_return_error_info_when_http_error_raises(self): - self.connection_mock.send.side_effect = HTTPError('http://testhost.com', 500, '', {}, - StringIO('{"errorMessage": "ERROR"}')) + def test_send_request_should_return_error_info_when_http_error_raises( + self, + ): + self.connection_mock.send.side_effect = HTTPError( + "http://testhost.com", + 500, + "", + {}, + StringIO('{"errorMessage": "ERROR"}'), + ) - resp = self.checkpoint_plugin.send_request('/test', None) + resp = self.checkpoint_plugin.send_request("/test", None) - assert resp == (500, {'errorMessage': 'ERROR'}) + assert resp == (500, {"errorMessage": "ERROR"}) def test_login_to_global_domain(self): - temp_domain = self.checkpoint_plugin.hostvars['domain'] - self.checkpoint_plugin.hostvars['domain'] = 'test_domain' + temp_domain = self.checkpoint_plugin.hostvars["domain"] + self.checkpoint_plugin.hostvars["domain"] = "test_domain" self.connection_mock.send.return_value = self._connection_response( - {'sid': 'SID', 'uid': 'UID'} + {"sid": "SID", "uid": "UID"} ) - self.checkpoint_plugin.login('USERNAME', 'PASSWORD') + self.checkpoint_plugin.login("USERNAME", "PASSWORD") - self.connection_mock.send.assert_called_once_with('/web_api/login', mock.ANY, headers=mock.ANY, - method=mock.ANY) - self.checkpoint_plugin.hostvars['domain'] = temp_domain + self.connection_mock.send.assert_called_once_with( + "/web_api/login", mock.ANY, headers=mock.ANY, method=mock.ANY + ) + self.checkpoint_plugin.hostvars["domain"] = temp_domain @staticmethod def _connection_response(response, status=200): response_mock = mock.Mock() response_mock.getcode.return_value = status - response_text = json.dumps(response) if type(response) is dict else response - response_data = BytesIO(response_text.encode() if response_text else ''.encode()) + response_text = ( + json.dumps(response) if type(response) is dict else response + ) + response_data = BytesIO( + response_text.encode() if response_text else "".encode() + ) return response_mock, response_data |